From ad20637911ccd60d962147d9b478bae824ecd408 Mon Sep 17 00:00:00 2001 From: Madlykeanu Date: Tue, 15 Oct 2024 18:44:28 -0600 Subject: [PATCH 01/17] add 1.21 to version.js --- lib/version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/version.js b/lib/version.js index 755db7285..64deca2e1 100644 --- a/lib/version.js +++ b/lib/version.js @@ -1,4 +1,4 @@ -const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6'] +const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21'] module.exports = { testedVersions, From 092d8f45522f725f5cbfbe247f2ca7e69b5fe36d Mon Sep 17 00:00:00 2001 From: Madlykeanu Date: Fri, 18 Oct 2024 15:25:01 -0600 Subject: [PATCH 02/17] update readme --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 2569ccbbf..a4013cfe9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,7 +17,7 @@ First time using Node.js? You may want to start with the [tutorial](tutorial.md) ## Features - * Supports Minecraft 1.8 to 1.20.5 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20 upto 1.20.6) + * Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, and 1.21) * Entity knowledge and tracking. * Block knowledge. You can query the world around you. Milliseconds to find any block. * Physics and movement - handle all bounding boxes From d47ae2a6ac628fe08fddd368139f949d7ec9f58c Mon Sep 17 00:00:00 2001 From: Madlykeanu Date: Fri, 18 Oct 2024 16:03:05 -0600 Subject: [PATCH 03/17] added ci step to get correct minecraft data --- .github/workflows/ci.yml | 1 + package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e307beace..db31446bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,5 +56,6 @@ jobs: java-package: jre - name: Install Dependencies run: npm install + - run: cd node_modules && cd minecraft-data && mv minecraft-data minecraft-data-old && git clone -b pc1.21 https://github.com/GroobleDierne/minecraft-data.git --depth 1 && node bin/generate_data.js - name: Start Tests run: npm run mocha_test -- -g ${{ matrix.mcVersion }}v diff --git a/package.json b/package.json index eef358235..2e63556aa 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "license": "MIT", "dependencies": { "minecraft-data": "^3.76.0", - "minecraft-protocol": "^1.49.0", + "minecraft-protocol": "github:GroobleDierne/node-minecraft-protocol#1.21", "prismarine-biome": "^1.1.1", "prismarine-block": "^1.17.0", "prismarine-chat": "^1.7.1", @@ -43,7 +43,7 @@ "@types/node": "^22.1.0", "doctoc": "^2.0.1", "minecraft-wrap": "^1.3.0", - "mineflayer": "file:.", + "mineflayer": "file:", "mocha": "^10.0.0", "protodef-yaml": "^1.5.3", "standard": "^17.0.0", From 1c59b7f380623b2e1536fcdc52ceb54c2b732750 Mon Sep 17 00:00:00 2001 From: Madlykeanu Date: Fri, 18 Oct 2024 16:27:19 -0600 Subject: [PATCH 04/17] uses updated prismarine chunk --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e63556aa..0629fff0d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "prismarine-biome": "^1.1.1", "prismarine-block": "^1.17.0", "prismarine-chat": "^1.7.1", - "prismarine-chunk": "^1.34.0", + "prismarine-chunk": "github:Madlykeanu/prismarine-chunk#1.21", "prismarine-entity": "^2.3.0", "prismarine-item": "^1.15.0", "prismarine-nbt": "^2.0.0", From 56d7b8e8ed6a4a66cafb1ffbbe8dc5b0040bdb8e Mon Sep 17 00:00:00 2001 From: Madlykeanu Date: Mon, 21 Oct 2024 17:01:55 -0600 Subject: [PATCH 05/17] uses updated prismarine physics --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0629fff0d..9c2309e37 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "prismarine-entity": "^2.3.0", "prismarine-item": "^1.15.0", "prismarine-nbt": "^2.0.0", - "prismarine-physics": "^1.8.0", + "prismarine-physics": "github:Madlykeanu/prismarine-physics#1.21", "prismarine-recipe": "^1.3.0", "prismarine-registry": "^1.8.0", "prismarine-windows": "^2.9.0", From 0206d3072d9e1f1e45676356169a5f7af10161f8 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 01:28:44 +0200 Subject: [PATCH 06/17] Used fixed pregistry --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9c2309e37..c71577991 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "prismarine-nbt": "^2.0.0", "prismarine-physics": "github:Madlykeanu/prismarine-physics#1.21", "prismarine-recipe": "^1.3.0", - "prismarine-registry": "^1.8.0", + "prismarine-registry": "github:SuperGamerTron/prismarine-registry#1.21", "prismarine-windows": "^2.9.0", "prismarine-world": "^3.6.0", "protodef": "1.17.0", From ffe7eca2f2d064e35f4cb0c9eac60d541f069ab5 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 14:45:26 +0200 Subject: [PATCH 07/17] Add rotation --- lib/plugins/inventory.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plugins/inventory.js b/lib/plugins/inventory.js index 0277f3fef..42eab1d50 100644 --- a/lib/plugins/inventory.js +++ b/lib/plugins/inventory.js @@ -122,7 +122,8 @@ function inject (bot, { hideErrors }) { }) } else if (bot.supportFeature('useItemWithOwnPacket')) { bot._client.write('use_item', { - hand: offHand ? 1 : 0 + hand: offHand ? 1 : 0, + rotation: { x: 0, y: 0 } }) } } From ba259ea22642fcc2cbd38dbf1e5aa2b2177545ab Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 14:52:25 +0200 Subject: [PATCH 08/17] Back at base pregistry --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c71577991..9c2309e37 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "prismarine-nbt": "^2.0.0", "prismarine-physics": "github:Madlykeanu/prismarine-physics#1.21", "prismarine-recipe": "^1.3.0", - "prismarine-registry": "github:SuperGamerTron/prismarine-registry#1.21", + "prismarine-registry": "^1.8.0", "prismarine-windows": "^2.9.0", "prismarine-world": "^3.6.0", "protodef": "1.17.0", From fa44fba72d79ee42befcef40353324b53b3857d6 Mon Sep 17 00:00:00 2001 From: extremeheat Date: Sat, 26 Oct 2024 09:11:48 -0400 Subject: [PATCH 09/17] Update chat.js --- lib/plugins/chat.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/plugins/chat.js b/lib/plugins/chat.js index 9522223c6..2f753a426 100644 --- a/lib/plugins/chat.js +++ b/lib/plugins/chat.js @@ -109,6 +109,8 @@ function inject (bot, options) { addDefaultPatterns() bot._client.on('playerChat', (data) => { + console.log('Player chat.') + console.dir(data) const message = data.formattedMessage const verified = data.verified let msg From 10c936264fd0ccbe053ba9f42fd2de94ae816089 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 20:28:24 +0200 Subject: [PATCH 10/17] update pregistry and ci.yml for mcdata --- .github/workflows/ci.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db31446bd..dc04857ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,6 @@ jobs: java-package: jre - name: Install Dependencies run: npm install - - run: cd node_modules && cd minecraft-data && mv minecraft-data minecraft-data-old && git clone -b pc1.21 https://github.com/GroobleDierne/minecraft-data.git --depth 1 && node bin/generate_data.js + - run: cd node_modules && cd minecraft-data && mv minecraft-data minecraft-data-old && git clone -b pc1.21 https://github.com/PrismarineJS/minecraft-data.git --depth 1 && node bin/generate_data.js - name: Start Tests run: npm run mocha_test -- -g ${{ matrix.mcVersion }}v diff --git a/package.json b/package.json index 9c2309e37..c71577991 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "prismarine-nbt": "^2.0.0", "prismarine-physics": "github:Madlykeanu/prismarine-physics#1.21", "prismarine-recipe": "^1.3.0", - "prismarine-registry": "^1.8.0", + "prismarine-registry": "github:SuperGamerTron/prismarine-registry#1.21", "prismarine-windows": "^2.9.0", "prismarine-world": "^3.6.0", "protodef": "1.17.0", From 9ee057ebbfb253686e726e6954e6277539c8a00d Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 20:32:47 +0200 Subject: [PATCH 11/17] 1.21.1 --- lib/version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/version.js b/lib/version.js index 64deca2e1..291917cb0 100644 --- a/lib/version.js +++ b/lib/version.js @@ -1,4 +1,4 @@ -const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21'] +const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1'] module.exports = { testedVersions, From 04ff085c05fbd621a8940aab1b4dce93ea122c1f Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 21:18:34 +0200 Subject: [PATCH 12/17] Properly handle data.type in chat.js --- lib/plugins/chat.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/plugins/chat.js b/lib/plugins/chat.js index 2f753a426..c9dcffa34 100644 --- a/lib/plugins/chat.js +++ b/lib/plugins/chat.js @@ -120,10 +120,11 @@ function inject (bot, options) { target: data.targetName ? JSON.parse(data.targetName) : undefined, content: message ? JSON.parse(message) : { text: data.plainMessage } } - msg = ChatMessage.fromNetwork(data.type, parameters) + const registryIndex = data.type.registryIndex ? data.type.registryIndex : data.type + msg = ChatMessage.fromNetwork(registryIndex, parameters) if (data.unsignedContent) { - msg.unsigned = ChatMessage.fromNetwork(data.type, { sender: parameters.sender, target: parameters.target, content: JSON.parse(data.unsignedContent) }) + msg.unsigned = ChatMessage.fromNetwork(registryIndex, { sender: parameters.sender, target: parameters.target, content: JSON.parse(data.unsignedContent) }) } } else { msg = ChatMessage.fromNotch(message) From 95a6ea0e1e0455783381e3945b8506bce027ce35 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 21:49:37 +0200 Subject: [PATCH 13/17] update package.json --- lib/plugins/chat.js | 2 -- package.json | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/plugins/chat.js b/lib/plugins/chat.js index c9dcffa34..ce92cc9c5 100644 --- a/lib/plugins/chat.js +++ b/lib/plugins/chat.js @@ -109,8 +109,6 @@ function inject (bot, options) { addDefaultPatterns() bot._client.on('playerChat', (data) => { - console.log('Player chat.') - console.dir(data) const message = data.formattedMessage const verified = data.verified let msg diff --git a/package.json b/package.json index c71577991..b86557d40 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,13 @@ "prismarine-biome": "^1.1.1", "prismarine-block": "^1.17.0", "prismarine-chat": "^1.7.1", - "prismarine-chunk": "github:Madlykeanu/prismarine-chunk#1.21", + "prismarine-chunk": "^1.36.0", "prismarine-entity": "^2.3.0", "prismarine-item": "^1.15.0", "prismarine-nbt": "^2.0.0", - "prismarine-physics": "github:Madlykeanu/prismarine-physics#1.21", + "prismarine-physics": "^1.9.0", "prismarine-recipe": "^1.3.0", - "prismarine-registry": "github:SuperGamerTron/prismarine-registry#1.21", + "prismarine-registry": "^1.10.0", "prismarine-windows": "^2.9.0", "prismarine-world": "^3.6.0", "protodef": "1.17.0", From 882af5e7a376f687d14c7339984922144173f901 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 22:19:38 +0200 Subject: [PATCH 14/17] fishing rod is stronger; make fish area bigger in fishing test --- test/externalTests/fishing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/externalTests/fishing.js b/test/externalTests/fishing.js index c0348c77d..cad7dc427 100644 --- a/test/externalTests/fishing.js +++ b/test/externalTests/fishing.js @@ -1,7 +1,7 @@ module.exports = () => async (bot) => { const Item = require('prismarine-item')(bot.registry) - bot.test.sayEverywhere('/fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 water') + bot.test.sayEverywhere('/fill ~-10 ~-1 ~-10 ~10 ~-1 ~10 water') await bot.test.setInventorySlot(36, new Item(bot.registry.itemsByName.fishing_rod.id, 1, 0)) await bot.lookAt(bot.entity.position) // dont force the position bot.fish() From 1bb355e79c704eade52cce56204e090b40a45753 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 22:32:15 +0200 Subject: [PATCH 15/17] fix internal tests --- test/internalTest.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/test/internalTest.js b/test/internalTest.js index 4c930d650..2f74e03d1 100644 --- a/test/internalTest.js +++ b/test/internalTest.js @@ -58,7 +58,6 @@ for (const supportedVersion of mineflayer.testedVersions) { // 25565 - local server, 25566 - proxy server port: 25567 }) - console.log('Server Codec', server.registryCodec) server.on('listening', () => { bot = mineflayer.createBot({ username: 'player', @@ -130,7 +129,19 @@ for (const supportedVersion of mineflayer.testedVersions) { const uuid = 'd3527a0b-bc03-45d5-a878-2aafdd8c8a43' // random const networkName = chatText('gary') - if (registry.supportFeature('useChatSessions')) { + if (registry.supportFeature('incrementedChatType')) { + client.write('player_chat', { + plainMessage: 'hello', + filterType: 0, + type: { registryIndex: 1 }, + networkName, + previousMessages: [], + senderUuid: uuid, + timestamp: Date.now(), + index: 0, + salt: 0n + }) + } else if (registry.supportFeature('useChatSessions')) { client.write('player_chat', { plainMessage: 'hello', filterType: 0, @@ -909,9 +920,9 @@ for (const supportedVersion of mineflayer.testedVersions) { const zombieId = entities.zombie ? entities.zombie.id : entities.Zombie.id let bedBlock - if (mineflayer.supportFeature('oneBlockForSeveralVariations', version.majorVersion)) { + if (bot.supportFeature('oneBlockForSeveralVariations', version.majorVersion)) { bedBlock = blocks.bed - } else if (mineflayer.supportFeature('blockSchemeIsFlat', version.majorVersion)) { + } else if (bot.supportFeature('blockSchemeIsFlat', version.majorVersion)) { bedBlock = blocks.red_bed } const bedId = bedBlock.id @@ -945,7 +956,7 @@ for (const supportedVersion of mineflayer.testedVersions) { chunk.setBlockType(beds[bed].foot, bedId) } - if (mineflayer.supportFeature('blockStateId', version.majorVersion)) { + if (bot.supportFeature('blockStateId', version.majorVersion)) { chunk.setBlockStateId(beds[0].foot, 3 + bedBlock.minStateId) // { facing: north, occupied: false, part: foot } chunk.setBlockStateId(beds[0].head, 2 + bedBlock.minStateId) // { facing:north, occupied: false, part: head } @@ -957,7 +968,7 @@ for (const supportedVersion of mineflayer.testedVersions) { chunk.setBlockStateId(beds[3].foot, 11 + bedBlock.minStateId) // { facing: west, occupied: false, part: foot } chunk.setBlockStateId(beds[3].head, 10 + bedBlock.minStateId) // { facing: west, occupied: false, part: head } - } else if (mineflayer.supportFeature('blockMetadata', version.majorVersion)) { + } else if (bot.supportFeature('blockMetadata', version.majorVersion)) { chunk.setBlockData(beds[0].foot, 2) // { facing: north, occupied: false, part: foot } chunk.setBlockData(beds[0].head, 10) // { facing:north, occupied: false, part: head } From 9c2432a482f44f99b83c1ec394597bbc02062101 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 23:44:05 +0200 Subject: [PATCH 16/17] remove debug install --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc04857ab..e307beace 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,5 @@ jobs: java-package: jre - name: Install Dependencies run: npm install - - run: cd node_modules && cd minecraft-data && mv minecraft-data minecraft-data-old && git clone -b pc1.21 https://github.com/PrismarineJS/minecraft-data.git --depth 1 && node bin/generate_data.js - name: Start Tests run: npm run mocha_test -- -g ${{ matrix.mcVersion }}v From 24fde39720e8cecd8760f773f0972bab6e08374f Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 26 Oct 2024 23:55:09 +0200 Subject: [PATCH 17/17] go back to upstream nmp --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b86557d40..46d5a27b1 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "license": "MIT", "dependencies": { "minecraft-data": "^3.76.0", - "minecraft-protocol": "github:GroobleDierne/node-minecraft-protocol#1.21", + "minecraft-protocol": "^1.50.0", "prismarine-biome": "^1.1.1", "prismarine-block": "^1.17.0", "prismarine-chat": "^1.7.1",