-
-
Notifications
You must be signed in to change notification settings - Fork 674
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
eclipseisoffline
wants to merge
14
commits into
GeyserMC:master
Choose a base branch
from
eclipseisoffline:improvedtags
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Camotoy
reviewed
Jul 16, 2024
core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java
Outdated
Show resolved
Hide resolved
Camotoy
reviewed
Jul 16, 2024
core/src/main/java/org/geysermc/geyser/session/cache/tags/TagRegistry.java
Outdated
Show resolved
Hide resolved
…y#getVanillaTags return original map
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andNonVanillaTag
.TagCache
now uses theTag
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 aTag
instance is to useTag.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
andminecraft:enchantment
) are now defined in theTagRegistry
enum. This also stores all the vanilla tags for the registry (vanilla tags for a registry can be registered using theregisterVanillaTag
method, which is used in theBlockTag
,ItemTag
andEnchantmentTag
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.