amulet-core 2.0a8__cp312-cp312-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a1__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of amulet-core might be problematic. Click here for more details.
- amulet/core/__init__.py +36 -0
- amulet/core/__pyinstaller/hook-amulet.core.py +4 -0
- amulet/core/_amulet_core.cp312-win_amd64.pyd +0 -0
- amulet/core/_amulet_core.pyi +7 -0
- amulet/{_version.py → core/_version.py} +3 -3
- amulet/core/amulet_core.dll +0 -0
- amulet/core/amulet_core.lib +0 -0
- amulet/core/amulet_coreConfig.cmake +18 -0
- amulet/{biome.pyi → core/biome/__init__.pyi} +3 -3
- amulet/core/biome/biome.hpp +53 -0
- amulet/{block.pyi → core/block/__init__.pyi} +25 -26
- amulet/core/block/block.hpp +156 -0
- amulet/{block_entity.pyi → core/block_entity/__init__.pyi} +7 -7
- amulet/core/block_entity/block_entity.hpp +84 -0
- amulet/{errors.py → core/chunk/__init__.pyi} +37 -33
- amulet/core/chunk/chunk.hpp +126 -0
- amulet/core/chunk/component/__init__.pyi +18 -0
- amulet/core/chunk/component/biome_3d_component.hpp +96 -0
- amulet/core/chunk/component/block_component.hpp +101 -0
- amulet/core/chunk/component/block_component.pyi +28 -0
- amulet/core/chunk/component/block_entity_component.hpp +119 -0
- amulet/core/chunk/component/section_array_map.hpp +129 -0
- amulet/{chunk_components.pyi → core/chunk/component/section_array_map.pyi} +4 -24
- amulet/core/dll.hpp +21 -0
- amulet/core/entity/__init__.pyi +105 -0
- amulet/core/entity/entity.hpp +100 -0
- amulet/{palette → core/palette}/__init__.pyi +2 -2
- amulet/core/palette/biome_palette.hpp +65 -0
- amulet/{palette → core/palette}/biome_palette.pyi +8 -8
- amulet/core/palette/block_palette.hpp +71 -0
- amulet/{palette → core/palette}/block_palette.pyi +12 -10
- amulet/core/selection/__init__.pyi +8 -0
- amulet/core/selection/box.hpp +86 -0
- amulet/core/selection/box.pyi +215 -0
- amulet/core/selection/group.hpp +80 -0
- amulet/core/selection/group.pyi +213 -0
- amulet/{version.pyi → core/version/__init__.pyi} +58 -10
- amulet/core/version/version.hpp +204 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/METADATA +25 -20
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/RECORD +45 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/WHEEL +1 -1
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/entry_points.txt +2 -0
- amulet/__init__.cp312-win_amd64.pyd +0 -0
- amulet/__init__.py.cpp +0 -45
- amulet/__init__.pyi +0 -30
- amulet/__pyinstaller/hook-amulet.py +0 -4
- amulet/_init.py +0 -26
- amulet/biome.cpp +0 -36
- amulet/biome.hpp +0 -43
- amulet/biome.py.cpp +0 -122
- amulet/block.cpp +0 -435
- amulet/block.hpp +0 -119
- amulet/block.py.cpp +0 -377
- amulet/block_entity.cpp +0 -12
- amulet/block_entity.hpp +0 -56
- amulet/block_entity.py.cpp +0 -115
- amulet/chunk.cpp +0 -16
- amulet/chunk.hpp +0 -100
- amulet/chunk.py.cpp +0 -80
- amulet/chunk.pyi +0 -28
- amulet/chunk_components/biome_3d_component.cpp +0 -5
- amulet/chunk_components/biome_3d_component.hpp +0 -79
- amulet/chunk_components/block_component.cpp +0 -41
- amulet/chunk_components/block_component.hpp +0 -88
- amulet/chunk_components/block_entity_component.cpp +0 -5
- amulet/chunk_components/block_entity_component.hpp +0 -147
- amulet/chunk_components/section_array_map.cpp +0 -129
- amulet/chunk_components/section_array_map.hpp +0 -147
- amulet/collections/eq.py.hpp +0 -37
- amulet/collections/hash.py.hpp +0 -27
- amulet/collections/holder.py.hpp +0 -37
- amulet/collections/iterator.py.hpp +0 -80
- amulet/collections/mapping.py.hpp +0 -199
- amulet/collections/mutable_mapping.py.hpp +0 -226
- amulet/collections/sequence.py.hpp +0 -163
- amulet/collections.pyi +0 -40
- amulet/data_types.py +0 -29
- amulet/entity.py +0 -182
- amulet/game/__init__.py +0 -7
- amulet/game/_game.py +0 -152
- amulet/game/_universal/__init__.py +0 -1
- amulet/game/_universal/_biome.py +0 -17
- amulet/game/_universal/_block.py +0 -47
- amulet/game/_universal/_version.py +0 -68
- amulet/game/abc/__init__.py +0 -22
- amulet/game/abc/_block_specification.py +0 -150
- amulet/game/abc/biome.py +0 -213
- amulet/game/abc/block.py +0 -331
- amulet/game/abc/game_version_container.py +0 -25
- amulet/game/abc/json_interface.py +0 -27
- amulet/game/abc/version.py +0 -44
- amulet/game/bedrock/__init__.py +0 -1
- amulet/game/bedrock/_biome.py +0 -35
- amulet/game/bedrock/_block.py +0 -42
- amulet/game/bedrock/_version.py +0 -165
- amulet/game/java/__init__.py +0 -2
- amulet/game/java/_biome.py +0 -35
- amulet/game/java/_block.py +0 -60
- amulet/game/java/_version.py +0 -176
- amulet/game/translate/__init__.py +0 -12
- amulet/game/translate/_functions/__init__.py +0 -15
- amulet/game/translate/_functions/_code_functions/__init__.py +0 -0
- amulet/game/translate/_functions/_code_functions/_text.py +0 -553
- amulet/game/translate/_functions/_code_functions/banner_pattern.py +0 -67
- amulet/game/translate/_functions/_code_functions/bedrock_chest_connection.py +0 -152
- amulet/game/translate/_functions/_code_functions/bedrock_moving_block_pos.py +0 -88
- amulet/game/translate/_functions/_code_functions/bedrock_sign.py +0 -152
- amulet/game/translate/_functions/_code_functions/bedrock_skull_rotation.py +0 -16
- amulet/game/translate/_functions/_code_functions/custom_name.py +0 -146
- amulet/game/translate/_functions/_frozen.py +0 -66
- amulet/game/translate/_functions/_state.py +0 -54
- amulet/game/translate/_functions/_typing.py +0 -98
- amulet/game/translate/_functions/abc.py +0 -123
- amulet/game/translate/_functions/carry_nbt.py +0 -160
- amulet/game/translate/_functions/carry_properties.py +0 -80
- amulet/game/translate/_functions/code.py +0 -143
- amulet/game/translate/_functions/map_block_name.py +0 -66
- amulet/game/translate/_functions/map_nbt.py +0 -111
- amulet/game/translate/_functions/map_properties.py +0 -93
- amulet/game/translate/_functions/multiblock.py +0 -112
- amulet/game/translate/_functions/new_block.py +0 -42
- amulet/game/translate/_functions/new_entity.py +0 -43
- amulet/game/translate/_functions/new_nbt.py +0 -206
- amulet/game/translate/_functions/new_properties.py +0 -64
- amulet/game/translate/_functions/sequence.py +0 -51
- amulet/game/translate/_functions/walk_input_nbt.py +0 -331
- amulet/game/translate/_translator.py +0 -433
- amulet/img/__init__.py +0 -10
- amulet/img/missing_no.png +0 -0
- amulet/img/missing_pack.png +0 -0
- amulet/img/missing_world.png +0 -0
- amulet/io/binary_reader.hpp +0 -45
- amulet/io/binary_writer.hpp +0 -30
- amulet/item.py +0 -75
- amulet/level/__init__.pyi +0 -23
- amulet/level/_load.py +0 -100
- amulet/level/abc/__init__.py +0 -12
- amulet/level/abc/_chunk_handle.py +0 -358
- amulet/level/abc/_dimension.py +0 -86
- amulet/level/abc/_history/__init__.py +0 -1
- amulet/level/abc/_history/_cache.py +0 -224
- amulet/level/abc/_history/_history_manager.py +0 -291
- amulet/level/abc/_level/__init__.py +0 -5
- amulet/level/abc/_level/_compactable_level.py +0 -10
- amulet/level/abc/_level/_creatable_level.py +0 -28
- amulet/level/abc/_level/_disk_level.py +0 -17
- amulet/level/abc/_level/_level.py +0 -449
- amulet/level/abc/_level/_loadable_level.py +0 -42
- amulet/level/abc/_player_storage.py +0 -7
- amulet/level/abc/_raw_level.py +0 -187
- amulet/level/abc/_registry.py +0 -40
- amulet/level/java/__init__.pyi +0 -16
- amulet/level/java/_chunk_handle.py +0 -17
- amulet/level/java/_dimension.py +0 -20
- amulet/level/java/_level.py +0 -184
- amulet/level/java/_raw/__init__.pyi +0 -15
- amulet/level/java/_raw/_chunk.pyi +0 -23
- amulet/level/java/_raw/_constant.py +0 -9
- amulet/level/java/_raw/_data_pack/__init__.py +0 -2
- amulet/level/java/_raw/_data_pack/data_pack.py +0 -241
- amulet/level/java/_raw/_data_pack/data_pack_manager.py +0 -77
- amulet/level/java/_raw/_dimension.py +0 -86
- amulet/level/java/_raw/_level.py +0 -507
- amulet/level/java/_raw/_typing.py +0 -3
- amulet/level/java/_raw/java_chunk_decode.cpp +0 -531
- amulet/level/java/_raw/java_chunk_decode.hpp +0 -23
- amulet/level/java/_raw/java_chunk_encode.cpp +0 -25
- amulet/level/java/_raw/java_chunk_encode.hpp +0 -23
- amulet/level/java/anvil/__init__.py +0 -2
- amulet/level/java/anvil/_dimension.py +0 -170
- amulet/level/java/anvil/_region.py +0 -421
- amulet/level/java/anvil/_sector_manager.py +0 -223
- amulet/level/java/chunk.pyi +0 -81
- amulet/level/java/chunk_/_chunk.py +0 -260
- amulet/level/java/chunk_/components/inhabited_time.py +0 -12
- amulet/level/java/chunk_/components/last_update.py +0 -12
- amulet/level/java/chunk_/components/legacy_version.py +0 -12
- amulet/level/java/chunk_/components/light_populated.py +0 -12
- amulet/level/java/chunk_/components/named_height_2d.py +0 -37
- amulet/level/java/chunk_/components/status.py +0 -11
- amulet/level/java/chunk_/components/terrain_populated.py +0 -12
- amulet/level/java/chunk_components/data_version_component.cpp +0 -32
- amulet/level/java/chunk_components/data_version_component.hpp +0 -31
- amulet/level/java/chunk_components/java_raw_chunk_component.cpp +0 -56
- amulet/level/java/chunk_components/java_raw_chunk_component.hpp +0 -45
- amulet/level/java/chunk_components.pyi +0 -22
- amulet/level/java/java_chunk.cpp +0 -170
- amulet/level/java/java_chunk.hpp +0 -141
- amulet/level/java/long_array.hpp +0 -175
- amulet/level/java/long_array.pyi +0 -39
- amulet/level/temporary_level/__init__.py +0 -1
- amulet/level/temporary_level/_level.py +0 -16
- amulet/mesh/__init__.py +0 -0
- amulet/mesh/block/__init__.pyi +0 -301
- amulet/mesh/block/_cube.py +0 -198
- amulet/mesh/block/_missing_block.py +0 -20
- amulet/mesh/block/block_mesh.cpp +0 -107
- amulet/mesh/block/block_mesh.hpp +0 -207
- amulet/mesh/util.py +0 -17
- amulet/palette/biome_palette.hpp +0 -85
- amulet/palette/block_palette.cpp +0 -32
- amulet/palette/block_palette.hpp +0 -93
- amulet/player.py +0 -62
- amulet/pybind11/collections.hpp +0 -118
- amulet/pybind11/numpy.hpp +0 -26
- amulet/pybind11/py_module.hpp +0 -34
- amulet/pybind11/type_hints.hpp +0 -51
- amulet/pybind11/types.hpp +0 -25
- amulet/pybind11/typing.hpp +0 -7
- amulet/resource_pack/__init__.py +0 -63
- amulet/resource_pack/abc/__init__.py +0 -2
- amulet/resource_pack/abc/resource_pack.py +0 -38
- amulet/resource_pack/abc/resource_pack_manager.py +0 -85
- amulet/resource_pack/java/__init__.py +0 -2
- amulet/resource_pack/java/download_resources.py +0 -212
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
- amulet/resource_pack/java/resource_pack.py +0 -44
- amulet/resource_pack/java/resource_pack_manager.py +0 -563
- amulet/resource_pack/unknown_resource_pack.py +0 -10
- amulet/selection/__init__.py +0 -2
- amulet/selection/abstract_selection.py +0 -342
- amulet/selection/box.py +0 -852
- amulet/selection/group.py +0 -481
- amulet/utils/__init__.pyi +0 -23
- amulet/utils/call_spec/__init__.py +0 -24
- amulet/utils/call_spec/_call_spec.py +0 -257
- amulet/utils/cast.py +0 -10
- amulet/utils/comment_json.py +0 -188
- amulet/utils/format_utils.py +0 -41
- amulet/utils/generator.py +0 -18
- amulet/utils/matrix.py +0 -243
- amulet/utils/numpy.hpp +0 -36
- amulet/utils/numpy.pyi +0 -11
- amulet/utils/numpy_helpers.py +0 -19
- amulet/utils/shareable_lock.py +0 -335
- amulet/utils/signal/__init__.py +0 -10
- amulet/utils/signal/_signal.py +0 -228
- amulet/utils/task_manager.py +0 -235
- amulet/utils/typed_property.py +0 -111
- amulet/utils/weakref.py +0 -70
- amulet/utils/world_utils.py +0 -102
- amulet/version.cpp +0 -136
- amulet/version.hpp +0 -142
- amulet/version.py.cpp +0 -281
- amulet_core-2.0a8.dist-info/RECORD +0 -241
- amulet_core-2.0a8.dist-info/entry_points.txt +0 -2
- /amulet/{__pyinstaller → core/__pyinstaller}/__init__.py +0 -0
- /amulet/{py.typed → core/py.typed} +0 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/top_level.txt +0 -0
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import NamedTuple
|
|
4
|
-
import threading
|
|
5
|
-
from bisect import bisect_left, bisect_right
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class NoValidSector(Exception):
|
|
9
|
-
"""An error for when there is no sector large enough and the region cannot be resized."""
|
|
10
|
-
|
|
11
|
-
pass
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Sector(NamedTuple):
|
|
15
|
-
start: int
|
|
16
|
-
stop: int
|
|
17
|
-
|
|
18
|
-
@property
|
|
19
|
-
def length(self) -> int:
|
|
20
|
-
return self.stop - self.start
|
|
21
|
-
|
|
22
|
-
def intersects(self, other: Sector) -> bool:
|
|
23
|
-
"""Do the two sectors intersect each other."""
|
|
24
|
-
return not (other.stop <= self.start or self.stop <= other.start)
|
|
25
|
-
|
|
26
|
-
def contains(self, other: Sector) -> bool:
|
|
27
|
-
"""Is the other sector entirely within this sector."""
|
|
28
|
-
return self.start <= other.start and other.stop <= self.stop
|
|
29
|
-
|
|
30
|
-
def neighbours(self, other: Sector) -> bool:
|
|
31
|
-
"""Do the two sectors neighbour but not intersect."""
|
|
32
|
-
return other.stop == self.start or self.stop == other.start
|
|
33
|
-
|
|
34
|
-
def split(self, other: Sector) -> list[Sector]:
|
|
35
|
-
"""
|
|
36
|
-
Split this sector around another sector.
|
|
37
|
-
The other sector must be contained within this sector
|
|
38
|
-
|
|
39
|
-
:param other: The other sector to split around.
|
|
40
|
-
:return: A list of 0-2 sectors
|
|
41
|
-
"""
|
|
42
|
-
sectors = []
|
|
43
|
-
if self.start < other.start:
|
|
44
|
-
sectors.append(Sector(self.start, other.start))
|
|
45
|
-
if other.stop < self.stop:
|
|
46
|
-
sectors.append(Sector(other.stop, self.stop))
|
|
47
|
-
return sectors
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class SectorManager:
|
|
51
|
-
"""A class to manage a sequence of memory."""
|
|
52
|
-
|
|
53
|
-
def __init__(self, start: int, stop: int, resizable: bool = True):
|
|
54
|
-
"""
|
|
55
|
-
:param start: The start of the memory region
|
|
56
|
-
:param stop: The end of the memory region
|
|
57
|
-
:param resizable: Can the region be resized
|
|
58
|
-
"""
|
|
59
|
-
if stop < start:
|
|
60
|
-
raise ValueError("stop must be at least start")
|
|
61
|
-
self._lock = threading.RLock()
|
|
62
|
-
self._stop = stop
|
|
63
|
-
self._resizable = resizable
|
|
64
|
-
|
|
65
|
-
# A list of free sectors ordered by start location
|
|
66
|
-
self._free_start = [Sector(start, stop)]
|
|
67
|
-
# A list of free sectors ordered by (length, start).
|
|
68
|
-
# This makes it easier to find the first sector large enough
|
|
69
|
-
self._free_size = [Sector(start, stop)]
|
|
70
|
-
|
|
71
|
-
# A set of reserved sectors
|
|
72
|
-
self._reserved: set[Sector] = set()
|
|
73
|
-
|
|
74
|
-
@property
|
|
75
|
-
def sectors(self) -> list[Sector]:
|
|
76
|
-
"""A list of reserved sectors. Ordered by their start location."""
|
|
77
|
-
with self._lock:
|
|
78
|
-
return list(sorted(self._reserved, key=lambda i: i.start))
|
|
79
|
-
|
|
80
|
-
def reserve_space(self, length: int) -> Sector:
|
|
81
|
-
"""
|
|
82
|
-
Find and reserve a memory location large enough to fit the requested memory.
|
|
83
|
-
|
|
84
|
-
:param length: The length of the memory region to reserve
|
|
85
|
-
:return: The index of the start of the reserved memory region
|
|
86
|
-
"""
|
|
87
|
-
if not length:
|
|
88
|
-
raise ValueError("Cannot reserve a sector with zero length.")
|
|
89
|
-
with self._lock:
|
|
90
|
-
# find the index of the first element with a larger or equal length prioritising the ones closer to the start
|
|
91
|
-
index = bisect_left(
|
|
92
|
-
self._free_size, (length, 0), key=lambda k: (k.length, k.start)
|
|
93
|
-
)
|
|
94
|
-
if index < len(self._free_size):
|
|
95
|
-
# if there exists a section large enough to fit the length
|
|
96
|
-
free_sector = self._free_size.pop(index)
|
|
97
|
-
start_index = self._free_start.index(free_sector)
|
|
98
|
-
sector = Sector(free_sector.start, free_sector.start + length)
|
|
99
|
-
if free_sector.length > length:
|
|
100
|
-
free_sector = Sector(sector.stop, free_sector.stop)
|
|
101
|
-
self._add_size_sector(free_sector)
|
|
102
|
-
self._free_start[start_index] = free_sector
|
|
103
|
-
else:
|
|
104
|
-
del self._free_start[start_index]
|
|
105
|
-
self._reserved.add(sector)
|
|
106
|
-
return sector
|
|
107
|
-
elif self._resizable:
|
|
108
|
-
sector = Sector(self._stop, self._stop + length)
|
|
109
|
-
self._stop = sector.stop
|
|
110
|
-
self._reserved.add(sector)
|
|
111
|
-
return sector
|
|
112
|
-
else:
|
|
113
|
-
raise NoValidSector(
|
|
114
|
-
"There is not enough contiguous space to allocate the length."
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
def reserve(self, sector: Sector) -> None:
|
|
118
|
-
"""
|
|
119
|
-
Mark a section as reserved.
|
|
120
|
-
If you don't know exactly where the sector is use `reserve_space` to find and reserve a new sector
|
|
121
|
-
|
|
122
|
-
:param sector: The sector to reserve
|
|
123
|
-
"""
|
|
124
|
-
if not sector.length:
|
|
125
|
-
raise ValueError("Cannot reserve a sector with zero length.")
|
|
126
|
-
with self._lock:
|
|
127
|
-
if sector.start >= self._stop and (
|
|
128
|
-
not self._free_start or self._free_start[-1].stop != self._stop
|
|
129
|
-
):
|
|
130
|
-
if self._resizable:
|
|
131
|
-
# if the last sector has been reserved or did not exist then create a new one
|
|
132
|
-
s = Sector(self._stop, sector.stop)
|
|
133
|
-
self._free_start.append(s)
|
|
134
|
-
self._add_size_sector(s)
|
|
135
|
-
self._stop = sector.stop
|
|
136
|
-
else:
|
|
137
|
-
raise NoValidSector("The sector starts outside of the region.")
|
|
138
|
-
|
|
139
|
-
# Get the index of the segment with the latest start point that is
|
|
140
|
-
# less than or equal to the start point of the sector being reserved.
|
|
141
|
-
index = (
|
|
142
|
-
bisect_right(self._free_start, sector.start, key=lambda k: k.start) - 1
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
if index < 0:
|
|
146
|
-
raise NoValidSector(
|
|
147
|
-
"No free sectors that start at or before the one being reserved."
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
free_sector = self._free_start[index]
|
|
151
|
-
|
|
152
|
-
if sector.stop <= free_sector.stop:
|
|
153
|
-
# The sector fits within the contained sector
|
|
154
|
-
# remove the contained sector from the lists
|
|
155
|
-
del self._free_start[index]
|
|
156
|
-
self._free_size.remove(free_sector)
|
|
157
|
-
elif free_sector.stop == self._stop:
|
|
158
|
-
if self._resizable:
|
|
159
|
-
# The sector is the last one and the memory region is resizable
|
|
160
|
-
del self._free_start[index]
|
|
161
|
-
self._free_size.remove(free_sector)
|
|
162
|
-
free_sector = Sector(free_sector.start, sector.stop)
|
|
163
|
-
self._stop = sector.stop
|
|
164
|
-
else:
|
|
165
|
-
raise NoValidSector(
|
|
166
|
-
"The sector is outside the defined region and the region is not resizable."
|
|
167
|
-
)
|
|
168
|
-
else:
|
|
169
|
-
raise NoValidSector("The requested sector is not free to be reserved.")
|
|
170
|
-
|
|
171
|
-
# split around the reserved sector
|
|
172
|
-
sectors = free_sector.split(sector)
|
|
173
|
-
# add the results back
|
|
174
|
-
self._free_start[index:index] = sectors
|
|
175
|
-
for s in sectors:
|
|
176
|
-
self._add_size_sector(s)
|
|
177
|
-
self._reserved.add(sector)
|
|
178
|
-
|
|
179
|
-
def _add_size_sector(self, sector: Sector) -> None:
|
|
180
|
-
self._free_size.insert(
|
|
181
|
-
bisect_left(
|
|
182
|
-
self._free_size,
|
|
183
|
-
(sector.length, sector.start),
|
|
184
|
-
key=lambda k: (k.length, k.start),
|
|
185
|
-
),
|
|
186
|
-
sector,
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
def free(self, sector: Sector) -> None:
|
|
190
|
-
"""
|
|
191
|
-
Free a reserved sector.
|
|
192
|
-
The sector must match exactly a sector previously reserved.
|
|
193
|
-
|
|
194
|
-
:param sector: The sector to free
|
|
195
|
-
"""
|
|
196
|
-
with self._lock:
|
|
197
|
-
if sector not in self._reserved:
|
|
198
|
-
raise ValueError("Sector was not reserved")
|
|
199
|
-
# remove the sector from the reserved storage
|
|
200
|
-
self._reserved.remove(sector)
|
|
201
|
-
|
|
202
|
-
# Add it back to the free storage
|
|
203
|
-
# find the position where it would be placed in the list ordered by start location
|
|
204
|
-
index = bisect_right(self._free_start, sector.start, key=lambda k: k.start)
|
|
205
|
-
|
|
206
|
-
# merge with the right neighbour
|
|
207
|
-
if (
|
|
208
|
-
index < len(self._free_start)
|
|
209
|
-
and self._free_start[index].start == sector.stop
|
|
210
|
-
):
|
|
211
|
-
right_sector = self._free_start.pop(index)
|
|
212
|
-
self._free_size.remove(right_sector)
|
|
213
|
-
sector = Sector(sector.start, right_sector.stop)
|
|
214
|
-
|
|
215
|
-
# merge with the left neighbour
|
|
216
|
-
if index > 0 and self._free_start[index - 1].stop == sector.start:
|
|
217
|
-
left_sector = self._free_start.pop(index - 1)
|
|
218
|
-
self._free_size.remove(left_sector)
|
|
219
|
-
sector = Sector(left_sector.start, sector.stop)
|
|
220
|
-
index -= 1
|
|
221
|
-
|
|
222
|
-
self._free_start.insert(index, sector)
|
|
223
|
-
self._add_size_sector(sector)
|
amulet/level/java/chunk.pyi
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import amulet.biome
|
|
4
|
-
import amulet.block
|
|
5
|
-
import amulet.chunk
|
|
6
|
-
import amulet.chunk_components
|
|
7
|
-
import amulet.level.java.chunk_components
|
|
8
|
-
|
|
9
|
-
__all__ = [
|
|
10
|
-
"JavaChunk",
|
|
11
|
-
"JavaChunk0",
|
|
12
|
-
"JavaChunk1444",
|
|
13
|
-
"JavaChunk1466",
|
|
14
|
-
"JavaChunk2203",
|
|
15
|
-
"JavaChunkNA",
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
class JavaChunk(amulet.chunk.Chunk):
|
|
19
|
-
pass
|
|
20
|
-
|
|
21
|
-
class JavaChunk0(
|
|
22
|
-
JavaChunk,
|
|
23
|
-
amulet.level.java.chunk_components.JavaRawChunkComponent,
|
|
24
|
-
amulet.level.java.chunk_components.DataVersionComponent,
|
|
25
|
-
amulet.chunk_components.BlockComponent,
|
|
26
|
-
):
|
|
27
|
-
def __init__(
|
|
28
|
-
self,
|
|
29
|
-
data_version: int,
|
|
30
|
-
default_block: amulet.block.BlockStack,
|
|
31
|
-
default_biome: amulet.biome.Biome,
|
|
32
|
-
) -> None: ...
|
|
33
|
-
|
|
34
|
-
class JavaChunk1444(
|
|
35
|
-
JavaChunk,
|
|
36
|
-
amulet.level.java.chunk_components.JavaRawChunkComponent,
|
|
37
|
-
amulet.level.java.chunk_components.DataVersionComponent,
|
|
38
|
-
amulet.chunk_components.BlockComponent,
|
|
39
|
-
):
|
|
40
|
-
def __init__(
|
|
41
|
-
self,
|
|
42
|
-
data_version: int,
|
|
43
|
-
default_block: amulet.block.BlockStack,
|
|
44
|
-
default_biome: amulet.biome.Biome,
|
|
45
|
-
) -> None: ...
|
|
46
|
-
|
|
47
|
-
class JavaChunk1466(
|
|
48
|
-
JavaChunk,
|
|
49
|
-
amulet.level.java.chunk_components.JavaRawChunkComponent,
|
|
50
|
-
amulet.level.java.chunk_components.DataVersionComponent,
|
|
51
|
-
amulet.chunk_components.BlockComponent,
|
|
52
|
-
):
|
|
53
|
-
def __init__(
|
|
54
|
-
self,
|
|
55
|
-
data_version: int,
|
|
56
|
-
default_block: amulet.block.BlockStack,
|
|
57
|
-
default_biome: amulet.biome.Biome,
|
|
58
|
-
) -> None: ...
|
|
59
|
-
|
|
60
|
-
class JavaChunk2203(
|
|
61
|
-
JavaChunk,
|
|
62
|
-
amulet.level.java.chunk_components.JavaRawChunkComponent,
|
|
63
|
-
amulet.level.java.chunk_components.DataVersionComponent,
|
|
64
|
-
amulet.chunk_components.BlockComponent,
|
|
65
|
-
):
|
|
66
|
-
def __init__(
|
|
67
|
-
self,
|
|
68
|
-
data_version: int,
|
|
69
|
-
default_block: amulet.block.BlockStack,
|
|
70
|
-
default_biome: amulet.biome.Biome,
|
|
71
|
-
) -> None: ...
|
|
72
|
-
|
|
73
|
-
class JavaChunkNA(
|
|
74
|
-
JavaChunk,
|
|
75
|
-
amulet.level.java.chunk_components.JavaRawChunkComponent,
|
|
76
|
-
amulet.level.java.chunk_components.DataVersionComponent,
|
|
77
|
-
amulet.chunk_components.BlockComponent,
|
|
78
|
-
):
|
|
79
|
-
def __init__(
|
|
80
|
-
self, default_block: amulet.block.BlockStack, default_biome: amulet.biome.Biome
|
|
81
|
-
) -> None: ...
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
# from typing import Self, TypeAlias, cast
|
|
2
|
-
# from types import UnionType
|
|
3
|
-
#
|
|
4
|
-
# import numpy
|
|
5
|
-
#
|
|
6
|
-
# from amulet.version import VersionRange, VersionNumber
|
|
7
|
-
# from amulet.block import BlockStack, Block
|
|
8
|
-
# from amulet.biome import Biome
|
|
9
|
-
#
|
|
10
|
-
# from amulet.chunk import Chunk, ComponentDataMapping
|
|
11
|
-
# from amulet.chunk.components.height_2d import Height2DComponent
|
|
12
|
-
# from amulet.chunk.components.biome import (
|
|
13
|
-
# Biome2DComponent,
|
|
14
|
-
# Biome2DComponentData,
|
|
15
|
-
# Biome3DComponent,
|
|
16
|
-
# Biome3DComponentData,
|
|
17
|
-
# )
|
|
18
|
-
# from amulet.chunk.components.block import BlockComponent, BlockComponentData
|
|
19
|
-
# from amulet.chunk.components.block_entity import (
|
|
20
|
-
# BlockEntityComponent,
|
|
21
|
-
# BlockEntityComponentData,
|
|
22
|
-
# )
|
|
23
|
-
# from amulet.chunk.components.entity import EntityComponent, EntityComponentData
|
|
24
|
-
# from amulet.level.java.chunk.components.raw_chunk import RawChunkComponent
|
|
25
|
-
# from amulet.level.java.chunk.components.data_version import DataVersionComponent
|
|
26
|
-
# from amulet.level.java.chunk.components.legacy_version import LegacyVersionComponent
|
|
27
|
-
# from amulet.level.java.chunk.components.status import StatusComponent
|
|
28
|
-
# from amulet.level.java.chunk.components.light_populated import LightPopulatedComponent
|
|
29
|
-
# from amulet.level.java.chunk.components.terrain_populated import (
|
|
30
|
-
# TerrainPopulatedComponent,
|
|
31
|
-
# )
|
|
32
|
-
# from amulet.level.java.chunk.components.named_height_2d import (
|
|
33
|
-
# NamedHeight2DComponent,
|
|
34
|
-
# NamedHeight2DData,
|
|
35
|
-
# )
|
|
36
|
-
# from amulet.level.java.chunk.components.last_update import LastUpdateComponent
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
# def _get_components(
|
|
40
|
-
# data_version: int, default_block: BlockStack, default_biome: Biome
|
|
41
|
-
# ) -> ComponentDataMapping:
|
|
42
|
-
# components: ComponentDataMapping = {} # type: ignore
|
|
43
|
-
#
|
|
44
|
-
# version_range = VersionRange(
|
|
45
|
-
# "java", VersionNumber(data_version), VersionNumber(data_version)
|
|
46
|
-
# )
|
|
47
|
-
#
|
|
48
|
-
# components[RawChunkComponent] = None
|
|
49
|
-
# components[DataVersionComponent] = data_version
|
|
50
|
-
# components[LastUpdateComponent] = 0
|
|
51
|
-
#
|
|
52
|
-
# if data_version == -1:
|
|
53
|
-
# components[LegacyVersionComponent] = 1
|
|
54
|
-
# if data_version >= 3454:
|
|
55
|
-
# components[StatusComponent] = "minecraft:full"
|
|
56
|
-
# elif data_version >= 1912:
|
|
57
|
-
# components[StatusComponent] = "full"
|
|
58
|
-
# elif data_version >= 1444:
|
|
59
|
-
# components[StatusComponent] = "postprocessed"
|
|
60
|
-
# else:
|
|
61
|
-
# components[TerrainPopulatedComponent] = True
|
|
62
|
-
# components[LightPopulatedComponent] = True
|
|
63
|
-
#
|
|
64
|
-
# components[BlockComponent] = BlockComponentData(
|
|
65
|
-
# version_range, (16, 16, 16), default_block
|
|
66
|
-
# )
|
|
67
|
-
# components[BlockEntityComponent] = BlockEntityComponentData(version_range)
|
|
68
|
-
# components[EntityComponent] = EntityComponentData(version_range)
|
|
69
|
-
#
|
|
70
|
-
# if data_version >= 2203:
|
|
71
|
-
# components[Biome3DComponent] = Biome3DComponentData(
|
|
72
|
-
# version_range, (4, 4, 4), default_biome
|
|
73
|
-
# )
|
|
74
|
-
# else:
|
|
75
|
-
# components[Biome2DComponent] = Biome2DComponentData(
|
|
76
|
-
# version_range, (16, 16), default_biome
|
|
77
|
-
# )
|
|
78
|
-
#
|
|
79
|
-
# if data_version >= 1908:
|
|
80
|
-
# components[NamedHeight2DComponent] = NamedHeight2DData(
|
|
81
|
-
# (16, 16),
|
|
82
|
-
# {
|
|
83
|
-
# key: numpy.zeros((16, 16), dtype=numpy.int64)
|
|
84
|
-
# for key in (
|
|
85
|
-
# "WORLD_SURFACE_WG",
|
|
86
|
-
# "OCEAN_FLOOR_WG",
|
|
87
|
-
# "MOTION_BLOCKING",
|
|
88
|
-
# "MOTION_BLOCKING_NO_LEAVES",
|
|
89
|
-
# "OCEAN_FLOOR",
|
|
90
|
-
# "WORLD_SURFACE",
|
|
91
|
-
# )
|
|
92
|
-
# },
|
|
93
|
-
# )
|
|
94
|
-
# if data_version >= 1503:
|
|
95
|
-
# components[NamedHeight2DComponent] = NamedHeight2DData(
|
|
96
|
-
# (16, 16),
|
|
97
|
-
# {
|
|
98
|
-
# key: numpy.zeros((16, 16), dtype=numpy.int64)
|
|
99
|
-
# for key in (
|
|
100
|
-
# "WORLD_SURFACE_WG",
|
|
101
|
-
# "OCEAN_FLOOR_WG",
|
|
102
|
-
# "MOTION_BLOCKING",
|
|
103
|
-
# "MOTION_BLOCKING_NO_LEAVES",
|
|
104
|
-
# "OCEAN_FLOOR",
|
|
105
|
-
# "LIGHT_BLOCKING",
|
|
106
|
-
# "WORLD_SURFACE",
|
|
107
|
-
# )
|
|
108
|
-
# },
|
|
109
|
-
# )
|
|
110
|
-
# if data_version >= 1484:
|
|
111
|
-
# components[NamedHeight2DComponent] = NamedHeight2DData(
|
|
112
|
-
# (16, 16),
|
|
113
|
-
# {
|
|
114
|
-
# key: numpy.zeros((16, 16), dtype=numpy.int64)
|
|
115
|
-
# for key in (
|
|
116
|
-
# "WORLD_SURFACE_WG",
|
|
117
|
-
# "OCEAN_FLOOR_WG",
|
|
118
|
-
# "MOTION_BLOCKING",
|
|
119
|
-
# "MOTION_BLOCKING_NO_LEAVES",
|
|
120
|
-
# "OCEAN_FLOOR",
|
|
121
|
-
# "LIGHT_BLOCKING",
|
|
122
|
-
# )
|
|
123
|
-
# },
|
|
124
|
-
# )
|
|
125
|
-
# if data_version >= 1466:
|
|
126
|
-
# components[NamedHeight2DComponent] = NamedHeight2DData(
|
|
127
|
-
# (16, 16),
|
|
128
|
-
# {
|
|
129
|
-
# key: numpy.zeros((16, 16), dtype=numpy.int64)
|
|
130
|
-
# for key in ("LIQUID", "SOLID", "LIGHT", "RAIN")
|
|
131
|
-
# },
|
|
132
|
-
# )
|
|
133
|
-
# else:
|
|
134
|
-
# components[Height2DComponent] = numpy.zeros((16, 16), dtype=numpy.int64)
|
|
135
|
-
#
|
|
136
|
-
# return components
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
# class JavaChunkNA(Chunk):
|
|
140
|
-
# components = frozenset(
|
|
141
|
-
# _get_components(
|
|
142
|
-
# -1,
|
|
143
|
-
# BlockStack(Block("java", VersionNumber(-1), "", "")),
|
|
144
|
-
# Biome("java", VersionNumber(-1), "", ""),
|
|
145
|
-
# )
|
|
146
|
-
# )
|
|
147
|
-
#
|
|
148
|
-
# @classmethod
|
|
149
|
-
# def new(cls, default_block: BlockStack, default_biome: Biome) -> Self:
|
|
150
|
-
# self = cls.from_component_data(
|
|
151
|
-
# _get_components(-1, default_block, default_biome)
|
|
152
|
-
# )
|
|
153
|
-
# return self
|
|
154
|
-
#
|
|
155
|
-
#
|
|
156
|
-
# class JavaChunk0(Chunk):
|
|
157
|
-
# """Added DataVersion"""
|
|
158
|
-
#
|
|
159
|
-
# components = frozenset(
|
|
160
|
-
# _get_components(
|
|
161
|
-
# 0,
|
|
162
|
-
# BlockStack(Block("java", VersionNumber(0), "", "")),
|
|
163
|
-
# Biome("java", VersionNumber(0), "", ""),
|
|
164
|
-
# )
|
|
165
|
-
# )
|
|
166
|
-
#
|
|
167
|
-
# @classmethod
|
|
168
|
-
# def new(
|
|
169
|
-
# cls, data_version: int, default_block: BlockStack, default_biome: Biome
|
|
170
|
-
# ) -> Self:
|
|
171
|
-
# if not 0 <= data_version < 1444:
|
|
172
|
-
# raise ValueError("data version must be between 0 and 1443")
|
|
173
|
-
# self = cls.from_component_data(
|
|
174
|
-
# _get_components(data_version, default_block, default_biome)
|
|
175
|
-
# )
|
|
176
|
-
# return self
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
# class JavaChunk1444(Chunk):
|
|
180
|
-
# """
|
|
181
|
-
# Moved TerrainPopulated and LightPopulated to Status
|
|
182
|
-
# Made blocks paletted
|
|
183
|
-
# Added more tick tags
|
|
184
|
-
# Added structures tag
|
|
185
|
-
# """
|
|
186
|
-
#
|
|
187
|
-
# components = frozenset(
|
|
188
|
-
# _get_components(
|
|
189
|
-
# 1444,
|
|
190
|
-
# BlockStack(Block("java", VersionNumber(1444), "", "")),
|
|
191
|
-
# Biome("java", VersionNumber(1444), "", ""),
|
|
192
|
-
# )
|
|
193
|
-
# )
|
|
194
|
-
#
|
|
195
|
-
# @classmethod
|
|
196
|
-
# def new(
|
|
197
|
-
# cls, data_version: int, default_block: BlockStack, default_biome: Biome
|
|
198
|
-
# ) -> Self:
|
|
199
|
-
# if not 1444 <= data_version < 1466:
|
|
200
|
-
# raise ValueError("data version must be between 1444 and 1465")
|
|
201
|
-
# self = cls.from_component_data(
|
|
202
|
-
# _get_components(data_version, default_block, default_biome)
|
|
203
|
-
# )
|
|
204
|
-
# return self
|
|
205
|
-
#
|
|
206
|
-
#
|
|
207
|
-
# class JavaChunk1466(Chunk):
|
|
208
|
-
# """
|
|
209
|
-
# Added multiple height maps. Now stored in a compound.
|
|
210
|
-
# """
|
|
211
|
-
#
|
|
212
|
-
# components = frozenset(
|
|
213
|
-
# _get_components(
|
|
214
|
-
# 1466,
|
|
215
|
-
# BlockStack(Block("java", VersionNumber(1466), "", "")),
|
|
216
|
-
# Biome("java", VersionNumber(1466), "", ""),
|
|
217
|
-
# )
|
|
218
|
-
# )
|
|
219
|
-
#
|
|
220
|
-
# @classmethod
|
|
221
|
-
# def new(
|
|
222
|
-
# cls, data_version: int, default_block: BlockStack, default_biome: Biome
|
|
223
|
-
# ) -> Self:
|
|
224
|
-
# if not 1466 <= data_version < 2203:
|
|
225
|
-
# raise ValueError("data version must be between 1466 and 2202")
|
|
226
|
-
# self = cls.from_component_data(
|
|
227
|
-
# _get_components(data_version, default_block, default_biome)
|
|
228
|
-
# )
|
|
229
|
-
# return self
|
|
230
|
-
#
|
|
231
|
-
#
|
|
232
|
-
# class JavaChunk2203(Chunk):
|
|
233
|
-
# """
|
|
234
|
-
# Made biomes 3D
|
|
235
|
-
# """
|
|
236
|
-
#
|
|
237
|
-
# components = frozenset(
|
|
238
|
-
# _get_components(
|
|
239
|
-
# 2203,
|
|
240
|
-
# BlockStack(Block("java", VersionNumber(2203), "", "")),
|
|
241
|
-
# Biome("java", VersionNumber(2203), "", ""),
|
|
242
|
-
# )
|
|
243
|
-
# )
|
|
244
|
-
#
|
|
245
|
-
# @classmethod
|
|
246
|
-
# def new(
|
|
247
|
-
# cls, data_version: int, default_block: BlockStack, default_biome: Biome
|
|
248
|
-
# ) -> Self:
|
|
249
|
-
# if not 2203 <= data_version:
|
|
250
|
-
# raise ValueError("data version must be at least 2203")
|
|
251
|
-
# self = cls.from_component_data(
|
|
252
|
-
# _get_components(data_version, default_block, default_biome)
|
|
253
|
-
# )
|
|
254
|
-
# return self
|
|
255
|
-
#
|
|
256
|
-
#
|
|
257
|
-
# # TODO: Improve this if python/mypy#11673 gets fixed.
|
|
258
|
-
# JavaChunk: TypeAlias = cast(
|
|
259
|
-
# UnionType, JavaChunkNA | JavaChunk0 | JavaChunk1444 | JavaChunk1466 | JavaChunk2203
|
|
260
|
-
# )
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# from __future__ import annotations
|
|
2
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# class InhabitedTimeComponent(ChunkComponent[int, int]):
|
|
6
|
-
# storage_key = b"jit"
|
|
7
|
-
#
|
|
8
|
-
# @staticmethod
|
|
9
|
-
# def fix_set_data(old_obj: int, new_obj: int) -> int:
|
|
10
|
-
# if not isinstance(new_obj, int):
|
|
11
|
-
# raise TypeError
|
|
12
|
-
# return new_obj
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# from __future__ import annotations
|
|
2
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# class LastUpdateComponent(ChunkComponent[int, int]):
|
|
6
|
-
# storage_key = b"jlu"
|
|
7
|
-
#
|
|
8
|
-
# @staticmethod
|
|
9
|
-
# def fix_set_data(old_obj: int, new_obj: int) -> int:
|
|
10
|
-
# if not isinstance(new_obj, int):
|
|
11
|
-
# raise TypeError
|
|
12
|
-
# return new_obj
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# from __future__ import annotations
|
|
2
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# class LegacyVersionComponent(ChunkComponent[int, int]):
|
|
6
|
-
# storage_key = b"jlv"
|
|
7
|
-
#
|
|
8
|
-
# @staticmethod
|
|
9
|
-
# def fix_set_data(old_obj: int, new_obj: int) -> int:
|
|
10
|
-
# if not isinstance(new_obj, int):
|
|
11
|
-
# raise TypeError
|
|
12
|
-
# return new_obj
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# from __future__ import annotations
|
|
2
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# class LightPopulatedComponent(ChunkComponent[bool, bool]):
|
|
6
|
-
# storage_key = b"jtp"
|
|
7
|
-
#
|
|
8
|
-
# @staticmethod
|
|
9
|
-
# def fix_set_data(old_obj: bool, new_obj: bool) -> bool:
|
|
10
|
-
# if not isinstance(new_obj, bool):
|
|
11
|
-
# raise TypeError
|
|
12
|
-
# return new_obj
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# import numpy
|
|
2
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# class NamedHeight2DData:
|
|
6
|
-
# arrays: dict[str, numpy.ndarray]
|
|
7
|
-
#
|
|
8
|
-
# def __init__(
|
|
9
|
-
# self, shape: tuple[int, int], arrays: dict[str, numpy.ndarray]
|
|
10
|
-
# ) -> None:
|
|
11
|
-
# self._shape = shape
|
|
12
|
-
# self.arrays = arrays
|
|
13
|
-
#
|
|
14
|
-
# @property
|
|
15
|
-
# def shape(self) -> tuple[int, int]:
|
|
16
|
-
# return self._shape
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# class NamedHeight2DComponent(ChunkComponent[NamedHeight2DData, NamedHeight2DData]):
|
|
20
|
-
# storage_key = b"nh2d"
|
|
21
|
-
#
|
|
22
|
-
# @staticmethod
|
|
23
|
-
# def fix_set_data(
|
|
24
|
-
# old_obj: NamedHeight2DData, new_obj: NamedHeight2DData
|
|
25
|
-
# ) -> NamedHeight2DData:
|
|
26
|
-
# if not isinstance(new_obj, NamedHeight2DData):
|
|
27
|
-
# raise TypeError
|
|
28
|
-
# if new_obj.shape != old_obj.shape:
|
|
29
|
-
# raise ValueError
|
|
30
|
-
# for key, value in new_obj.arrays.items():
|
|
31
|
-
# if not isinstance(key, str):
|
|
32
|
-
# raise TypeError
|
|
33
|
-
# if not isinstance(value, numpy.ndarray):
|
|
34
|
-
# raise TypeError
|
|
35
|
-
# if value.shape != old_obj.shape:
|
|
36
|
-
# raise ValueError
|
|
37
|
-
# return new_obj
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# class StatusComponent(ChunkComponent[str, str]):
|
|
5
|
-
# storage_key = b"jst"
|
|
6
|
-
#
|
|
7
|
-
# @staticmethod
|
|
8
|
-
# def fix_set_data(old_obj: str, new_obj: str) -> str:
|
|
9
|
-
# if not isinstance(new_obj, str):
|
|
10
|
-
# raise TypeError
|
|
11
|
-
# return new_obj
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# from __future__ import annotations
|
|
2
|
-
# from amulet.chunk.components.abc import ChunkComponent
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# class TerrainPopulatedComponent(ChunkComponent[bool, bool]):
|
|
6
|
-
# storage_key = b"jtp"
|
|
7
|
-
#
|
|
8
|
-
# @staticmethod
|
|
9
|
-
# def fix_set_data(old_obj: bool, new_obj: bool) -> bool:
|
|
10
|
-
# if not isinstance(new_obj, bool):
|
|
11
|
-
# raise TypeError
|
|
12
|
-
# return new_obj
|