Class BlockTagManager

java.lang.Object
com.zetaplugins.lifestealz.util.customblocks.BlockTagManager

public final class BlockTagManager extends Object
  • Method Details

    • tagBlock

      public static <P, C> void tagBlock(Block block, NamespacedKey key, PersistentDataType<P,C> type, C value)
      Tags a block with a persistent data value. [!!!] This method only works for blocks that have a TileState (like chests, furnaces, etc.).
      Type Parameters:
      P - the type of the persistent data value
      C - the type of the value to set
      Parameters:
      block - the block to tag
      key - the NamespacedKey to use for the tag
      type - the PersistentDataType to use for the tag
      value - the value to set for the tag
    • getBlockTag

      public static <P, C> C getBlockTag(Block block, NamespacedKey key, PersistentDataType<P,C> type)
      Gets a persistent data value from a block. [!!!] This method only works for blocks that have a TileState (like chests, furnaces, etc.).
      Type Parameters:
      P - the type of the persistent data value
      C - the type of the value to get
      Parameters:
      block - the block to get the tag from
      key - the NamespacedKey to use for the tag
      type - the PersistentDataType to use for the tag
      Returns:
      the value of the tag, or null if not found