ItemEntity
Link to itementity
导入类
Link to 导入类
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 Copyimport 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 Copynew ItemEntity(level as Level, x as double, y as double, z as double, stack as ItemStack) as ItemEntity
参数 | 类型 |
---|---|
参数 level | 类型 Level |
参数 x | 类型 double |
参数 y | 类型 double |
参数 z | 类型 double |
参数 堆叠 | 类型 物品应用 |
使用方式
Link to 使用方式
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();
Name: setDefaultPickUpDelay
ZenScript Copy// ItemEntity.setDefaultPickUpDelay()
myItemEntity.setDefaultPickUpDelay();
Name: setItem
Sets the IItemStack inside this ItemEntity.
ZenScript Copy// ItemEntity.setItem(stack as IItemStack)
myItemEntity.setItem(<item:minecraft:diamond>);
参数 | 类型 | 描述 |
---|---|---|
参数 堆叠 | 类型 IItemstack | 描述 The new IItemStack. |
Name: setNeverPickUp
ZenScript Copy// ItemEntity.setNeverPickUp()
myItemEntity.setNeverPickUp();
Name: setNoPickUpDelay
ZenScript Copy// ItemEntity.setNoPickUpDelay()
myItemEntity.setNoPickUpDelay();
Name: setPickUpDelay
ZenScript CopyItemEntity.setPickUpDelay(ticks as int)
参数 | 类型 |
---|---|
参数 ticks | 类型 int |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 hasPickupDelay | 类型 布尔值 | 可获得 true | 可设置 false | 描述 |
名称 item | 类型 IItemstack | 可获得 true | 可设置 true | 描述 Gets the IItemStack inside this ItemEntity. |