Interface NbtValued

All Known Subinterfaces:
TileEntityBlock
All Known Implementing Classes:
BaseBlock, BaseEntity, BaseItem, BaseItemStack, LegacyBaseBlockWrapper, MobSpawnerBlock, SignBlock, SkullBlock

public interface NbtValued
Indicates an object that contains extra data identified as an NBT structure. This interface is used when saving and loading objects to a serialized format, but may be used in other cases.
  • Method Details

    • hasNbtData

      @Deprecated default boolean hasNbtData()
      Deprecated.
      Returns whether the block contains NBT data. getNbtData() must not return null if this method returns true.
      Returns:
      true if there is NBT data
    • getNbtData

      @Deprecated @Nullable default CompoundTag getNbtData()
      Deprecated.
      Get the object's NBT data (tile entity data). The returned tag, if modified in any way, should be sent to setNbtData(CompoundTag) so that the instance knows of the changes. Making changes without calling setNbtData(CompoundTag) could have unintended consequences.

      hasNbtData() must return true if and only if method does not return null.

      Returns:
      compound tag, or null
    • setNbtData

      @Deprecated default void setNbtData(@Nullable CompoundTag nbtData)
      Set the object's NBT data (tile entity data).
      Parameters:
      nbtData - NBT data, or null if no data
    • getNbtReference

      @NonAbstractForCompatibility(delegateName="getNbtData", delegateParams={}) @Nullable default LazyReference<org.enginehub.linbus.tree.LinCompoundTag> getNbtReference()
      Get the object's NBT data (tile entity data).

      This only needs to be used if you don't want to immediately resolve the data. Otherwise, you probably want getNbt().

      Note: This method may be non-null while getNbt() returns null. Do NOT rely on this method to determine whether the object has NBT data.

      Returns:
      compound tag, or null
      API Note:
      This must be overridden by new subclasses. See NonAbstractForCompatibility for details
    • getNbt

      @Nullable default org.enginehub.linbus.tree.LinCompoundTag getNbt()
      Get the object's NBT data (tile entity data).
      Returns:
      compound tag, or null
    • setNbtReference

      @NonAbstractForCompatibility(delegateName="setNbtData", delegateParams=CompoundTag.class) default void setNbtReference(@Nullable LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData)
      Set the object's NBT data (tile entity data).
      Parameters:
      nbtData - NBT data, or null if no data
      API Note:
      This must be overridden by new subclasses. See NonAbstractForCompatibility for details
    • setNbt

      default void setNbt(@Nullable org.enginehub.linbus.tree.LinCompoundTag nbtData)
      Set the object's NBT data (tile entity data).
      Parameters:
      nbtData - NBT data, or null if no data