ItemEntity¶
Inherits from: Entity
Represents a physical item entity in the world, which can be picked up by players or other entities. It includes information about the dropped item, its age, and its original owner.
Fields¶
owner: Entity — Read-Only¶
A reference to the entity that spawned or owns this item entity.
itemAge: number — Read-Only¶
The number of game ticks since this item entity was created in the world.
item: Item — Read/Write¶
A copy of the item represented by this item entity.
Methods¶
new(item: Item, nbt: table|nil) → itemEntity: ItemEntity¶
Creates a new ItemEntity from a copy of the given item at the spell's current position.
The original item is not modified. If nbt is provided, its keys are merged into the
item entity's NBT representation.
Example
local stick = ItemEntity:new(Item:new("stick"))
stick.pos = spell.owner.pos + spell.owner.lookVec * 5
Example: With custom NBT
Parameters
| Name | Type | Description |
|---|---|---|
item |
Item |
The item that this item entity should represent. |
nbt |
table|nil |
Optional NBT data to merge into the item entity's representation. |
Returns
ItemEntity— itemEntity A new instance representing the dropped item.