flying-squid icon indicating copy to clipboard operation
flying-squid copied to clipboard

1.16.2 and 1.16.3 support

Open rom1504 opened this issue 4 years ago • 13 comments

we have nmp support now https://github.com/PrismarineJS/node-minecraft-protocol/pull/757#issuecomment-678520061 indications for mineflayer support we need adaptations for use of these 3 packets (cc @GroobleDierne )

rom1504 avatar Oct 06 '20 20:10 rom1504

relevant mineflayer issue https://github.com/PrismarineJS/mineflayer/issues/1264

rom1504 avatar Oct 06 '20 20:10 rom1504

only thing needed is login packet change here

rom1504 avatar Oct 22 '20 20:10 rom1504

relevant mineflayer PR https://github.com/PrismarineJS/mineflayer/pull/1349

rom1504 avatar Oct 22 '20 20:10 rom1504

image Minecraft 1.16.3, I tried to debug through the code but couldn't find the reason, I put console.log before every steps in login.js trying to locate the issue, i am not familiar with the lifecycle

November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for repeater
November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for oak_sign
November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for spruce_sign
November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for birch_sign
November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for acacia_sign
November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for jungle_sign
November 26th 2020, 07:03:04 [Warning] onItemPlace handler was registered twice for dark_oak_sign
November 26th 2020, 07:03:04 [INFO]: Server listening on port 25565
November 26th 2020, 07:03:04 seed: 95338055
add player
send login
November 26th 2020, 07:03:10 [ERR]: Client ::ffff:127.0.0.1:38842 : TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
    at Function.byteLength (buffer.js:728:11)
    at Object.shortString (eval at compile (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:245:12), <anonymous>:45:25)
    at nbt (eval at compile (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:245:12), <anonymous>:110:32)
    at CompiledProtodef.sizeOf (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:77:14)
    at Object.sizeOfNbt [as nbt] (/mnt/data/projects/nodejs/flying-squid/node_modules/minecraft-protocol/src/datatypes/minecraft.js:41:20)
    at Object.packet_login (eval at compile (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:245:12), <anonymous>:1078:24)
    at eval (eval at compile (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:245:12), <anonymous>:2292:50)
    at packet (eval at compile (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:245:12), <anonymous>:2346:9)
    at CompiledProtodef.sizeOf (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:77:14)
    at e.message (/mnt/data/projects/nodejs/flying-squid/node_modules/protodef/src/compiler.js:84:40)
send spawn pos
send pos
send abilities
send map
November 26th 2020, 07:03:10 [ERR]: Client ::ffff:127.0.0.1:38842 : Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
November 26th 2020, 07:03:10 [INFO]: 0nepeop1e disconnected
update hp
set xp
update inv
update time
fill tab
spawn
November 26th 2020, 07:03:10 [INFO]: 0nepeop1e (::ffff:127.0.0.1) connected
November 26th 2020, 07:03:10 [INFO]: position written, player spawning...```

eslym avatar Nov 25 '20 23:11 eslym

did you change the login packet yet ? I put the link on how to do that above

rom1504 avatar Nov 25 '20 23:11 rom1504

Index: src/lib/plugins/blockUpdates.js
<+>UTF-8
===================================================================
--- src/lib/plugins/blockUpdates.js	(revision 65c63207f23b2e34b2c09197f1eba4d614c86a9d)
+++ src/lib/plugins/blockUpdates.js	(revision 467e8c0270f977ce2d7d2a984d27841059c8ae69)
@@ -29,13 +29,14 @@
       const records = []
       for (const p of updates.values()) {
         const state = await world.getBlockStateId(p)
-        records.push({
-          horizontalPos: ((p.x & 0xF) << 4) | (p.z & 0xF),
-          y: p.y,
-          blockId: state
-        })
+        records.push(state)
       }
-      packets.push({ chunkX, chunkZ, records })
+      const chunkCoordinates = {
+        x: chunkX,
+        y: 0,
+        z: chunkZ
+      }
+      packets.push({ chunkCoordinates, notTrustEdges: false, records })
     }
     return packets
   }
Index: src/lib/plugins/login.js
<+>UTF-8
===================================================================
--- src/lib/plugins/login.js	(revision 65c63207f23b2e34b2c09197f1eba4d614c86a9d)
+++ src/lib/plugins/login.js	(revision 467e8c0270f977ce2d7d2a984d27841059c8ae69)
@@ -89,10 +89,10 @@
       levelType: 'default',
       gameMode: player.gameMode,
       previousGameMode: player.prevGameMode,
-      worldNames: Object.values(serv.dimensionNames),
-      dimensionCodec: dimensionCodec,
-      worldName: serv.dimensionNames[0],
-      dimension: serv.supportFeature('dimensionIsAString') ? serv.dimensionNames[0] : 0,
+      worldNames: mcData.loginPacket.worldNames,
+      dimensionCodec: mcData.loginPacket.dimensionCodec,
+      worldName: mcData.loginPacket.worldNames[0],
+      dimension: mcData.loginPacket.dimension, // serv.supportFeature('dimensionIsAString') ? serv.dimensionNames[0] : 0,
       hashedSeed: serv.hashedSeed,
       difficulty: serv.difficulty,
       viewDistance: settings['view-distance'],
@@ -100,7 +100,8 @@
       maxPlayers: Math.min(255, serv._server.maxPlayers),
       enableRespawnScreen: true,
       isDebug: false,
-      isFlat: false
+      isFlat: false,
+      isHardcore: false
     })
     if (serv.supportFeature('difficultySentSeparately')) {
       player._client.write('difficulty', {
Index: src/lib/plugins/world.js
<+>UTF-8
===================================================================
--- src/lib/plugins/world.js	(revision 65c63207f23b2e34b2c09197f1eba4d614c86a9d)
+++ src/lib/plugins/world.js	(revision 467e8c0270f977ce2d7d2a984d27841059c8ae69)
@@ -150,7 +150,7 @@
         groundUp: true,
         bitMap: chunk.getMask(),
         biomes: chunk.dumpBiomes(),
-        ignoreOldData: true, // should be false when a chunk section is updated instead of the whole chunk being overwritten, do we ever do that?
+        // ignoreOldData: true, // should be false when a chunk section is updated instead of the whole chunk being overwritten, do we ever do that?
         heightmaps: {
           type: 'compound',
           name: '',

It works after i made these changes, but I have totally no idea is it correct for the block updates part, because there is no protocol documentation yet for the newer packet_multi_block_change

eslym avatar Nov 26 '20 07:11 eslym

Have a look at this https://github.com/PrismarineJS/mineflayer/pull/1349#issuecomment-706576571 https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/blocks.js#L357

GroobleDierne avatar Nov 28 '20 10:11 GroobleDierne

1.16.4 and 1.16.5 exist now, any status on this?

ghost avatar May 17 '21 14:05 ghost

Yes nobody spent the hour needed to complete this. Are you interested to do this ?

rom1504 avatar May 17 '21 14:05 rom1504

no, not really

ghost avatar May 17 '21 14:05 ghost

no updates yet?

NoNameLmao avatar Jun 18 '21 20:06 NoNameLmao

no, do you want to do it @NoNameLmao ?

rom1504 avatar Jun 19 '21 15:06 rom1504

no, do you want to do it @NoNameLmao ?

yes i do, but i dont know javascript that well,

NoNameLmao avatar Jun 19 '21 21:06 NoNameLmao