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.

ZenScript
Copy
import crafttweaker.api.entity.type.item.ItemEntity;

Extending Entity

Link to extending-entity

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

Constructor #构造函数

Link to constructor-构造函数

ZenScript
Copy
new ItemEntity(level as invalid, x as double, y as double, z as double, stack as ItemStack) as ItemEntity
参数类型描述
参数
level
类型
invalid
描述
No description provided
参数
x
类型
双精度
描述
No description provided
参数
y
类型
双精度
描述
No description provided
参数
z
类型
双精度
描述
No description provided
参数
堆叠
类型
物品应用
描述
No description provided

Name: getItem

Gets the IItemStack inside this ItemEntity.

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

ZenScript
Copy
// ItemEntity.getItem() as IItemStack

myItemEntity.getItem();

Name: hasPickUpDelay

Return Type: boolean

ZenScript
Copy
// ItemEntity.hasPickUpDelay() as boolean

myItemEntity.hasPickUpDelay();

Link to setDefaultPickUpDelay

Name: setDefaultPickUpDelay

Return Type: void

ZenScript
Copy
// ItemEntity.setDefaultPickUpDelay() as void

myItemEntity.setDefaultPickUpDelay();

Name: setItem

Sets the IItemStack inside this ItemEntity.

Return Type: void

ZenScript
Copy
// ItemEntity.setItem(stack as IItemStack) as void

myItemEntity.setItem(<item:minecraft:diamond>);
参数类型描述
参数
堆叠
类型
IItemStack
描述
The new IItemStack.

Name: setNeverPickUp

Return Type: void

ZenScript
Copy
// ItemEntity.setNeverPickUp() as void

myItemEntity.setNeverPickUp();

Link to setNoPickUpDelay

Name: setNoPickUpDelay

Return Type: void

ZenScript
Copy
// ItemEntity.setNoPickUpDelay() as void

myItemEntity.setNoPickUpDelay();

Name: setPickUpDelay

Return Type: void

ZenScript
Copy
ItemEntity.setPickUpDelay(ticks as int) as void
参数类型描述
参数
ticks
类型
int
描述
No Description Provided
名称类型可获得可设置描述
名称
hasPickupDelay
类型
布尔值
可获得
true
可设置
false
描述
No Description Provided
名称
item
类型
IItemStack
可获得
true
可设置
true
描述
Gets the IItemStack inside this ItemEntity.