endstone.block

Classes relating to the blocks in a world, including special states.

Classes relating to the blocks in a world, including special states.

Classes

NameDescription
Block

Represents a block.

BlockData

Represents the data related to a live block

BlockFace
BlockState

Represents a captured state of a block, which will not update automatically.

BlockType

Represents a block type.

classBlock

Block()

Represents a block.

Methods

NameDescription
capture_state

Captures the current state of this block. The returned object will never be updated, and you are not guaranteed that (for example) a sign is still a sign after you capture its state.

set_data

Sets the complete data for this block

set_type

Sets the type of this block

Attributes

NameTypeDescription
dataBlockData

Gets the complete data for this block

dimensionDimension

Gets the dimension which contains this Block

locationLocation

Gets the Location of the block

typestr

Gets or sets the type of the block.

xint

Gets the x-coordinate of this block

yint

Gets the y-coordinate of this block

zint

Gets the z-coordinate of this block

attrdataproperty

data: BlockData

Gets the complete data for this block

attrdimensionproperty

dimension: Dimension

Gets the dimension which contains this Block

attrlocationproperty

location: Location

Gets the Location of the block

attrtypeproperty

type: str

Gets or sets the type of the block.

attrxproperty

x: int

Gets the x-coordinate of this block

attryproperty

y: int

Gets the y-coordinate of this block

attrzproperty

z: int

Gets the z-coordinate of this block

methcapture_state

capture_state() -> BlockState

Captures the current state of this block. The returned object will never be updated, and you are not guaranteed that (for example) a sign is still a sign after you capture its state.

methset_data

set_data(data: BlockData, apply_physics: bool = True) -> None

Sets the complete data for this block

methset_type

set_type(type: str, apply_physics: bool = True) -> None

Sets the type of this block

classBlockData

BlockData()

Represents the data related to a live block

Attributes

NameTypeDescription
block_statesdict[str, bool | str | int]

Gets the block states for this block.

runtime_idint

Gets the runtime id for this block.

typestr

Get the block type represented by this block data.

attrblock_statesproperty

block_states: dict[str, bool | str | int]

Gets the block states for this block.

attrruntime_idproperty

runtime_id: int

Gets the runtime id for this block.

attrtypeproperty

type: str

Get the block type represented by this block data.

classBlockFace

Bases: Enum

BlockFace()

Attributes

NameTypeDescription
DOWN
EAST
NORTH
SOUTH
UP
WEST

attrDOWN

DOWN = 0

attrEAST

EAST = 5

attrNORTH

NORTH = 2

attrSOUTH

SOUTH = 3

attrUP

UP = 1

attrWEST

WEST = 4

classBlockState

BlockState()

Represents a captured state of a block, which will not update automatically.

Methods

NameDescription
update

Attempts to update the block represented by this state.

Attributes

NameTypeDescription
blockBlock

Gets the block represented by this block state.

dataBlockData

Gets or sets the data for this block state.

dimensionDimension

Gets the dimension which contains the block represented by this block state.

locationLocation

Gets the location of this block state.

typestr

Gets or sets the type of this block state.

xint

Gets the x-coordinate of this block state.

yint

Gets the y-coordinate of this block state.

zint

Gets the z-coordinate of this block state.

attrblockproperty

block: Block

Gets the block represented by this block state.

attrdataproperty

data: BlockData

Gets or sets the data for this block state.

attrdimensionproperty

dimension: Dimension

Gets the dimension which contains the block represented by this block state.

attrlocationproperty

location: Location

Gets the location of this block state.

attrtypeproperty

type: str

Gets or sets the type of this block state.

attrxproperty

x: int

Gets the x-coordinate of this block state.

attryproperty

y: int

Gets the y-coordinate of this block state.

attrzproperty

z: int

Gets the z-coordinate of this block state.

methupdate

update(force: bool = False, apply_physics: bool = True) -> bool

Attempts to update the block represented by this state.

classBlockType

BlockType()

Represents a block type.

Methods

NameDescription
create_block_data

Creates a new BlockData instance for this block type, with all properties initialized to defaults.

get

Attempts to get the BlockType with the given name.

Attributes

NameTypeDescription
has_item_typebool

Returns true if this BlockType has a corresponding ItemType.

idstr

Return the identifier of this block type.

translation_keystr

Get the translation key, suitable for use in a translation component.

attrhas_item_typeproperty

has_item_type: bool

Returns true if this BlockType has a corresponding ItemType.

attridproperty

id: str

Return the identifier of this block type.

attrtranslation_keyproperty

translation_key: str

Get the translation key, suitable for use in a translation component.

methcreate_block_data

create_block_data() -> BlockData

Creates a new BlockData instance for this block type, with all properties initialized to defaults.

methgetstaticmethod

get(name: str) -> BlockType

Attempts to get the BlockType with the given name.

On this page