Skip to content

ItemQuantity

Package: com.hypixel.hytale.protocol

public class ItemQuantity

Pairs an item ID with a quantity count. Used in recipes, drops, and inventory operations.

TypeNameNullableDescription
StringitemIdYes
intquantityNo
ConstantValue
NULLABLE_BIT_FIELD_SIZE1
FIXED_BLOCK_SIZE5
VARIABLE_FIELD_COUNT1
VARIABLE_BLOCK_START5
MAX_SIZE16,384,010

Binary layout: 1 null-bit byte + 5 bytes of fixed fields + 1 variable-length field (4-byte offset slots). All multi-byte primitives use little-endian encoding.

@Nonnull
public static ItemQuantity deserialize(@Nonnull ByteBuf buf, int offset)

Deserializes a ItemQuantity from the given buffer at the specified offset.

public static int computeBytesConsumed(@Nonnull ByteBuf buf, int offset)

Returns the total number of bytes consumed by this ItemQuantity starting at the given offset.

public void serialize(@Nonnull ByteBuf buf)

Serializes this ItemQuantity into the given buffer.

public int computeSize()

Returns the serialized size in bytes.

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.