search
Pages
-
chevron_rightGuides
-
chevron_rightCommands
-
chevron_rightDataDriven
-
chevron_rightAdvancements
-
chevron_rightWorldgen
-
chevron_rightConcepts
-
chevron_rightHelpers
-
chevron_rightOop
-
chevron_rightAdvanced
-
chevron_rightContributing
linkItems
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.
linkBasic usage
function("item_demo") {
val sword = itemStack(Items.DIAMOND_SWORD) {
enchantments {
sharpness(5)
unbreaking(3)
}
}
player.giveItem(sword)
sword.summon() // summon as item entity at 0 0 0
sword.summon(textComponent("My Sword", Color.GOLD)) // summon with custom name
}
Kotlin
linkPractical example
function("reward_drop") {
val reward = itemStack(Items.NETHERITE_INGOT) {
lore(textComponent("A rare reward dropped by the champion", Color.GRAY))
}
player.executeAt {
run {
reward.summon(textComponent("Champion Reward", Color.GOLD))
}
}
}
Kotlin
This pattern is useful when the same item should be given directly in one context and spawned as a visible reward in another.
linkSee 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.
Published03/03/2026Last updated31/03/2026
Edit this page on GitHub
