Items
Overwiew
todo
Usage
You can create an ItemStack using one of the following methods to either create a stack of one or multiple items.
rs
// Create an ItemStack with x1 Stone
let stack = ItemStack::of(Material::Stone);
assert_eq!(stack.material(), Material::Stone);
assert_eq!(stack.amount(), 1);
// Crate an ItemStack with x32 Stone
let stack = ItemStack::new(Material::Stone, 32);
assert_eq!(stack.material(), Material::Stone);
assert_eq!(stack.amount(), 32);Item Components
rs
let stack = ItemStack::of(Material::Stone)
.with(DataComponent::MAX_STACK_SIZE, 16)
.with(DataComponent::UNBREAKABLE, ());
assert_eq!(stack.get(DataComponent::MAX_STACK_SIZE), Some(&16));
assert_eq!(stack.get(DataComponent::UNBREAKABLE), Some(&()));
assert_eq!(stack.get(DataComponent::DAMAGE), None);