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

function("item_demo") {
	val sword = itemStack("diamond_sword")
	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

Practical example

function("reward_drop") {
	val reward = itemStack("diamond_sword")

	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.

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.