ItemStack
Some of one item: what it is and how many.
An item's type is an ItemType, found by name (ItemType.named("Iron Ingot")). A capture cube holding a Voxelmon is an item too, and its stack names the creature inside.
Plain data, copied between the server and the plugin. Made by the plugin, or read from bags, containers and events.
Fields
| Field | Description |
|---|---|
item: ItemTypeItemType item() | What it is. |
count: i64long count() | How many, from 1 to its stack limit. |
creature: Option<CreatureId>Optional<Long> creature() | The Voxelmon in a capture cube, if it holds one. |
ItemType
A kind of item: every block, tool, food, material, piece of gear, cube and station, and a content pack's own items (their numbers last the session; the world keeps them by key).
A handle to something in the game. Once that thing is gone, its calls fail with Gone.
| Method | Description |
|---|---|
fn id(&self) -> Result<i64>long id() | Its lasting number (a content pack's item: its number this session, 32768 and up). |
fn name(&self) -> Result<String>String name() | Its name as players see it, such as IRON INGOT. |
fn stack_limit(&self) -> Result<i64>long stackLimit() | How many fit in one slot. |
fn kind(&self) -> Result<ItemKind>ItemKind kind() | What sort of item it is. |
fn value(&self) -> Result<i64>long value() | What it is worth in coins in shops. |
fn block(&self) -> Result<Option<BlockType>>Optional<BlockType> block() | The block it places, if any. |
fn key(&self) -> Result<Option<String>>Optional<String> key() | A content pack's item's key (pack:name); none for the game's own. |
fn named(name: &str) -> Result<Option<ItemType>>static Optional<ItemType> named(String name) | An item by its name (any case), or a content pack's item by its key (pack:name). |
fn by_id(id: i64) -> Result<Option<ItemType>>static Optional<ItemType> byId(long id) | An item by its number. |
fn all() -> Result<Vec<ItemType>>static List<ItemType> all() | Every item players can have, the content packs' own after the game's. |
ItemKind
What sort of item it is.
One of a fixed set of values.
| Value | Meaning |
|---|---|
ItemKind::BlockItemKind.BLOCK | Places a block. |
ItemKind::ToolItemKind.TOOL | An axe, pickaxe, shovel, hoe, hammer, rod or the like. |
ItemKind::WeaponItemKind.WEAPON | A sword, club, bow or trident. |
ItemKind::ShieldItemKind.SHIELD | A shield. |
ItemKind::ArmourItemKind.ARMOUR | Worn gear. |
ItemKind::FoodItemKind.FOOD | Eaten or drunk. |
ItemKind::CubeItemKind.CUBE | A capture cube. |
ItemKind::ObjectItemKind.OBJECT | Furniture or a station, placed in the world. |
ItemKind::MaterialItemKind.MATERIAL | Anything else: ores, bars, sticks, cloth. |