BetaBeta
Creates a new MachineItemStack.
The ID of the item type this stack holds.
The number of items in the stack. See MachineItemStack.amount.
Additional item properties. See NewMachineItemStackOptions.
Throws a PublicError of type PublicErrorType.InvalidArgument if amount is not a positive integer.
BetadamageBetaenchantmentsBetaloreOptional BetanameBetatypeThe ID of the item type this stack holds.
Beta
The number of items in this stack.
Always a positive integer, as it is for Minecraft's ItemStack.amount. An
empty machine item slot is represented by having no MachineItemStack at
all, not by one with an amount of zero.
This is not checked against the item's maximum stack size, so a stack you are holding may exceed it. Storing one that does in a machine item slot throws, since a slot can only show a single stack.
Throws a PublicError of type PublicErrorType.InvalidArgument if set to anything other than a positive integer.
Beta
Beta
Clones this object.
A new MachineItemStack with the same properties as this one.
Beta
Tests if all properties of two MachineItemStacks, except amount, are the same.
The other MachineItemStack to compare with.
Whether the two MachineItemStacks are similar.
Beta
Converts this MachineItemStack to a Minecraft ItemStack.
A Minecraft ItemStack with the same properties as this MachineItemStack.
An ItemStack cannot hold more than one stack of an item, so an
MachineItemStack.amount above the item's maximum stack size is
reduced to fit and a warning is logged.
Beta
Clones this object and sets the amount to the given value.
The new amount. See MachineItemStack.amount.
A new MachineItemStack with the same properties as this one, but with the given amount.
Throws a PublicError of type PublicErrorType.InvalidArgument if amount is not a positive integer. To empty a machine item slot, store no item in it rather than a stack of zero.
StaticfromBeta
Converts a Minecraft ItemStack to a MachineItemStack.
The Minecraft ItemStack to convert.
Represents an item stack that may be stored in a machine UI item slot.
Remarks
Carries an item's type, amount, name tag, damage, lore and enchantments, and nothing else. An item holding more than that does not survive a round trip through one: a shulker box with items in it becomes an empty shulker box.
Machine item slots store their contents this way, so restrict them with UiItemSlotElementDefinition.allowedItems, or use a persistent entity's container instead if a slot has to accept any item.