Class TagCache
java.lang.Object
org.geysermc.geyser.session.cache.TagCache
Manages information sent from the
ClientboundUpdateTagsPacket. If that packet is not sent, all lists here
will remain empty, matching Java Edition behavior. Looking up a tag that wasn't listed in that packet will return an empty array.
Only tags from registries in JavaRegistries are stored. Read JavaRegistryKey for more information.
To simply check if an element is in a tag, it's preferred to use the element's "is" method, if available. For example:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> List<T>int[]<T> booleanis(@NonNull GeyserHolderSet<T> holderSet, @Nullable T object) Prefer usingGeyserHolderSet.contains(GeyserSession, Object).booleanShould only be used when the network ID of an element is already known.<T> boolean<T> booleanis(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, @NonNull JavaRegistryKey<T> registry, int id) voidloadPacket(org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket packet) static <T> List<T>mapRawArray(GeyserSession session, int[] array, JavaRegistryKey<T> registry) Maps a raw array of network IDs to their respective objects.
-
Constructor Details
-
TagCache
-
-
Method Details
-
loadPacket
public void loadPacket(org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket packet) -
is
Should only be used when the network ID of an element is already known. If not, prefer using theis(Tag, Object)shorthand method. -
is
-
is
Prefer usingGeyserHolderSet.contains(GeyserSession, Object).- Returns:
- true if the specified network ID is in the given
GeyserHolderSet.
-
is
public <T> boolean is(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, @NonNull JavaRegistryKey<T> registry, int id) - Returns:
- true if the specified network ID is in the given
HolderSetset.
-
get
-
getRaw
- Returns:
- the network IDs in the given tag. This can be an empty array.
-
mapRawArray
public static <T> List<T> mapRawArray(GeyserSession session, int[] array, JavaRegistryKey<T> registry) Maps a raw array of network IDs to their respective objects.
-