Импорт класса

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
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

ZenScript
Copy
new 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
Параметр
stack
Тип
ItemStack

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

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>);
ПараметрТипОписание
Параметр
stack
Тип
IItemStack
Описание
The new IItemStack.

Name: setNeverPickUp

ZenScript
Copy
// ItemEntity.setNeverPickUp()

myItemEntity.setNeverPickUp();

Link to setNoPickUpDelay

Name: setNoPickUpDelay

ZenScript
Copy
// ItemEntity.setNoPickUpDelay()

myItemEntity.setNoPickUpDelay();

Name: setPickUpDelay

ZenScript
Copy
ItemEntity.setPickUpDelay(ticks as int)
ПараметрТип
Параметр
ticks
Тип
int

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
hasPickupDelay
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Название
item
Тип
IItemStack
Имеет Getter
true
Имеет Setter
true
Описание
Gets the IItemStack inside this ItemEntity.