Go: Items and containers¶
Functions¶
ContainerItems¶
| Go | |
|---|---|
ContainerItems lists the occupied slots of a container. Server thread only.
- Parameters:
- ref :
ContainerRef
- ref :
- Return type:
([]SlotItem, error) - Slots:
container_get_items
ItemOf¶
| Go | |
|---|---|
ItemOf is the item stack these SNBT describe.
- Parameters:
- snbt :
string
- snbt :
- Return type:
Item
Item¶
Item is an item stack as SNBT, a value: reading it asks the host about that SNBT, and changing it produces a new Item.
Item.Payload¶
| Go | |
|---|---|
Payload is the item's SNBT parsed.
- Return type:
(*Nbt, error)
Item.Enchants¶
| Go | |
|---|---|
Enchants lists the item's enchantments as SNBT.
- Return type:
(string, error) - Slots:
item_get_enchants
Item.Matches¶
| Go | |
|---|---|
Matches reports whether two items stack: the same item, data and user data.
- Parameters:
- other :
Item
- other :
- Return type:
(bool, error) - Slots:
item_matches
Item.Transform¶
| Go | |
|---|---|
Transform applies one of the PIER_IOP_* operations of abi.h and returns the new item.
- Parameters:
- op :
int32 - sarg :
string - narg :
float64
- op :
- Return type:
(Item, error) - Slots:
item_transform
Item.Count¶
| Go | |
|---|---|
Count reads PIER_IPROP_COUNT: ItemStackBase::mCount
- Return type:
(float64, error) - Slots:
item_get_num
Item.MaxStackSize¶
| Go | |
|---|---|
MaxStackSize reads PIER_IPROP_MAX_STACK_SIZE: ItemStackBase::getMaxStackSize
- Return type:
(float64, error) - Slots:
item_get_num
Item.AuxValue¶
| Go | |
|---|---|
AuxValue reads PIER_IPROP_AUX_VALUE: ItemStackBase::getAuxValue
- Return type:
(float64, error) - Slots:
item_get_num
Item.Id¶
| Go | |
|---|---|
Id reads PIER_IPROP_ID: ItemStackBase::getId
- Return type:
(float64, error) - Slots:
item_get_num
Item.Damage¶
| Go | |
|---|---|
Damage reads PIER_IPROP_DAMAGE: ItemStackBase::getDamageValue
- Return type:
(float64, error) - Slots:
item_get_num
Item.IsNull¶
| Go | |
|---|---|
IsNull reads PIER_IPROP_IS_NULL: ItemStackBase::isNull
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsBlock¶
| Go | |
|---|---|
IsBlock reads PIER_IPROP_IS_BLOCK: ItemStackBase::isBlock
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsEnchanted¶
| Go | |
|---|---|
IsEnchanted reads PIER_IPROP_IS_ENCHANTED: ItemStackBase::isEnchanted
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsArmor¶
| Go | |
|---|---|
IsArmor reads PIER_IPROP_IS_ARMOR: ItemStackBase::isArmorItem
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsDamageable¶
| Go | |
|---|---|
IsDamageable reads PIER_IPROP_IS_DAMAGEABLE: ItemStackBase::isDamageableItem
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsDamaged¶
| Go | |
|---|---|
IsDamaged reads PIER_IPROP_IS_DAMAGED: ItemStackBase::isDamaged
- Return type:
(bool, error) - Slots:
item_get_num
Item.MaxDamage¶
| Go | |
|---|---|
MaxDamage reads PIER_IPROP_MAX_DAMAGE: ItemStackBase::getMaxDamage
- Return type:
(float64, error) - Slots:
item_get_num
Item.IsUnbreakable¶
| Go | |
|---|---|
IsUnbreakable reads PIER_IPROP_IS_UNBREAKABLE: ItemStackBase::isUnbreakable
- Return type:
(bool, error) - Slots:
item_get_num
Item.HasDurability¶
| Go | |
|---|---|
HasDurability reads PIER_IPROP_HAS_DURABILITY: ItemStackBase::hasDurability
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsPotion¶
| Go | |
|---|---|
IsPotion reads PIER_IPROP_IS_POTION: ItemStackBase::isPotionItem
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsThrowable¶
| Go | |
|---|---|
IsThrowable reads PIER_IPROP_IS_THROWABLE: ItemStackBase::isThrowable
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsFireResistant¶
| Go | |
|---|---|
IsFireResistant reads PIER_IPROP_IS_FIRE_RESISTANT: ItemStackBase::isFireResistant
- Return type:
(bool, error) - Slots:
item_get_num
Item.AttackDamage¶
| Go | |
|---|---|
AttackDamage reads PIER_IPROP_ATTACK_DAMAGE: ItemStackBase::getAttackDamage
- Return type:
(float64, error) - Slots:
item_get_num
Item.RepairCost¶
| Go | |
|---|---|
RepairCost reads PIER_IPROP_REPAIR_COST: ItemStackBase::getBaseRepairCost
- Return type:
(float64, error) - Slots:
item_get_num
Item.EnchantValue¶
| Go | |
|---|---|
EnchantValue reads PIER_IPROP_ENCHANT_VALUE: ItemStackBase::getEnchantValue
- Return type:
(float64, error) - Slots:
item_get_num
Item.IsStackable¶
| Go | |
|---|---|
IsStackable reads PIER_IPROP_IS_STACKABLE: ItemStackBase::isStackable
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsMusicDisc¶
| Go | |
|---|---|
IsMusicDisc reads PIER_IPROP_IS_MUSIC_DISC: ItemStackBase::isMusicDiscItem
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsOffhand¶
| Go | |
|---|---|
IsOffhand reads PIER_IPROP_IS_OFFHAND: ItemStackBase::isOffhandItem
- Return type:
(bool, error) - Slots:
item_get_num
Item.UseDuration¶
| Go | |
|---|---|
UseDuration reads PIER_IPROP_USE_DURATION: ItemStackBase::getMaxUseDuration
- Return type:
(float64, error) - Slots:
item_get_num
Item.IsGlint¶
| Go | |
|---|---|
IsGlint reads PIER_IPROP_IS_GLINT: ItemStackBase::isGlint
- Return type:
(bool, error) - Slots:
item_get_num
Item.IsBundle¶
| Go | |
|---|---|
IsBundle reads PIER_IPROP_IS_BUNDLE: ItemStackBase::isBundle
- Return type:
(bool, error) - Slots:
item_get_num
Item.HasUserData¶
| Go | |
|---|---|
HasUserData reads PIER_IPROP_HAS_USER_DATA: ItemStackBase::hasUserData
- Return type:
(bool, error) - Slots:
item_get_num
Item.HasCustomName¶
| Go | |
|---|---|
HasCustomName reads PIER_IPROP_HAS_CUSTOM_NAME: ItemStackBase::hasCustomHoverName
- Return type:
(bool, error) - Slots:
item_get_num
Item.TypeName¶
| Go | |
|---|---|
TypeName reads PIER_ISTR_TYPE_NAME: ItemStackBase::getTypeName ("minecraft:apple")
- Return type:
(string, error) - Slots:
item_get_str
Item.Name¶
| Go | |
|---|---|
Name reads PIER_ISTR_NAME: ItemStackBase::getName (display)
- Return type:
(string, error) - Slots:
item_get_str
Item.CustomName¶
| Go | |
|---|---|
CustomName reads PIER_ISTR_CUSTOM_NAME: ItemStackBase::getCustomName
- Return type:
(string, error) - Slots:
item_get_str
Item.RawNameId¶
| Go | |
|---|---|
RawNameId reads PIER_ISTR_RAW_NAME_ID: ItemStackBase::getRawNameId
- Return type:
(string, error) - Slots:
item_get_str
Item.Lore¶
| Go | |
|---|---|
Lore reads PIER_ISTR_LORE: SNBT list ["l1","l2"] ItemStackBase::getCustomLore
- Return type:
(string, error) - Slots:
item_get_str
Item.CanDestroy¶
| Go | |
|---|---|
CanDestroy reads PIER_ISTR_CAN_DESTROY: SNBT list ["minecraft:stone",β¦]
- Return type:
(string, error) - Slots:
item_get_str
Item.CanPlaceOn¶
| Go | |
|---|---|
CanPlaceOn reads PIER_ISTR_CAN_PLACE_ON: SNBT list
- Return type:
(string, error) - Slots:
item_get_str
Item.UserData¶
| Go | |
|---|---|
UserData reads PIER_ISTR_USER_DATA: full NBT user data as SNBT
- Return type:
(string, error) - Slots:
item_get_str
Item.HoverName¶
| Go | |
|---|---|
HoverName reads PIER_ISTR_HOVER_NAME: ItemStackBase::getHoverName
- Return type:
(string, error) - Slots:
item_get_str
Item.EffectName¶
| Go | |
|---|---|
EffectName reads PIER_ISTR_EFFECT_NAME: ItemStackBase::getEffectName
- Return type:
(string, error) - Slots:
item_get_str
Item.Color¶
| Go | |
|---|---|
Color reads PIER_ISTR_COLOR: SNBT {r,g,b} ItemStackBase::getColor
- Return type:
(string, error) - Slots:
item_get_str
Container¶
Container is a player's or a block's container.
Container.Size¶
| Go | |
|---|---|
Size is the number of slots.
- Return type:
(int32, error) - Slots:
container_size
Container.Item¶
| Go | |
|---|---|
Item is the item in one slot.
- Parameters:
- slot :
int32
- slot :
- Return type:
(Item, error) - Slots:
container_get_item
Container.SetItem¶
| Go | |
|---|---|
SetItem puts an item into one slot.
- Parameters:
- slot :
int32 - item :
Item
- slot :
- Return type:
error - Slots:
container_set_item
Container.AddItem¶
| Go | |
|---|---|
AddItem adds an item where it fits.
- Parameters:
- item :
Item
- item :
- Return type:
error - Slots:
container_add_item
Container.RemoveItem¶
| Go | |
|---|---|
RemoveItem removes count items from one slot.
- Parameters:
- slot :
int32 - count :
int32
- slot :
- Return type:
error - Slots:
container_remove_item
Container.Clear¶
| Go | |
|---|---|
Clear empties the container.
- Return type:
error - Slots:
container_clear
Container.Items¶
| Go | |
|---|---|
Items lists the occupied slots.
- Return type:
([]SlotItem, error) - Slots:
container_get_items
SlotItem¶
SlotItem is one occupied slot of a container and its item as SNBT.
ContainerRef¶
ContainerRef names a container: a player's inventory, ender chest, armor or offhand, or the container of a block.
IProp*¶
| Name | Value | Description |
|---|---|---|
IPropCount |
0 |
IPropCount is PIER_IPROP_COUNT: ItemStackBase::mCount |
IPropMaxStackSize |
1 |
IPropMaxStackSize is PIER_IPROP_MAX_STACK_SIZE: ItemStackBase::getMaxStackSize |
IPropAuxValue |
2 |
IPropAuxValue is PIER_IPROP_AUX_VALUE: ItemStackBase::getAuxValue |
IPropId |
3 |
IPropId is PIER_IPROP_ID: ItemStackBase::getId |
IPropDamage |
4 |
IPropDamage is PIER_IPROP_DAMAGE: ItemStackBase::getDamageValue |
IPropIsNull |
5 |
IPropIsNull is PIER_IPROP_IS_NULL: ItemStackBase::isNull |
IPropIsBlock |
6 |
IPropIsBlock is PIER_IPROP_IS_BLOCK: ItemStackBase::isBlock |
IPropIsEnchanted |
7 |
IPropIsEnchanted is PIER_IPROP_IS_ENCHANTED: ItemStackBase::isEnchanted |
IPropIsArmor |
8 |
IPropIsArmor is PIER_IPROP_IS_ARMOR: ItemStackBase::isArmorItem |
IPropIsDamageable |
9 |
IPropIsDamageable is PIER_IPROP_IS_DAMAGEABLE: ItemStackBase::isDamageableItem |
IPropIsDamaged |
10 |
IPropIsDamaged is PIER_IPROP_IS_DAMAGED: ItemStackBase::isDamaged |
IPropMaxDamage |
11 |
IPropMaxDamage is PIER_IPROP_MAX_DAMAGE: ItemStackBase::getMaxDamage |
IPropIsUnbreakable |
12 |
IPropIsUnbreakable is PIER_IPROP_IS_UNBREAKABLE: ItemStackBase::isUnbreakable |
IPropHasDurability |
13 |
IPropHasDurability is PIER_IPROP_HAS_DURABILITY: ItemStackBase::hasDurability |
IPropIsPotion |
14 |
IPropIsPotion is PIER_IPROP_IS_POTION: ItemStackBase::isPotionItem |
IPropIsThrowable |
15 |
IPropIsThrowable is PIER_IPROP_IS_THROWABLE: ItemStackBase::isThrowable |
IPropIsFireResistant |
16 |
IPropIsFireResistant is PIER_IPROP_IS_FIRE_RESISTANT: ItemStackBase::isFireResistant |
IPropAttackDamage |
17 |
IPropAttackDamage is PIER_IPROP_ATTACK_DAMAGE: ItemStackBase::getAttackDamage |
IPropRepairCost |
18 |
IPropRepairCost is PIER_IPROP_REPAIR_COST: ItemStackBase::getBaseRepairCost |
IPropEnchantValue |
19 |
IPropEnchantValue is PIER_IPROP_ENCHANT_VALUE: ItemStackBase::getEnchantValue |
IPropIsStackable |
20 |
IPropIsStackable is PIER_IPROP_IS_STACKABLE: ItemStackBase::isStackable |
IPropIsMusicDisc |
21 |
IPropIsMusicDisc is PIER_IPROP_IS_MUSIC_DISC: ItemStackBase::isMusicDiscItem |
IPropIsOffhand |
22 |
IPropIsOffhand is PIER_IPROP_IS_OFFHAND: ItemStackBase::isOffhandItem |
IPropUseDuration |
23 |
IPropUseDuration is PIER_IPROP_USE_DURATION: ItemStackBase::getMaxUseDuration |
IPropIsGlint |
24 |
IPropIsGlint is PIER_IPROP_IS_GLINT: ItemStackBase::isGlint |
IPropIsBundle |
25 |
IPropIsBundle is PIER_IPROP_IS_BUNDLE: ItemStackBase::isBundle |
IPropHasUserData |
26 |
IPropHasUserData is PIER_IPROP_HAS_USER_DATA: ItemStackBase::hasUserData |
IPropHasCustomName |
27 |
IPropHasCustomName is PIER_IPROP_HAS_CUSTOM_NAME: ItemStackBase::hasCustomHoverName |
IStr*¶
| Name | Value | Description |
|---|---|---|
IStrTypeName |
0 |
IStrTypeName is PIER_ISTR_TYPE_NAME: ItemStackBase::getTypeName ("minecraft:apple") |
IStrName |
1 |
IStrName is PIER_ISTR_NAME: ItemStackBase::getName (display) |
IStrCustomName |
2 |
IStrCustomName is PIER_ISTR_CUSTOM_NAME: ItemStackBase::getCustomName |
IStrRawNameId |
3 |
IStrRawNameId is PIER_ISTR_RAW_NAME_ID: ItemStackBase::getRawNameId |
IStrLore |
4 |
IStrLore is PIER_ISTR_LORE: SNBT list ["l1","l2"] ItemStackBase::getCustomLore |
IStrCanDestroy |
5 |
IStrCanDestroy is PIER_ISTR_CAN_DESTROY: SNBT list ["minecraft:stone",β¦] |
IStrCanPlaceOn |
6 |
IStrCanPlaceOn is PIER_ISTR_CAN_PLACE_ON: SNBT list |
IStrUserData |
7 |
IStrUserData is PIER_ISTR_USER_DATA: full NBT user data as SNBT |
IStrHoverName |
8 |
IStrHoverName is PIER_ISTR_HOVER_NAME: ItemStackBase::getHoverName |
IStrEffectName |
9 |
IStrEffectName is PIER_ISTR_EFFECT_NAME: ItemStackBase::getEffectName |
IStrColor |
10 |
IStrColor is PIER_ISTR_COLOR: SNBT {r,g,b} ItemStackBase::getColor |
Container*¶
The values of ContainerRef.Which.
| Name | Value | Description |
|---|---|---|
ContainerInventory |
0 |
|
ContainerEnderChest |
1 |
|
ContainerArmor |
2 |
|
ContainerOffhand |
3 |
|
ContainerBlock |
4 |