Class ClientTags
Tags are loaded by the server, either the internal server in singleplayer or the connected server and synced to the client. This can be a pain point for interoperability, as a tag that does not exist on the server because it is part of a mod only present on the client will no longer be available to the client that may wish to query it.
Client Tags resolve that issue by lazily reading the tag json files within the mods on the side of the caller,
directly, allowing for mods to query tags such as ConventionalBlockTags
even when connected to a vanilla server.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Set<Identifier>
getOrCreateLocalTag
(TagKey<?> tagKey) Loads a tag into the cache, recursively loading any contained tags along with it.static <T> boolean
isInLocal
(TagKey<T> tagKey, RegistryKey<T> registryKey) Checks if an entry is in a tag provided by the available mods.static <T> boolean
isInWithLocalFallback
(TagKey<T> tagKey, RegistryEntry<T> registryEntry) Checks if an entry is in a tag, for use with entries from a dynamic registry, such asBiome
s.static <T> boolean
isInWithLocalFallback
(TagKey<T> tagKey, T entry) Checks if an entry is in a tag.
-
Method Details
-
getOrCreateLocalTag
Loads a tag into the cache, recursively loading any contained tags along with it.- Parameters:
tagKey
- theTagKey
to load- Returns:
- a set of
Identifier
s this tag contains
-
isInWithLocalFallback
Checks if an entry is in a tag.If the synced tag does exist, it is queried. If it does not exist, the tag populated from the available mods is checked, recursively checking the synced tags and entries contained within.
- Parameters:
tagKey
- theTagKey
to being checkedentry
- the entry to check- Returns:
- if the entry is in the given tag
-
isInWithLocalFallback
Checks if an entry is in a tag, for use with entries from a dynamic registry, such asBiome
s.If the synced tag does exist, it is queried. If it does not exist, the tag populated from the available mods is checked, recursively checking the synced tags and entries contained within.
- Parameters:
tagKey
- theTagKey
to be checkedregistryEntry
- the entry to check- Returns:
- if the entry is in the given tag
-
isInLocal
Checks if an entry is in a tag provided by the available mods.- Parameters:
tagKey
- theTagKey
to being checkedregistryKey
- the entry to check- Returns:
- if the entry is in the given tag
-