Class TagCache

java.lang.Object
org.geysermc.geyser.session.cache.TagCache

@ParametersAreNonnullByDefault public final class TagCache extends Object
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.
  • Constructor Details

  • Method Details

    • loadPacket

      public void loadPacket(GeyserSession session, org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket packet)
    • is

      public <T> boolean is(Tag<T> tag, T object)
    • is

      public boolean is(Tag<Item> tag, GeyserItemStack itemStack)
      Returns:
      true if the item tag is present and contains this item stack's Java ID.
    • is

      public <T> boolean is(@Nullable GeyserHolderSet<T> holderSet, @Nullable T object)
      Returns:
      true if the specified network ID is in the given holder set.
    • isItem

      public boolean isItem(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, @NonNull Item item)
    • isBlock

      public boolean isBlock(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, @NonNull Block block)
    • get

      public <T> List<T> get(Tag<T> tag)
    • getRaw

      public int[] getRaw(Tag<?> tag)
      Returns:
      the network IDs in the given tag. This can be an empty list.
    • 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.