Items
The OOP module keeps item usage concise by letting you build an item stack once and then reuse it for giving, spawning, or embedding it in wider entity workflows.
Basic usage
summon() spawns the stack as a minecraft:item entity at the given position (defaulting to ~ ~ ~). The overload taking a ChatComponents or a String + Color sets the entity's visible custom name.
Configuring the spawned entity
summon takes a trailing ItemEntitySummonData block that controls the spawned entity's root NBT:
Generated output:
showcase = true is a shortcut for a static display item: it sets PickupDelay and Age so the entity never despawns and cannot be picked up, plus Invulnerable and NoGravity. Any of those set explicitly win over the shortcut, and the item's custom_name component is mirrored onto the entity so the name renders in the world.
Shared entity fields
These come from EntitySummonData and apply to every entity summoned through this API:
| Field | NBT tag |
|---|---|
air |
Air |
customName |
CustomName |
fallDistance |
FallDistance |
fire |
Fire |
glowing |
Glowing |
hasVisualFire |
HasVisualFire |
invulnerable |
Invulnerable |
motion / motion(dx, dy, dz) |
Motion |
noGravity |
NoGravity |
onGround |
OnGround |
portalCooldown |
PortalCooldown |
pos |
Pos |
rotation / rotation(yaw, pitch) |
Rotation |
silent |
Silent |
tags |
Tags |
motion(dx, dy, dz) and rotation(yaw, pitch) are helper functions so you do not have to build the underlying Triple or Vec2 yourself:
Item-only fields
ItemEntitySummonData adds the fields that only exist on minecraft:item:
| Field | NBT tag | Description |
|---|---|---|
age |
Age |
Ticks lived - negative values delay despawning |
displayName |
CustomName |
Name as ChatComponents, also settable via displayName(...) |
displayNameVisible |
CustomNameVisible |
Whether the name renders without looking at it |
health |
Health |
Item entity health |
owner |
Owner |
UUID allowed to pick the item up |
pickupDelay |
PickupDelay |
Ticks before pickup is allowed |
showcase |
- | Shortcut described above |
thrower |
Thrower |
UUID that threw the item |
For anything not covered, summon also accepts an extraEntityNbt builder applied last, so you can write arbitrary root tags (a fixed UUID, modded data, and so on).
Practical example
This pattern is useful when the same item should be given directly in one context and spawned as a visible reward in another.
See also
- Entities & Players - Give, replace, or spawn item stacks from entity-scoped helpers.
- Events - React to item use or consumption with event-driven logic.
- Components - Define richer custom names, lore, and metadata for the items you build.
