Interface NbtValued

All Known Subinterfaces:
BlockStateHolder<B>, TileEntityBlock
All Known Implementing Classes:
AbstractExtentFilterBlock, AbstractFilterBlock, AbstractSingleFilterBlock, ArrayFilterBlock, BaseBlock, BaseEntity, BaseItem, BaseItemStack, BlanketBaseBlock, BlockState, CharFilterBlock, ChunkFilterBlock, ExtentFilterBlock, FilterBlock, FuzzyBlockState, LazyBaseEntity, MobSpawnerBlock, SignBlock, SingleFilterBlock, 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 Summary

    Modifier and Type
    Method
    Description
    default com.sk89q.worldedit.util.nbt.CompoundBinaryTag
    Get the object's NBT data (tile entity data).
    default CompoundTag
    Deprecated.
    default LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag>
    Get the object's NBT data (tile entity data).
    default boolean
    Deprecated.
    default void
    setNbt(com.sk89q.worldedit.util.nbt.CompoundBinaryTag nbtData)
    Set the object's NBT data (tile entity data).
    default void
    default void
    setNbtReference(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> nbtData)
    Set the object's NBT data (tile entity data).
  • 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<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> 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().

      Returns:
      compound tag, or null
    • getNbt

      @Nullable default com.sk89q.worldedit.util.nbt.CompoundBinaryTag 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<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> nbtData)
      Set the object's NBT data (tile entity data).
      Parameters:
      nbtData - NBT data, or null if no data
    • setNbt

      default void setNbt(@Nullable com.sk89q.worldedit.util.nbt.CompoundBinaryTag nbtData)
      Set the object's NBT data (tile entity data).
      Parameters:
      nbtData - NBT data, or null if no data