Class GeyserHolderSet<T>
java.lang.Object
org.geysermc.geyser.session.cache.tags.GeyserHolderSet<T>
Similar to vanilla Minecraft's HolderSets, stores either a tag or a list of IDs (this list can also be represented as a single ID in vanilla HolderSets).
Because HolderSets utilise tags, when loading a HolderSet, Geyser must store tags for the registry the HolderSet is for (see JavaRegistryKey).
Use the readHolderSet(org.geysermc.geyser.session.GeyserSession, org.geysermc.geyser.session.cache.registry.JavaRegistryKey<T>, java.lang.Object, java.util.function.ToIntFunction<net.kyori.adventure.key.Key>) method to easily read a HolderSet from NBT sent by a server. To turn the HolderSet into a list of network IDs, use the resolveRaw(org.geysermc.geyser.session.cache.TagCache) method.
To turn the HolderSet into a list of objects, use the resolve(org.geysermc.geyser.session.GeyserSession) method.
-
Constructor Summary
ConstructorsConstructorDescriptionGeyserHolderSet(JavaRegistryKey<T> registry, int @NonNull [] holders) GeyserHolderSet(JavaRegistryKey<T> registry, @NonNull Tag<T> tagId) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <T> GeyserHolderSet<T>fromHolderSet(JavaRegistryKey<T> registry, @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet) Constructs aGeyserHolderSetfrom a MCPL HolderSet.int @Nullable []getTag()inthashCode()static <T> GeyserHolderSet<T>readHolderSet(GeyserSession session, JavaRegistryKey<T> registry, @Nullable Object holderSet, ToIntFunction<net.kyori.adventure.key.Key> keyIdMapping) Reads a HolderSet from an object from NBT.resolve(GeyserSession session) Resolves the HolderSet, and automatically maps the network IDs to their respective object types.int[]resolveRaw(TagCache tagCache) Resolves the HolderSet.toString()
-
Constructor Details
-
GeyserHolderSet
-
GeyserHolderSet
-
-
Method Details
-
fromHolderSet
public static <T> GeyserHolderSet<T> fromHolderSet(JavaRegistryKey<T> registry, @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet) Constructs aGeyserHolderSetfrom a MCPL HolderSet. -
resolve
Resolves the HolderSet, and automatically maps the network IDs to their respective object types. If the HolderSet is a list of IDs, this will be returned. If it is a tag, the tag will be resolved from the tag cache.- Returns:
- the HolderSet turned into a list of objects.
-
resolveRaw
Resolves the HolderSet. If the HolderSet is a list of IDs, this will be returned. If it is a tag, the tag will be resolved from the tag cache.- Returns:
- the HolderSet turned into a list of objects.
-
readHolderSet
public static <T> GeyserHolderSet<T> readHolderSet(GeyserSession session, JavaRegistryKey<T> registry, @Nullable Object holderSet, ToIntFunction<net.kyori.adventure.key.Key> keyIdMapping) Reads a HolderSet from an object from NBT.- Parameters:
session- session, only used for logging purposes.registry- the registry the HolderSet contains IDs from.holderSet- the HolderSet as an object from NBT.keyIdMapping- a function that maps resource location IDs in the HolderSet's registry to their network IDs.
-
getRegistry
-
getTag
-
getHolders
public int @Nullable [] getHolders() -
equals
-
hashCode
public int hashCode() -
toString
-