amulet.api.block_entity module

class amulet.api.block_entity.BlockEntity(namespace, base_name, x, y, z, nbt)[source]

A class to contain all the data to define a BlockEntity.

__init__(namespace, base_name, x, y, z, nbt)[source]

Constructs a BlockEntity instance.

Parameters
  • namespace (str) – The namespace of the block entity eg “minecraft”

  • base_name (str) – The base name of the block entity eg “chest”

  • x (int) – The x coordinate of the block entity

  • y (int) – The y coordinate of the block entity

  • z (int) – The z coordinate of the block entity

  • nbt (NamedTag) – The NBT stored with the block entity

property x: int[source]

The x location of the BlockEntity. Read Only

property y: int[source]

The y location of the BlockEntity. Read Only

property z: int[source]

The z location of the BlockEntity. Read Only

property location: Tuple[int, int, int][source]

The location of the BlockEntity. Read Only

new_at_location(x, y, z)[source]

Creates a copy of this BlockEntity at a new location BlockEntities are stored in the chunk based on their location so location cannot be mutable

Return type

BlockEntity

property base_name: str[source]

The base name of the block entity represented by the BlockEntity object (eg: creeper, pig)

Returns

The base name of the block entity

property namespace: str[source]

The namespace of the block entity represented by the BlockEntity object (eg: minecraft)

Returns

The namespace of the block entity

property namespaced_name: str[source]

The namespace:base_name of the entity represented by the object (eg: minecraft:creeper)

If the given namespace is an empty string it will just return the base name.

Returns

The namespace:base_name of the block entity or just base_name if no namespace

property nbt: NamedTag[source]

The NBT behind the object

Getter

Get the NBT data stored in the object

Setter

Set the NBT data stored in the object

Returns

A NamedTag