Skip to content

Go: Blocks

Functions

Block

Go
func Block(dim, x, y, z int32) BlockAt

Block is the cell at x, y, z of dimension dim.

  • Parameters:
    • dim : int32
    • x : int32
    • y : int32
    • z : int32
  • Return type: BlockAt

BlockAt

Go
1
2
3
4
type BlockAt struct {
    Dim     int32
    X, Y, Z int32
}

BlockAt is one block cell of a dimension.

BlockAt.Info

Go
func (b BlockAt) Info() (BlockInfo, error)

Info reads the block: its type name and state.

  • Return type: (BlockInfo, error)
  • Slots: get_block

BlockAt.Set

Go
func (b BlockAt) Set(blockSpec string) error

Set places a block from a block spec, as /setblock reads one.

  • Parameters:
    • blockSpec : string
  • Return type: error
  • Slots: set_block

BlockAt.State

Go
func (b BlockAt) State(name string) (string, error)

State reads one block state by name.

  • Parameters:
    • name : string
  • Return type: (string, error)
  • Slots: block_get_state

BlockAt.SetState

Go
func (b BlockAt) SetState(name, value string) error

SetState writes one block state by name.

  • Parameters:
    • name : string
    • value : string
  • Return type: error
  • Slots: block_set_state

BlockAt.EntitySNBT

Go
func (b BlockAt) EntitySNBT() (string, error)

EntitySNBT is the block entity at the cell, such as a chest's contents, as SNBT.

BlockAt.Biome

Go
func (b BlockAt) Biome() (string, error)

Biome is the biome at the cell.

BlockAt.Container

Go
func (b BlockAt) Container() Container

Container is the cell's block container, such as a chest.

  • Return type: Container

BlockAt.IsAir

Go
func (b BlockAt) IsAir() (bool, error)

IsAir reads PIER_BPROP_IS_AIR: Block::isAir

BlockAt.Data

Go
func (b BlockAt) Data() (float64, error)

Data reads PIER_BPROP_DATA: Block::getData (legacy data value)

BlockAt.BlockItemId

Go
func (b BlockAt) BlockItemId() (float64, error)

BlockItemId reads PIER_BPROP_BLOCK_ITEM_ID: Block::getBlockItemId

BlockAt.IsCraftingBlock

Go
func (b BlockAt) IsCraftingBlock() (bool, error)

IsCraftingBlock reads PIER_BPROP_IS_CRAFTING_BLOCK: Block::isCraftingBlock

BlockAt.IsInteractiveBlock

Go
func (b BlockAt) IsInteractiveBlock() (bool, error)

IsInteractiveBlock reads PIER_BPROP_IS_INTERACTIVE_BLOCK: Block::isInteractiveBlock

BlockAt.HasBlockEntity

Go
func (b BlockAt) HasBlockEntity() (bool, error)

HasBlockEntity reads PIER_BPROP_HAS_BLOCK_ENTITY: BlockSource::getBlockEntity(pos) != null

BlockAt.Light

Go
func (b BlockAt) Light() (float64, error)

Light reads PIER_BPROP_LIGHT: Block::getLight

BlockAt.LightEmission

Go
func (b BlockAt) LightEmission() (float64, error)

LightEmission reads PIER_BPROP_LIGHT_EMISSION: Block::getLightEmission

BlockAt.DestroySpeed

Go
func (b BlockAt) DestroySpeed() (float64, error)

DestroySpeed reads PIER_BPROP_DESTROY_SPEED: Block::getDestroySpeed

BlockAt.ExplosionResistance

Go
func (b BlockAt) ExplosionResistance() (float64, error)

ExplosionResistance reads PIER_BPROP_EXPLOSION_RESISTANCE: Block::getExplosionResistance

BlockAt.Friction

Go
func (b BlockAt) Friction() (float64, error)

Friction reads PIER_BPROP_FRICTION: Block::getFriction

BlockAt.IsContainer

Go
func (b BlockAt) IsContainer() (bool, error)

IsContainer reads PIER_BPROP_IS_CONTAINER: Block::isContainerBlock

BlockAt.IsDoor

Go
func (b BlockAt) IsDoor() (bool, error)

IsDoor reads PIER_BPROP_IS_DOOR: unsupported since BDS 1.26.40: BlockType::isDoorBlock is gone

The host answers no on every current engine version: unsupported since BDS 1.26.40: BlockType::isDoorBlock is gone

BlockAt.IsFence

Go
func (b BlockAt) IsFence() (bool, error)

IsFence reads PIER_BPROP_IS_FENCE: Block::isFenceBlock

BlockAt.IsRail

Go
func (b BlockAt) IsRail() (bool, error)

IsRail reads PIER_BPROP_IS_RAIL: Block::isRailBlock

BlockAt.IsSlab

Go
func (b BlockAt) IsSlab() (bool, error)

IsSlab reads PIER_BPROP_IS_SLAB: Block::isSlabBlock

BlockAt.IsStair

Go
func (b BlockAt) IsStair() (bool, error)

IsStair reads PIER_BPROP_IS_STAIR: unsupported since BDS 1.26.40: BlockType::isStairBlock is gone

The host answers no on every current engine version: unsupported since BDS 1.26.40: BlockType::isStairBlock is gone

BlockAt.IsWall

Go
func (b BlockAt) IsWall() (bool, error)

IsWall reads PIER_BPROP_IS_WALL: Block::isWallBlock

BlockAt.IsCrop

Go
func (b BlockAt) IsCrop() (bool, error)

IsCrop reads PIER_BPROP_IS_CROP: Block::isCropBlock

BlockAt.IsUnbreakable

Go
func (b BlockAt) IsUnbreakable() (bool, error)

IsUnbreakable reads PIER_BPROP_IS_UNBREAKABLE: Block::isUnbreakable

BlockAt.RedstoneSignal

Go
func (b BlockAt) RedstoneSignal() (float64, error)

RedstoneSignal reads PIER_BPROP_REDSTONE_SIGNAL: Block::getDirectSignal

BlockAt.ComparatorSignal

Go
func (b BlockAt) ComparatorSignal() (float64, error)

ComparatorSignal reads PIER_BPROP_COMPARATOR_SIGNAL: Block::getComparatorSignal

BlockAt.IsSignalSource

Go
func (b BlockAt) IsSignalSource() (bool, error)

IsSignalSource reads PIER_BPROP_IS_SIGNAL_SOURCE: Block::isSignalSource

BlockAt.Variant

Go
func (b BlockAt) Variant() (float64, error)

Variant reads PIER_BPROP_VARIANT: Block::getVariant

BlockAt.BurnOdds

Go
func (b BlockAt) BurnOdds() (float64, error)

BurnOdds reads PIER_BPROP_BURN_ODDS: Block::getBurnOdds

BlockAt.FlameOdds

Go
func (b BlockAt) FlameOdds() (float64, error)

FlameOdds reads PIER_BPROP_FLAME_ODDS: Block::getFlameOdds

BlockAt.Bounciness

Go
func (b BlockAt) Bounciness() (float64, error)

Bounciness reads PIER_BPROP_BOUNCINESS: Block::getBounciness

BlockAt.IsSolid

Go
func (b BlockAt) IsSolid() (bool, error)

IsSolid reads PIER_BPROP_IS_SOLID: Block::isSolid

BlockAt.RequiresTool

Go
func (b BlockAt) RequiresTool() (float64, error)

RequiresTool reads PIER_BPROP_REQUIRES_TOOL: Block::requiresCorrectToolForDrops

BlockAt.TypeName

Go
func (b BlockAt) TypeName() (string, error)

TypeName reads PIER_BSTR_TYPE_NAME: Block::getTypeName

BlockAt.Snbt

Go
func (b BlockAt) Snbt() (string, error)

Snbt reads PIER_BSTR_SNBT: Block::mSerializationId β†’ SNBT {name,states,version}

BlockAt.DescriptionId

Go
func (b BlockAt) DescriptionId() (string, error)

DescriptionId reads PIER_BSTR_DESCRIPTION_ID: Block::getDescriptionId

BlockAt.DebugString

Go
func (b BlockAt) DebugString() (string, error)

DebugString reads PIER_BSTR_DEBUG_STRING: Block::toDebugString

BlockAt.Tags

Go
func (b BlockAt) Tags() (string, error)

Tags reads PIER_BSTR_TAGS: Block::mTags β†’ SNBT string list ["a","b"]

BlockAt.StateText

Go
func (b BlockAt) StateText() (string, error)

StateText reads PIER_BSTR_STATE: SNBT {state_name:value,…} all block states

BlockAt.CollisionShape

Go
func (b BlockAt) CollisionShape() (string, error)

CollisionShape reads PIER_BSTR_COLLISION_SHAPE: SNBT [{min:[x,y,z],max:[x,y,z]},…]

BlockAt.OutlineShape

Go
func (b BlockAt) OutlineShape() (string, error)

OutlineShape reads PIER_BSTR_OUTLINE_SHAPE: SNBT [{min,max}] render outline

BlockAt.DisplayName

Go
func (b BlockAt) DisplayName() (string, error)

DisplayName reads PIER_BSTR_DISPLAY_NAME: Block::getDisplayName

BlockAt.HasTag

Go
func (b BlockAt) HasTag(sarg string) (string, error)

HasTag runs PIER_BACT_HAS_TAG: sarg=tag β†’ out "0"/"1" Block::hasTag

The output, when the verb has one, is returned; abi.h names each argument.

  • Parameters:
    • sarg : string
  • Return type: (string, error)
  • Slots: block_action

BlockAt.GetState

Go
func (b BlockAt) GetState(sarg string) (string, error)

GetState runs PIER_BACT_GET_STATE: sarg=state name β†’ out value string Block::getState

The output, when the verb has one, is returned; abi.h names each argument.

  • Parameters:
    • sarg : string
  • Return type: (string, error)
  • Slots: block_action

BlockAt.PopResource

Go
func (b BlockAt) PopResource(sarg string) (string, error)

PopResource runs PIER_BACT_POP_RESOURCE: sarg=item SNBT β†’ pop resource at pos Block::popResource

The output, when the verb has one, is returned; abi.h names each argument.

  • Parameters:
    • sarg : string
  • Return type: (string, error)
  • Slots: block_action

BlockAt.AsItem

Go
func (b BlockAt) AsItem(sarg string) (string, error)

AsItem runs PIER_BACT_AS_ITEM: β†’ out item SNBT Block::asItemInstance

The output, when the verb has one, is returned; abi.h names each argument.

  • Parameters:
    • sarg : string
  • Return type: (string, error)
  • Slots: block_action

BlockInfo

Go
1
2
3
4
5
type BlockInfo struct {
    X, Y, Z int32
    Name    string
    SNBT    string
}

BlockInfo is one block: its cell, its type name and its block state as SNBT.

BProp*

Name Value Description
BPropIsAir 0 BPropIsAir is PIER_BPROP_IS_AIR: Block::isAir
BPropData 1 BPropData is PIER_BPROP_DATA: Block::getData (legacy data value)
BPropBlockItemId 2 BPropBlockItemId is PIER_BPROP_BLOCK_ITEM_ID: Block::getBlockItemId
BPropIsCraftingBlock 3 BPropIsCraftingBlock is PIER_BPROP_IS_CRAFTING_BLOCK: Block::isCraftingBlock
BPropIsInteractiveBlock 4 BPropIsInteractiveBlock is PIER_BPROP_IS_INTERACTIVE_BLOCK: Block::isInteractiveBlock
BPropHasBlockEntity 5 BPropHasBlockEntity is PIER_BPROP_HAS_BLOCK_ENTITY: BlockSource::getBlockEntity(pos) != null
BPropLight 6 BPropLight is PIER_BPROP_LIGHT: Block::getLight
BPropLightEmission 7 BPropLightEmission is PIER_BPROP_LIGHT_EMISSION: Block::getLightEmission
BPropDestroySpeed 8 BPropDestroySpeed is PIER_BPROP_DESTROY_SPEED: Block::getDestroySpeed
BPropExplosionResistance 9 BPropExplosionResistance is PIER_BPROP_EXPLOSION_RESISTANCE: Block::getExplosionResistance
BPropFriction 10 BPropFriction is PIER_BPROP_FRICTION: Block::getFriction
BPropIsContainer 11 BPropIsContainer is PIER_BPROP_IS_CONTAINER: Block::isContainerBlock
BPropIsDoor 12 the current engine version gives no value for this constant: BPropIsDoor is PIER_BPROP_IS_DOOR: unsupported since BDS 1.26.40: BlockType::isDoorBlock is gone
BPropIsFence 13 BPropIsFence is PIER_BPROP_IS_FENCE: Block::isFenceBlock
BPropIsRail 14 BPropIsRail is PIER_BPROP_IS_RAIL: Block::isRailBlock
BPropIsSlab 15 BPropIsSlab is PIER_BPROP_IS_SLAB: Block::isSlabBlock
BPropIsStair 16 the current engine version gives no value for this constant: BPropIsStair is PIER_BPROP_IS_STAIR: unsupported since BDS 1.26.40: BlockType::isStairBlock is gone
BPropIsWall 17 BPropIsWall is PIER_BPROP_IS_WALL: Block::isWallBlock
BPropIsCrop 18 BPropIsCrop is PIER_BPROP_IS_CROP: Block::isCropBlock
BPropIsUnbreakable 19 BPropIsUnbreakable is PIER_BPROP_IS_UNBREAKABLE: Block::isUnbreakable
BPropRedstoneSignal 20 BPropRedstoneSignal is PIER_BPROP_REDSTONE_SIGNAL: Block::getDirectSignal
BPropComparatorSignal 21 BPropComparatorSignal is PIER_BPROP_COMPARATOR_SIGNAL: Block::getComparatorSignal
BPropIsSignalSource 22 BPropIsSignalSource is PIER_BPROP_IS_SIGNAL_SOURCE: Block::isSignalSource
BPropVariant 23 BPropVariant is PIER_BPROP_VARIANT: Block::getVariant
BPropBurnOdds 24 BPropBurnOdds is PIER_BPROP_BURN_ODDS: Block::getBurnOdds
BPropFlameOdds 25 BPropFlameOdds is PIER_BPROP_FLAME_ODDS: Block::getFlameOdds
BPropBounciness 26 BPropBounciness is PIER_BPROP_BOUNCINESS: Block::getBounciness
BPropIsSolid 27 BPropIsSolid is PIER_BPROP_IS_SOLID: Block::isSolid
BPropRequiresTool 28 BPropRequiresTool is PIER_BPROP_REQUIRES_TOOL: Block::requiresCorrectToolForDrops

BStr*

Name Value Description
BStrTypeName 0 BStrTypeName is PIER_BSTR_TYPE_NAME: Block::getTypeName
BStrSnbt 1 BStrSnbt is PIER_BSTR_SNBT: Block::mSerializationId β†’ SNBT
BStrDescriptionId 2 BStrDescriptionId is PIER_BSTR_DESCRIPTION_ID: Block::getDescriptionId
BStrDebugString 3 BStrDebugString is PIER_BSTR_DEBUG_STRING: Block::toDebugString
BStrTags 4 BStrTags is PIER_BSTR_TAGS: Block::mTags β†’ SNBT string list ["a","b"]
BStrState 5 BStrState is PIER_BSTR_STATE: SNBT {state_name:value,…} all block states
BStrCollisionShape 6 BStrCollisionShape is PIER_BSTR_COLLISION_SHAPE: SNBT [{min:[x,y,z],max:[x,y,z]},…]
BStrOutlineShape 7 BStrOutlineShape is PIER_BSTR_OUTLINE_SHAPE: SNBT [{min,max}] render outline
BStrDisplayName 8 BStrDisplayName is PIER_BSTR_DISPLAY_NAME: Block::getDisplayName

BAct*

Name Value Description
BActHasTag 0 BActHasTag is PIER_BACT_HAS_TAG: sarg=tag β†’ out "0"/"1" Block::hasTag
BActGetState 1 BActGetState is PIER_BACT_GET_STATE: sarg=state name β†’ out value string Block::getState
BActPopResource 2 BActPopResource is PIER_BACT_POP_RESOURCE: sarg=item SNBT β†’ pop resource at pos Block::popResource
BActAsItem 3 BActAsItem is PIER_BACT_AS_ITEM: β†’ out item SNBT Block::asItemInstance