Interface Taggable

All Superinterfaces:
TagReadable, TagWritable
All Known Subinterfaces:
CommandSender
All Known Implementing Classes:
AbstractInventory, AnvilInventory, BeaconInventory, BrewingStandInventory, Chunk, ConsoleSender, Damage, DynamicChunk, EnchantmentTableInventory, Entity, EntityCreature, EntityDamage, EntityProjectile, EntityProjectileDamage, ExperienceOrb, FurnaceInventory, Instance, InstanceContainer, Inventory, ItemEntity, LightingChunk, LivingEntity, Player, PlayerInventory, PositionalDamage, ServerSender, SharedInstance, VillagerInventory

public interface Taggable extends TagReadable, TagWritable
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> T
    getAndSetTag(Tag<T> tag, T value)
    Reads the current value, and then write the new one.
    default <T> @UnknownNullability T
    getAndUpdateTag(Tag<T> tag, UnaryOperator<@UnknownNullability T> value)
     
    default <T> @UnknownNullability T
    getTag(Tag<T> tag)
    Reads the specified tag.
    default boolean
    hasTag(Tag<?> tag)
    Returns if a tag is present.
    default void
    removeTag(Tag<?> tag)
     
    default <T> void
    setTag(Tag<T> tag, T value)
    Writes the specified type.
     
    default <T> @UnknownNullability T
    updateAndGetTag(Tag<T> tag, UnaryOperator<@UnknownNullability T> value)
     
    default <T> void
    updateTag(Tag<T> tag, UnaryOperator<@UnknownNullability T> value)
     
  • Method Details

    • tagHandler

      TagHandler tagHandler()
    • getTag

      default <T> @UnknownNullability T getTag(Tag<T> tag)
      Description copied from interface: TagReadable
      Reads the specified tag.
      Specified by:
      getTag in interface TagReadable
      Type Parameters:
      T - the tag type
      Parameters:
      tag - the tag to read
      Returns:
      the read tag, null if not present
    • hasTag

      default boolean hasTag(Tag<?> tag)
      Description copied from interface: TagReadable
      Returns if a tag is present.
      Specified by:
      hasTag in interface TagReadable
      Parameters:
      tag - the tag to check
      Returns:
      true if the tag is present, false otherwise
    • setTag

      default <T> void setTag(Tag<T> tag, @Nullable T value)
      Description copied from interface: TagWritable
      Writes the specified type.
      Specified by:
      setTag in interface TagWritable
      Type Parameters:
      T - the tag type
      Parameters:
      tag - the tag to write
      value - the tag value, null to remove
    • removeTag

      default void removeTag(Tag<?> tag)
      Specified by:
      removeTag in interface TagWritable
    • getAndSetTag

      @Nullable default <T> T getAndSetTag(Tag<T> tag, @Nullable T value)
      Description copied from interface: TagWritable
      Reads the current value, and then write the new one.
      Specified by:
      getAndSetTag in interface TagWritable
      Type Parameters:
      T - the tag type
      Parameters:
      tag - the tag to write
      value - the tag value, null to remove
      Returns:
      the previous tag value, null if not present
    • updateTag

      default <T> void updateTag(Tag<T> tag, UnaryOperator<@UnknownNullability T> value)
      Specified by:
      updateTag in interface TagWritable
    • updateAndGetTag

      default <T> @UnknownNullability T updateAndGetTag(Tag<T> tag, UnaryOperator<@UnknownNullability T> value)
      Specified by:
      updateAndGetTag in interface TagWritable
    • getAndUpdateTag

      default <T> @UnknownNullability T getAndUpdateTag(Tag<T> tag, UnaryOperator<@UnknownNullability T> value)
      Specified by:
      getAndUpdateTag in interface TagWritable