minecraft-packets 1.8.0 → 1.9.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.
@@ -18,6 +18,6 @@ jobs:
18
18
  - name: Use Node.js 18.x
19
19
  uses: actions/setup-node@v1
20
20
  with:
21
- node-version: 18.x
21
+ node-version: 24.x
22
22
  - run: npm install
23
23
  - run: npm test
@@ -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
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ comment-trigger:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Check out repository
16
+ uses: actions/checkout@v3
17
+ - name: Run command handlers
18
+ uses: PrismarineJS/prismarine-repo-actions@master
19
+ with:
20
+ token: ${{ secrets.PAT_PASSWORD }}
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
@@ -15,13 +18,12 @@ jobs:
15
18
  - name: Set up Node.js
16
19
  uses: actions/setup-node@master
17
20
  with:
18
- node-version: 14.0.0
21
+ node-version: 24
22
+ registry-url: 'https://registry.npmjs.org'
19
23
  - id: publish
20
- uses: JS-DevTools/npm-publish@v1
21
- with:
22
- token: ${{ secrets.NPM_AUTH_TOKEN }}
24
+ uses: JS-DevTools/npm-publish@v4
23
25
  - name: Create Release
24
- if: steps.publish.outputs.type != 'none'
26
+ if: ${{ steps.publish.outputs.type }}
25
27
  id: create_release
26
28
  uses: actions/create-release@v1
27
29
  env:
package/history.md CHANGED
@@ -1,4 +1,12 @@
1
1
  ## 1.8.0
2
+
3
+ ### 1.9.0
4
+ * [Add repo commands workflow (#30)](https://github.com/PrismarineJS/node-minecraft-packets/commit/6e4f15a892e2af6699759e67be3b1b9c1c3eef84) (thanks @rom1504)
5
+ * [Update CI to Node 24 (#29)](https://github.com/PrismarineJS/node-minecraft-packets/commit/cd70884808961fd8450784b7a66225f7a6eb194c) (thanks @rom1504)
6
+ * [Fix publish workflow for trusted publishing (#28)](https://github.com/PrismarineJS/node-minecraft-packets/commit/f089668ae6d93923bb840658ea82fc8ecca3220c) (thanks @rom1504)
7
+ * [Fix publish condition for npm-publish v4 (#27)](https://github.com/PrismarineJS/node-minecraft-packets/commit/9a63883fb90d962443f8b76b41e4509741fd323f) (thanks @rom1504)
8
+ * [Switch to trusted publishing via OIDC (#26)](https://github.com/PrismarineJS/node-minecraft-packets/commit/4cf8bbeda4ec368fe5e247d6600a22a5b42d0c67) (thanks @rom1504)
9
+
2
10
  * update mcPackets
3
11
 
4
12
  ## 1.7.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-packets",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "An easy way to query PrismarineJS/minecraft-packets",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- /* eslint-env mocha */
1
+ /* eslint-env mocha, jest */
2
2
  // Tests packet serialization/deserialization from with raw binary in nodejs
3
3
  const { createSerializer, createDeserializer, states } = require('minecraft-protocol')
4
4
  const mcPackets = require('minecraft-packets')
@@ -7,6 +7,17 @@ const assert = require('assert')
7
7
  const makeClientSerializer = version => createSerializer({ state: states.PLAY, version, isServer: true })
8
8
  const makeClientDeserializer = version => createDeserializer({ state: states.PLAY, version })
9
9
 
10
+ // Upstream bug in minecraft-protocol: the registryEntryHolder write handler
11
+ // does `offset += 1` instead of writing a 0x00 varint byte for inline sound data,
12
+ // leaving uninitialized buffer contents via Buffer.allocUnsafe in protodef.
13
+ // This causes non-deterministic round-trip failures for sound_effect packets
14
+ // that use inline sound names (versions 1.19.3+).
15
+ // Workaround: zero the serialization buffer before writing to neutralize the bug.
16
+ const origAllocUnsafe = Buffer.allocUnsafe
17
+ Buffer.allocUnsafe = function (size) {
18
+ return Buffer.alloc(size)
19
+ }
20
+
10
21
  Object.entries(mcPackets.pc).forEach(([ver, data]) => {
11
22
  let serializer, deserializer
12
23
 
@@ -41,3 +52,7 @@ Object.entries(mcPackets.pc).forEach(([ver, data]) => {
41
52
  })
42
53
  })
43
54
  })
55
+
56
+ afterAll(() => {
57
+ Buffer.allocUnsafe = origAllocUnsafe
58
+ })