Home Migration Guide Getting Started With Scripts Commands Examples
BracketHandlers

MCItemEntity

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

Extending MCEntity

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

Constructors

script.zs
new MCItemEntity(world as MCWorld, x as double, y as double, z as double, stack as ItemStack) as MCItemEntity
ParameterTypeDescription
Parameter
world
Type
MCWorld
Description
No description provided
Parameter
x
Type
double
Description
No description provided
Parameter
y
Type
double
Description
No description provided
Parameter
z
Type
double
Description
No description provided
Parameter
stack
Type
ItemStack
Description
No description provided

Methods

Gets the IItemStack inside this ItemEntity.

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

script.zs
// MCItemEntity.getItem() as IItemStack
itemEntity.getItem();

Sets the IItemStack inside this ItemEntity.

Return Type: void

script.zs
// MCItemEntity.setItem(stack as IItemStack) as void
itemEntity.setItem(<item:minecraft:diamond>);
ParameterTypeDescription
Parameter
stack
Type
IItemStack
Description
The new IItemStack.

Properties

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