Skip to content

Zig: Items and containers

Item

Zig
1
2
3
4
pub const Item = struct {
    item_snbt: []const u8,
    // ...
};

An item stack as SNBT, a value: reading it asks the host about that SNBT.

Item.of

Zig
pub fn of(item_snbt_value: []const u8) Item
  • Parameters:
    • item_snbt_value : []const u8
  • Return type: Item

Item.count

Zig
pub fn count(self: Item) core.Error!f64

PIER_IPROP_COUNT: ItemStackBase::mCount

Item.maxStackSize

Zig
pub fn maxStackSize(self: Item) core.Error!f64

PIER_IPROP_MAX_STACK_SIZE: ItemStackBase::getMaxStackSize

Item.auxValue

Zig
pub fn auxValue(self: Item) core.Error!f64

PIER_IPROP_AUX_VALUE: ItemStackBase::getAuxValue

Item.id

Zig
pub fn id(self: Item) core.Error!f64

PIER_IPROP_ID: ItemStackBase::getId

Item.damage

Zig
pub fn damage(self: Item) core.Error!f64

PIER_IPROP_DAMAGE: ItemStackBase::getDamageValue

Item.isNull

Zig
pub fn isNull(self: Item) core.Error!bool

PIER_IPROP_IS_NULL: ItemStackBase::isNull

Item.isBlock

Zig
pub fn isBlock(self: Item) core.Error!bool

PIER_IPROP_IS_BLOCK: ItemStackBase::isBlock

Item.isEnchanted

Zig
pub fn isEnchanted(self: Item) core.Error!bool

PIER_IPROP_IS_ENCHANTED: ItemStackBase::isEnchanted

Item.isArmor

Zig
pub fn isArmor(self: Item) core.Error!bool

PIER_IPROP_IS_ARMOR: ItemStackBase::isArmorItem

Item.isDamageable

Zig
pub fn isDamageable(self: Item) core.Error!bool

PIER_IPROP_IS_DAMAGEABLE: ItemStackBase::isDamageableItem

Item.isDamaged

Zig
pub fn isDamaged(self: Item) core.Error!bool

PIER_IPROP_IS_DAMAGED: ItemStackBase::isDamaged

Item.maxDamage

Zig
pub fn maxDamage(self: Item) core.Error!f64

PIER_IPROP_MAX_DAMAGE: ItemStackBase::getMaxDamage

Item.isUnbreakable

Zig
pub fn isUnbreakable(self: Item) core.Error!bool

PIER_IPROP_IS_UNBREAKABLE: ItemStackBase::isUnbreakable

Item.hasDurability

Zig
pub fn hasDurability(self: Item) core.Error!bool

PIER_IPROP_HAS_DURABILITY: ItemStackBase::hasDurability

Item.isPotion

Zig
pub fn isPotion(self: Item) core.Error!bool

PIER_IPROP_IS_POTION: ItemStackBase::isPotionItem

Item.isThrowable

Zig
pub fn isThrowable(self: Item) core.Error!bool

PIER_IPROP_IS_THROWABLE: ItemStackBase::isThrowable

Item.isFireResistant

Zig
pub fn isFireResistant(self: Item) core.Error!bool

PIER_IPROP_IS_FIRE_RESISTANT: ItemStackBase::isFireResistant

Item.attackDamage

Zig
pub fn attackDamage(self: Item) core.Error!f64

PIER_IPROP_ATTACK_DAMAGE: ItemStackBase::getAttackDamage

Item.repairCost

Zig
pub fn repairCost(self: Item) core.Error!f64

PIER_IPROP_REPAIR_COST: ItemStackBase::getBaseRepairCost

Item.enchantValue

Zig
pub fn enchantValue(self: Item) core.Error!f64

PIER_IPROP_ENCHANT_VALUE: ItemStackBase::getEnchantValue

Item.isStackable

Zig
pub fn isStackable(self: Item) core.Error!bool

PIER_IPROP_IS_STACKABLE: ItemStackBase::isStackable

Item.isMusicDisc

Zig
pub fn isMusicDisc(self: Item) core.Error!bool

PIER_IPROP_IS_MUSIC_DISC: ItemStackBase::isMusicDiscItem

Item.isOffhand

Zig
pub fn isOffhand(self: Item) core.Error!bool

PIER_IPROP_IS_OFFHAND: ItemStackBase::isOffhandItem

Item.useDuration

Zig
pub fn useDuration(self: Item) core.Error!f64

PIER_IPROP_USE_DURATION: ItemStackBase::getMaxUseDuration

Item.isGlint

Zig
pub fn isGlint(self: Item) core.Error!bool

PIER_IPROP_IS_GLINT: ItemStackBase::isGlint

Item.isBundle

Zig
pub fn isBundle(self: Item) core.Error!bool

PIER_IPROP_IS_BUNDLE: ItemStackBase::isBundle

Item.hasUserData

Zig
pub fn hasUserData(self: Item) core.Error!bool

PIER_IPROP_HAS_USER_DATA: ItemStackBase::hasUserData

Item.hasCustomName

Zig
pub fn hasCustomName(self: Item) core.Error!bool

PIER_IPROP_HAS_CUSTOM_NAME: ItemStackBase::hasCustomHoverName

Item.typeName

Zig
pub fn typeName(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_TYPE_NAME: ItemStackBase::getTypeName ("minecraft:apple")

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.name

Zig
pub fn name(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_NAME: ItemStackBase::getName (display)

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.customName

Zig
pub fn customName(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_CUSTOM_NAME: ItemStackBase::getCustomName

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.rawNameId

Zig
pub fn rawNameId(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_RAW_NAME_ID: ItemStackBase::getRawNameId

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.lore

Zig
pub fn lore(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_LORE: SNBT list ["l1","l2"] ItemStackBase::getCustomLore

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.canDestroy

Zig
pub fn canDestroy(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_CAN_DESTROY: SNBT list ["minecraft:stone",…]

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.canPlaceOn

Zig
pub fn canPlaceOn(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_CAN_PLACE_ON: SNBT list

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.userData

Zig
pub fn userData(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_USER_DATA: full NBT user data as SNBT

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.hoverName

Zig
pub fn hoverName(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_HOVER_NAME: ItemStackBase::getHoverName

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.effectName

Zig
pub fn effectName(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_EFFECT_NAME: ItemStackBase::getEffectName

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str

Item.color

Zig
pub fn color(self: Item, allocator: std.mem.Allocator) core.Error![]u8

PIER_ISTR_COLOR: SNBT {r,g,b} ItemStackBase::getColor

  • Parameters:
    • allocator : std.mem.Allocator
  • Return type: core.Error![]u8
  • Slots: item_get_str