Class BaseItem

java.lang.Object
com.sk89q.worldedit.blocks.BaseItem
All Implemented Interfaces:
NbtValued
Direct Known Subclasses:
BaseItemStack

public class BaseItem extends Object implements NbtValued
Represents an item, without an amount value. See BaseItemStack for an instance with stack amount information.

This class may be removed in the future.

  • Constructor Details

    • BaseItem

      public BaseItem(ItemType itemType)
      Construct the object.
      Parameters:
      itemType - Type of the item
    • BaseItem

      public BaseItem(ItemType itemType, @Nullable CompoundTag tag)
      Construct the object.
      Parameters:
      itemType - Type of the item
      tag - NBT Compound tag
  • Method Details

    • getType

      public ItemType getType()
      Get the type of item.
      Returns:
      the type
    • setType

      public void setType(ItemType itemType)
      Set the type of the item.
      Parameters:
      itemType - The type to set
    • hasNbtData

      public boolean hasNbtData()
      Description copied from interface: NbtValued
      Returns whether the block contains NBT data. NbtValued.getNbtData() must not return null if this method returns true.
      Specified by:
      hasNbtData in interface NbtValued
      Returns:
      true if there is NBT data
    • getNbtData

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

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

      Specified by:
      getNbtData in interface NbtValued
      Returns:
      compound tag, or null
    • setNbtData

      public void setNbtData(@Nullable CompoundTag nbtData)
      Description copied from interface: NbtValued
      Set the object's NBT data (tile entity data).
      Specified by:
      setNbtData in interface NbtValued
      Parameters:
      nbtData - NBT data, or null if no data