public class BaseItem extends java.lang.Object implements NbtValued
BaseItemStack
for an instance with stack amount information.
This class may be removed in the future.
Constructor and Description |
---|
BaseItem(ItemType itemType)
Construct the object.
|
BaseItem(ItemType itemType,
CompoundTag tag)
Construct the object.
|
Modifier and Type | Method and Description |
---|---|
CompoundTag |
getNbtData()
Get the object's NBT data (tile entity data).
|
ItemType |
getType()
Get the type of item.
|
boolean |
hasNbtData()
Returns whether the block contains NBT data.
|
void |
setNbtData(CompoundTag nbtData)
Set the object's NBT data (tile entity data).
|
void |
setType(ItemType itemType)
Set the type of the item.
|
public BaseItem(ItemType itemType)
itemType
- Type of the itempublic BaseItem(ItemType itemType, @Nullable CompoundTag tag)
itemType
- Type of the itemtag
- NBT Compound tagpublic ItemType getType()
public void setType(ItemType itemType)
itemType
- The type to setpublic boolean hasNbtData()
NbtValued
NbtValued.getNbtData()
must not return null if this method returns true.hasNbtData
in interface NbtValued
@Nullable public CompoundTag getNbtData()
NbtValued
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.
getNbtData
in interface NbtValued
public void setNbtData(@Nullable CompoundTag nbtData)
NbtValued
setNbtData
in interface NbtValued
nbtData
- NBT data, or null if no data