amulet.api.chunk.block_entity_dict
module¶
- class amulet.api.chunk.block_entity_dict.BlockEntityDict(block_entities=())[source]¶
Bases:
UserDict
A custom implementation of the dictionary class.
It can only store
BlockEntity
instances under the absolute coordinate of the block entityTuple[int, int, int]
- insert(block_entity)[source]¶
Insert the given
BlockEntity
into the chunk at the locationBlockEntity.location
If 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
BlockEntity
atcoordinate
.
- 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
BlockEntity
instances to the chunk at the locationBlockEntity.location
If multiple block entities have the same coordinate only the last one will remain.
- Parameters
block_entities (
Iterable
[BlockEntity
]) – A sequence ofBlockEntity
objects to add to the chunk.