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.MCItemEntity;

Extending MCEntity

Link to extending-mcentity

MCItemEntity extends MCEntity. That means all methods available in MCEntity are also available in MCItemEntity

Constructor #构造函数

Link to constructor-构造函数

ZenScript
Copy
new MCItemEntity(world as MCWorld, x as double, y as double, z as double, stack as ItemStack) as MCItemEntity
参数类型描述
参数
world
类型
MCWorld
描述
No description provided
参数
x
类型
double
描述
No description provided
参数
y
类型
double
描述
No description provided
参数
z
类型
double
描述
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
// MCItemEntity.getItem() as IItemStack

itemEntity.getItem();

Name: setItem

Sets the IItemStack inside this ItemEntity.

Return Type: void

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

itemEntity.setItem(<item:minecraft:diamond>);
参数类型描述
参数
堆叠
类型
IItemstack
描述
The new IItemStack.
名称类型可获得可设置描述
名称
item
类型
IItemstack
可获得
true
可设置
true
描述
Gets the IItemStack inside this ItemEntity.