PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.2k stars 241 forks source link

support 1.20.3 and .4 #1271

Closed rom1504 closed 4 months ago

rom1504 commented 6 months ago

depends on https://github.com/PrismarineJS/minecraft-data/pull/806

wgaylord commented 6 months ago

Changes in how chat is sent these are the player_chat packet logged directly out using JSON.stringify. 1.20.2

{
   "senderUuid":"a01e3843-e521-3998-958a-f459800e4d11",
   "index":0,
   "plainMessage":"hello everyone; I have logged in.",
   "timestamp":[
      396,
      -1230684696
   ],
   "salt":[
      0,
      0
   ],
   "previousMessages":[

   ],
   "filterType":0,
   "type":0,
   "networkName":"{\"insertion\":\"Player\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/tell Player \"},\"hoverEvent\":{\"action\":\"show_entity\",\"contents\":{\"type\":\"minecraft:player\",\"id\":\"a01e3843-e521-3998-958a-f459800e4d11\",\"name\":{\"text\":\"Player\"}}},\"text\":\"Player\"}"
}

vs 1.20.3

{
   "senderUuid":"a01e3843-e521-3998-958a-f459800e4d11",
   "index":0,
   "plainMessage":"hello everyone; I have logged in.",
   "timestamp":[
      396,
      -1230531388
   ],
   "salt":[
      0,
      0
   ],
   "previousMessages":[

   ],
   "filterType":0,
   "type":0,
   "networkName":{
      "type":"compound",
      "value":{
         "hoverEvent":{
            "type":"compound",
            "value":{
               "contents":{
                  "type":"compound",
                  "value":{
                     "name":{
                        "type":"string",
                        "value":"Player"
                     },
                     "id":{
                        "type":"intArray",
                        "value":[
                           -1608632253,
                           -450807400,
                           -1786055591,
                           -2146546415
                        ]
                     },
                     "type":{
                        "type":"string",
                        "value":"minecraft:player"
                     }
                  }
               },
               "action":{
                  "type":"string",
                  "value":"show_entity"
               }
            }
         },
         "clickEvent":{
            "type":"compound",
            "value":{
               "action":{
                  "type":"string",
                  "value":"suggest_command"
               },
               "value":{
                  "type":"string",
                  "value":"/tell Player "
               }
            }
         },
         "insertion":{
            "type":"string",
            "value":"Player"
         },
         "text":{
            "type":"string",
            "value":"Player"
         }
      }
   }
}
rom1504 commented 6 months ago

Ok can you try to call simplify on the nbt and print it ?

On Fri, Dec 29, 2023, 6:45 PM William Gaylord @.***> wrote:

Changes in how chat is sent these are the packet logged directly out using JSON.stringify. 1.20.2

{ "senderUuid":"a01e3843-e521-3998-958a-f459800e4d11", "index":0, "plainMessage":"hello everyone; I have logged in.", "timestamp":[ 396, -1230684696 ], "salt":[ 0, 0 ], "previousMessages":[

], "filterType":0, "type":0, "networkName":"{\"insertion\":\"Player\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/tell Player \"},\"hoverEvent\":{\"action\":\"show_entity\",\"contents\":{\"type\":\"minecraft:player\",\"id\":\"a01e3843-e521-3998-958a-f459800e4d11\",\"name\":{\"text\":\"Player\"}}},\"text\":\"Player\"}" }

vs 1.20.3

{ "senderUuid":"a01e3843-e521-3998-958a-f459800e4d11", "index":0, "plainMessage":"hello everyone; I have logged in.", "timestamp":[ 396, -1230531388 ], "salt":[ 0, 0 ], "previousMessages":[

], "filterType":0, "type":0, "networkName":{ "type":"compound", "value":{ "hoverEvent":{ "type":"compound", "value":{ "contents":{ "type":"compound", "value":{ "name":{ "type":"string", "value":"Player" }, "id":{ "type":"intArray", "value":[ -1608632253, -450807400, -1786055591, -2146546415 ] }, "type":{ "type":"string", "value":"minecraft:player" } } }, "action":{ "type":"string", "value":"show_entity" } } }, "clickEvent":{ "type":"compound", "value":{ "action":{ "type":"string", "value":"suggest_command" }, "value":{ "type":"string", "value":"/tell Player " } } }, "insertion":{ "type":"string", "value":"Player" }, "text":{ "type":"string", "value":"Player" } } } }

— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/node-minecraft-protocol/issues/1271#issuecomment-1872242364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437XXEN3QC7ILHGK2WSTYL36U3AVCNFSM6AAAAABBE3VFVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGI2DEMZWGQ . You are receiving this because you authored the thread.Message ID: @.***>

wgaylord commented 6 months ago

Here is the contents of the networkName after calling simplify on it (then passing it into JSON.stringify so it prints everything including the arrays) Its almost correct except for ID being an array of ints instead of a string UUID

{
  "hoverEvent": {
    "contents": {
      "name": "Player",
      "id": [
        -1608632253,
        -450807400,
        -1786055591,
        -2146546415
      ],
      "type": "minecraft:player"
    },
    "action": "show_entity"
  },
  "clickEvent": {
    "action": "suggest_command",
    "value": "/tell Player "
  },
  "insertion": "Player",
  "text": "Player"
}
Jammeren2 commented 5 months ago

do you have any ideas for version 1.20.3? Did you manage to fix the chat and tablist?

rom1504 commented 5 months ago

No idea needed, someone just need to finish https://github.com/PrismarineJS/node-minecraft-protocol/pull/1275

Opisek commented 4 months ago

Neither the event login nor playerJoin is getting triggered for me when I attempt to join on 1.20.4. Pinging for motd and favicon still works.

Is there something special that needs to be done for that version? I couldn't find anything in the readme.md or history.md.

extremeheat commented 4 months ago

Join what?