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

Improve tag loading and load non-vanilla tags as well #4849

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

eclipseisoffline
Copy link
Contributor

This PR improves the way Geyser loads tags sent by the server, which allows both vanilla and non-vanilla tags to be loaded. It also makes it easier to add new registries to load tags for. Loading all tags for a registry, and not just vanilla ones, is important for datapack support and matches the behaviour of the Java client. Datapacks can define custom tags and then use these elsewhere, such as in custom enchantments.

The PR adds a new Tag interface, which has 2 implementations, VanillaTag and NonVanillaTag. TagCache now uses the Tag interface for tag lookup, while continuing support for fast lookup of vanilla tags. This is done by defining a set of vanilla tags that Geyser should always initialise, even when not sent by the server (in that case the tag will be an empty list). The recommended way to turn a Minecraft tag key into a Tag instance is to use Tag.createTag, which checks if the tag key is a vanilla one or not.

The registries tags are loaded for (at the moment minecraft:block, minecraft:item and minecraft:enchantment) are now defined in the TagRegistry enum. This also stores all the vanilla tags for the registry (vanilla tags for a registry can be registered using the registerVanillaTag method, which is used in the BlockTag, ItemTag and EnchantmentTag classes).

Along with the changes to tag loading, this PR also adds a new HolderSet class, which makes loading and using Minecraft's holder sets easier within Geyser, and has a better integration with Geyser's tag cache.

The PR has had basic testing. I've tested and verified various vanilla and non-vanilla tags work and load correctly, as well as some basic gameplay testing.

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.

None yet

3 participants