amulet.api.chunk.block_entity_dict module¶
- class amulet.api.chunk.block_entity_dict.BlockEntityDict(block_entities=())[source]¶
Bases:
UserDictA custom implementation of the dictionary class.
It can only store
BlockEntityinstances under the absolute coordinate of the block entityTuple[int, int, int]- insert(block_entity)[source]¶
Insert the given
BlockEntityinto the chunk at the locationBlockEntity.locationIf a block entity already exists at this location it will be overwritten.
- Parameters
block_entity (
BlockEntity) – The block entity to add to the chunk.
- pop(coordinate)[source]¶
Remove and return the
BlockEntityatcoordinate.
- setdefault(coordinate, block_entity)[source]¶
Set the block entity at the given coordinate if there is not a block entity present.
- Parameters
coordinate (
Tuple[int,int,int]) – The coordinate to set the block entity at.block_entity (
BlockEntity) – The block entity to set at the specified coordinate if one is not present.
- Return type
- popitem() (k, v), remove and return some (key, value) pair[source]¶
as a 2-tuple; but raise KeyError if D is empty.
- update(block_entities)[source]¶
Add the sequence of
BlockEntityinstances to the chunk at the locationBlockEntity.locationIf multiple block entities have the same coordinate only the last one will remain.
- Parameters
block_entities (
Iterable[BlockEntity]) – A sequence ofBlockEntityobjects to add to the chunk.