prismarine-world 3.6.3 → 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.
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- node-version: [18.x]
16
+ node-version: [24.x]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
@@ -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: 18.0.0
19
+ node-version: 24
20
+ registry-url: 'https://registry.npmjs.org'
17
21
  - id: publish
18
- uses: JS-DevTools/npm-publish@v1
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 != 'none'
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,15 @@
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
+
3
13
  ### 3.6.3
4
14
 
5
15
  * Add intersect property to raycast result type [#137](https://github.com/PrismarineJS/prismarine-world/pull/137)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-world",
3
- "version": "3.6.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": "^29.1.0",
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": "^10.0.0",
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 = iter.next()
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 = iter.next()
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)
@@ -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/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 { RaycastBlock } from "./iterators";
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<RaycastBlock | null>;
59
+ ): Promise<RaycastResult | null>;
60
60
 
61
61
  public getLoadedColumn(chunkX: number, chunkZ: number): Chunk;
62
62