prismarine-world 3.6.2 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/commands.yml +22 -0
- package/.github/workflows/publish.yml +7 -5
- package/docs/HISTORY.md +16 -0
- package/package.json +3 -3
- package/src/world.js +1 -1
- package/src/worldsync.js +1 -1
- package/test/raycast.test.js +8 -0
- package/types/iterators.d.ts +4 -0
- package/types/world.d.ts +3 -3
package/.github/workflows/ci.yml
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Repo Commands
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment: # Handle comment commands
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request: # Handle renamed PRs
|
|
7
|
+
types: [edited]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
comment-trigger:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Check out repository
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
- name: Run command handlers
|
|
16
|
+
uses: PrismarineJS/prismarine-repo-actions@master
|
|
17
|
+
with:
|
|
18
|
+
# NOTE: You must specify a Personal Access Token (PAT) with repo access here. While you can use the default GITHUB_TOKEN, actions taken with it will not trigger other actions, so if you have a CI workflow, commits created by this action will not trigger it.
|
|
19
|
+
token: ${{ secrets.PAT_PASSWORD }}
|
|
20
|
+
# See `Options` section below for more info on these options
|
|
21
|
+
install-command: npm install
|
|
22
|
+
/fixlint.fix-command: npm run fix
|
|
@@ -3,6 +3,9 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
branches:
|
|
5
5
|
- master # Change this to your default branch
|
|
6
|
+
permissions:
|
|
7
|
+
id-token: write
|
|
8
|
+
contents: write
|
|
6
9
|
jobs:
|
|
7
10
|
npm-publish:
|
|
8
11
|
name: npm-publish
|
|
@@ -13,13 +16,12 @@ jobs:
|
|
|
13
16
|
- name: Set up Node.js
|
|
14
17
|
uses: actions/setup-node@master
|
|
15
18
|
with:
|
|
16
|
-
node-version:
|
|
19
|
+
node-version: 24
|
|
20
|
+
registry-url: 'https://registry.npmjs.org'
|
|
17
21
|
- id: publish
|
|
18
|
-
uses: JS-DevTools/npm-publish@
|
|
19
|
-
with:
|
|
20
|
-
token: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
22
|
+
uses: JS-DevTools/npm-publish@v4
|
|
21
23
|
- name: Create Release
|
|
22
|
-
if: steps.publish.outputs.type
|
|
24
|
+
if: ${{ steps.publish.outputs.type }}
|
|
23
25
|
id: create_release
|
|
24
26
|
uses: actions/create-release@v1
|
|
25
27
|
env:
|
package/docs/HISTORY.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## History
|
|
2
2
|
|
|
3
|
+
### 3.7.0
|
|
4
|
+
* [Update CI to Node 24 (#160)](https://github.com/PrismarineJS/prismarine-world/commit/3dea527a5ce2c37f771496470172ce3f64587418) (thanks @rom1504)
|
|
5
|
+
* [Fix publish condition for npm-publish v4 (#159)](https://github.com/PrismarineJS/prismarine-world/commit/b0c44b621d3318601e9ec11bf3a87b741e19346f) (thanks @rom1504)
|
|
6
|
+
* [Switch to trusted publishing via OIDC (#158)](https://github.com/PrismarineJS/prismarine-world/commit/515219a59b7319689d206eadcd897f1f1389bb7c) (thanks @rom1504)
|
|
7
|
+
* [Bump expect from 29.7.0 to 30.1.2 (#156)](https://github.com/PrismarineJS/prismarine-world/commit/17752af927b24d7b09d22c43974aaa34af48b093) (thanks @dependabot[bot])
|
|
8
|
+
* [node 22 (#147)](https://github.com/PrismarineJS/prismarine-world/commit/67836a58eebcc28d13d19f62023756a4e639bc0a) (thanks @rom1504)
|
|
9
|
+
* [fix: The raycast was skipping the block that the client is inside. (#145)](https://github.com/PrismarineJS/prismarine-world/commit/63b6489c12a35abc9abf466c6644f51cef136a32) (thanks @zardoy)
|
|
10
|
+
* [Bump mocha from 10.8.2 to 11.0.1 (#146)](https://github.com/PrismarineJS/prismarine-world/commit/1d588910d7241821d357c326bfa951cbd4f604d7) (thanks @dependabot[bot])
|
|
11
|
+
* [Add missing RaycastResult Import (#142)](https://github.com/PrismarineJS/prismarine-world/commit/e46d026985b28f4c3f4cfe825ba15e743958e026) (thanks @Ell1ott)
|
|
12
|
+
|
|
13
|
+
### 3.6.3
|
|
14
|
+
|
|
15
|
+
* Add intersect property to raycast result type [#137](https://github.com/PrismarineJS/prismarine-world/pull/137)
|
|
16
|
+
* Update workflow templates
|
|
17
|
+
* Update to Node 18
|
|
18
|
+
|
|
3
19
|
### 3.6.2
|
|
4
20
|
|
|
5
21
|
* Fix chunk saving reference errors (@kf106 & @moonborrow) [#100](https://github.com/PrismarineJS/prismarine-world/pull/100)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prismarine-world",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "The core implementation of the world for prismarine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"homepage": "https://github.com/PrismarineJS/prismarine-world",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"buffer-equal": "^1.0.0",
|
|
36
|
-
"expect": "^
|
|
36
|
+
"expect": "^30.1.2",
|
|
37
37
|
"flatmap": "0.0.3",
|
|
38
38
|
"minecraft-data": "^3.0.0",
|
|
39
39
|
"mkdirp": "^0.5.1",
|
|
40
|
-
"mocha": "^
|
|
40
|
+
"mocha": "^11.0.1",
|
|
41
41
|
"prismarine-chunk": "^1.31.0",
|
|
42
42
|
"prismarine-provider-anvil": "^2.0.0",
|
|
43
43
|
"prismarine-provider-raw": "^1.0.1",
|
package/src/world.js
CHANGED
|
@@ -59,7 +59,7 @@ class World extends EventEmitter {
|
|
|
59
59
|
|
|
60
60
|
async raycast (from, direction, range, matcher = null) {
|
|
61
61
|
const iter = new RaycastIterator(from, direction, range)
|
|
62
|
-
let pos =
|
|
62
|
+
let pos = from
|
|
63
63
|
while (pos) {
|
|
64
64
|
const position = new Vec3(pos.x, pos.y, pos.z)
|
|
65
65
|
const block = await this.getBlock(position)
|
package/src/worldsync.js
CHANGED
|
@@ -39,7 +39,7 @@ class WorldSync extends EventEmitter {
|
|
|
39
39
|
|
|
40
40
|
raycast (from, direction, range, matcher = null) {
|
|
41
41
|
const iter = new RaycastIterator(from, direction, range)
|
|
42
|
-
let pos =
|
|
42
|
+
let pos = from
|
|
43
43
|
while (pos) {
|
|
44
44
|
const position = new Vec3(pos.x, pos.y, pos.z)
|
|
45
45
|
const block = this.getBlock(position)
|
package/test/raycast.test.js
CHANGED
|
@@ -46,4 +46,12 @@ describe('raycasting', function () {
|
|
|
46
46
|
const down = await world.raycast(head, new Vec3(0, -1, 0), 10)
|
|
47
47
|
assert.notStrictEqual(down, null)
|
|
48
48
|
})
|
|
49
|
+
|
|
50
|
+
it('raycast inside a block', async () => {
|
|
51
|
+
const head = new Vec3(0, 3.6, 0)
|
|
52
|
+
const inside = await world.raycast(head, new Vec3(0, 0, 1), 10)
|
|
53
|
+
assert.strictEqual(inside.position.x, 0)
|
|
54
|
+
assert.strictEqual(inside.position.y, 3)
|
|
55
|
+
assert.strictEqual(inside.position.z, 0)
|
|
56
|
+
})
|
|
49
57
|
})
|
package/types/iterators.d.ts
CHANGED
package/types/world.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { EventEmitter } from "events";
|
|
|
2
2
|
import type { Vec3 } from "vec3";
|
|
3
3
|
import type { Block } from "prismarine-block";
|
|
4
4
|
import loaderOfChunk from "prismarine-chunk";
|
|
5
|
-
import type {
|
|
5
|
+
import type { RaycastResult } from "./iterators";
|
|
6
6
|
|
|
7
7
|
export type Chunk = InstanceType<ReturnType<typeof loaderOfChunk>>;
|
|
8
8
|
|
|
@@ -56,7 +56,7 @@ export declare class World extends EventEmitter {
|
|
|
56
56
|
direction: Vec3,
|
|
57
57
|
range: number,
|
|
58
58
|
matcher?: (block: Block) => boolean,
|
|
59
|
-
): Promise<
|
|
59
|
+
): Promise<RaycastResult | null>;
|
|
60
60
|
|
|
61
61
|
public getLoadedColumn(chunkX: number, chunkZ: number): Chunk;
|
|
62
62
|
|
|
@@ -162,7 +162,7 @@ export declare class WorldSync extends EventEmitter {
|
|
|
162
162
|
direction: Vec3,
|
|
163
163
|
range: number,
|
|
164
164
|
matcher?: (block: Block) => boolean,
|
|
165
|
-
):
|
|
165
|
+
): RaycastResult | null;
|
|
166
166
|
|
|
167
167
|
private _emitBlockUpdate(
|
|
168
168
|
oldBlock: Block,
|