Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial 1.20.2 support #1264

Closed
wants to merge 7 commits into from
Closed

Conversation

crux153
Copy link

@crux153 crux153 commented Dec 12, 2023

Credits to @xZarex and @wgaylord.

This PR adds preliminary support for version 1.20.2 or later, including support for the configuration stage.

Before merging this PR, we need PrismarineJS/prismarine-nbt#78 to be merged and released.

I have tested that a bot can successfully log in to a server and interact with chunks using this patch. However, please note that I haven't tested all changes introduced in version 1.20.2.

@extremeheat
Copy link
Member

There is no need to make changes to the NBT like this. There are no changes to the NBT format minus a small special case inside the root compound. Instead, this can be fixed by adding a new parameter to the existing UUID type inside minecraft-data specifying the expected root type, and then implementing that inside nmp here. Inside prismarine-nbt, for the new root type, simply omit the name field in nbt.json.

@rom1504
Copy link
Member

rom1504 commented Dec 17, 2023

@crux153 can you please

  1. take into account the above comment from @extremeheat to implement this better ?
  2. change the version of prismarine-nbt here towards your PR to make the tests succeed

@extremeheat
Copy link
Member

Also to elaborate on how to do the change to minecraft-data, see how "string" is a "pstring" with a lengthType prop on it. Just like that you can do

"nbt": { tagType: "anonymousCompound" }

anonymousCompound would be alternative to "compound" in nbt.json, but without a name.

@crux153
Copy link
Author

crux153 commented Dec 18, 2023

@extremeheat I'm looking at minecraft-data and prismarine-nbt and trying to follow your instruction. But I'm quite confused since it seems like the compound type is actually defined using the nbt type in prismarine-nbt.

Also, according to my understanding, adding a parameter like pstring's countType would require defining parametrizable type.

I guess your intention is to avoid feature detection in prismarine-nbt and node-minecraft-protocol's protocol handling part, making it configurable in minecraft-data's protocol.json.

So in order to achieve something like

"nbt": [
  "nbt",
  {
    "tagType": "anonymousCompound"
  }
]

in minecraft-data/data/pc/1.20.2/protocol.json,

it would require defining an additional anonymousCompound under prismarine-nbt's nbt.json without name

"nbt": [
  "container",
  [
    {
      "name": "type",
      "type": "nbtMapper"
    },
    {
      "name": "name",
      "type": "nbtTagName"
    },
    {
      "name": "value",
      "type": ["nbtSwitch",{"type":"type"}]
    }
  ]
],
"anonymousCompound": [
  "container",
  [
    {
      "name": "type",
      "type": "nbtMapper"
    },
    {
      "name": "value",
      "type": ["nbtSwitch",{"type":"type"}]
    }
  ]
]

like this,

and then define a parametrizable nbt type in node-minecraft-protocol/src/datatypes/compiler-minecraft.js that resolves to nbt or anonymousCompound based on tagType.

Please correct me if I'm approaching this entirely wrong.

@rom1504
Copy link
Member

rom1504 commented Dec 27, 2023

thanks for the initial work here, we included information you found here and improved on it at #1265

@rom1504 rom1504 closed this Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

5 participants