Package com.sk89q.worldedit.blocks
Class BaseItem
java.lang.Object
com.sk89q.worldedit.blocks.BaseItem
- All Implemented Interfaces:
NbtValued
- Direct Known Subclasses:
BaseItemStack
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 Summary
ConstructorDescriptionConstruct the object.BaseItem
(ItemType itemType, CompoundTag tag) Construct the object. -
Method Summary
Modifier and TypeMethodDescriptionGet the object's NBT data (tile entity data).getType()
Get the type of item.boolean
Returns whether the block contains NBT data.void
setNbtData
(CompoundTag nbtData) Set the object's NBT data (tile entity data).void
Set the type of the item.
-
Constructor Details
-
BaseItem
Construct the object.- Parameters:
itemType
- Type of the item
-
BaseItem
Construct the object.- Parameters:
itemType
- Type of the itemtag
- NBT Compound tag
-
-
Method Details
-
getType
Get the type of item.- Returns:
- the type
-
setType
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 interfaceNbtValued
- Returns:
- true if there is NBT data
-
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 toNbtValued.setNbtData(CompoundTag)
so that the instance knows of the changes. Making changes without callingNbtValued.setNbtData(CompoundTag)
could have unintended consequences.NbtValued.hasNbtData()
must return true if and only if method does not return null.- Specified by:
getNbtData
in interfaceNbtValued
- Returns:
- compound tag, or null
-
setNbtData
Description copied from interface:NbtValued
Set the object's NBT data (tile entity data).- Specified by:
setNbtData
in interfaceNbtValued
- Parameters:
nbtData
- NBT data, or null if no data
-