Home Commands Examples Getting Started With Scripts Global Keywords

ItemEntity

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import crafttweaker.api.entity.type.item.ItemEntity;

Extending Entity

ItemEntity extends Entity. That means all methods available in Entity are also available in ItemEntity

Constructors

script.zs
new ItemEntity(level as Level, x as double, y as double, z as double, stack as ItemStack) as ItemEntity
ParameterType
Parameter
level
Type
Level
Parameter
x
Type
double
Parameter
y
Type
double
Parameter
z
Type
double
Parameter
stack
Type
ItemStack

Methods

Gets the IItemStack inside this ItemEntity.

Returns: The IItemStack inside this ItemEntity.
Return Type: IItemStack

script.zs
// ItemEntity.getItem() as IItemStack
myItemEntity.getItem();

Return Type: boolean

script.zs
// ItemEntity.hasPickUpDelay() as boolean
myItemEntity.hasPickUpDelay();
script.zs
// ItemEntity.setDefaultPickUpDelay()
myItemEntity.setDefaultPickUpDelay();

Sets the IItemStack inside this ItemEntity.

script.zs
// ItemEntity.setItem(stack as IItemStack)
myItemEntity.setItem(<item:minecraft:diamond>);
ParameterTypeDescription
Parameter
stack
Type
IItemStack
Description
The new IItemStack.
script.zs
// ItemEntity.setNeverPickUp()
myItemEntity.setNeverPickUp();
script.zs
// ItemEntity.setNoPickUpDelay()
myItemEntity.setNoPickUpDelay();
script.zs
ItemEntity.setPickUpDelay(ticks as int)
ParameterType
Parameter
ticks
Type
int

Properties

NameTypeHas GetterHas SetterDescription
Name
hasPickupDelay
Type
boolean
Has Getter
true
Has Setter
false
Description
Name
item
Type
IItemStack
Has Getter
true
Has Setter
true
Description
Gets the IItemStack inside this ItemEntity.