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

feat: Extract proper registry data from vanilla datapack #195

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

meyfa
Copy link
Owner

@meyfa meyfa commented Jun 27, 2024

Finally, the entire world is a plains biome!

Jokes aside, what this patch does is as follows: It expands the amount of data extracted from the official server to include the vanilla datapack registries, and adds code to parse them at run-time from the file system. This means the application now has a much better understanding of the knowledge shared by both the server and client.

For instance, when upgrading to a new version of Minecraft, I would previously have to capture the flow of Registry Data packets from a real server, which CobolCraft would then re-play as a blob. Any data within that packet, such as biome IDs or chat message types, would need to be hard-coded where they were needed, since the server-side aspects of the data would simply be missing.

Now, with the "--server" flag added in the Makefile, JSON files are exported for every vanilla registry entry. Using newly-implemented C++ routines to obtain directory listings (why is this not part of GnuCOBOL?), the registries can be filled in at run-time. The Registry Data packet now sends the actual data instead of an opaque blob.

As a proof-of-concept, the new methods are used to lookup the "minecraft:plains" biome at chunk allocation such that we get a much nicer tint of the environment (compared to "minecraft:badlands", which happened to be the default ID 0 when using the blob).

Finally, the entire world is a plains biome!

Jokes aside, what this patch does is as follows: It expands the amount
of data extracted from the official server to include the vanilla
datapack registries, and adds code to parse them at run-time from the
file system. This means the application now has a much better
understanding of the knowledge shared by both the server and client.

For instance, when upgrading to a new version of Minecraft, I would
previously have to capture the flow of Registry Data packets from a
real server, which CobolCraft would then re-play as a blob. Any data
within that packet, such as biome IDs or chat message types, would
need to be hard-coded where they were needed, since the server-side
aspects of the data would simply be missing.

Now, with the "--server" flag added in the Makefile, JSON files are
exported for every vanilla registry entry. Using newly-implemented
C++ routines to obtain directory listings (why is this not part of
GnuCOBOL?), the registries can be filled in at run-time. The Registry
Data packet now sends the actual data instead of an opaque blob.

As a proof-of-concept, the new methods are used to lookup the
"minecraft:plains" biome at chunk allocation such that we get a much
nicer tint of the environment (compared to "minecraft:badlands", which
happened to be the default ID 0 when using the blob).
@meyfa meyfa merged commit 811fe47 into main Jun 27, 2024
2 checks passed
@meyfa meyfa deleted the feat/vanilla-datapack branch June 27, 2024 20:54
meyfa added a commit that referenced this pull request Jun 27, 2024
Continuation of #195 to make use of the data that is now available
for chat and dimension types.

Note: For some reason, the chat type needs 1 added to it. This was
already the case when using the blob, however. It seems to have
changed between 1.20.6 and 1.21. Should keep an eye on this packet.
meyfa added a commit that referenced this pull request Jun 27, 2024
Continuation of #195 to make use of the data that is now available
for chat and dimension types.

Note: For some reason, the chat type needs 1 added to it. This was
already the case when using the blob, however. It seems to have
changed between 1.20.6 and 1.21. Should keep an eye on this packet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant