amulet-core 2.0a8__cp311-cp311-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a0__cp311-cp311-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.cp311-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.0a0.dist-info}/METADATA +25 -20
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/RECORD +45 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/WHEEL +1 -1
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/entry_points.txt +2 -0
- amulet/__init__.cp311-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.0a0.dist-info}/top_level.txt +0 -0
amulet/level/abc/_registry.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from typing import overload
|
|
2
|
-
from collections.abc import Mapping, Iterator
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class IdRegistry(Mapping[int, tuple[str, str]]):
|
|
6
|
-
def __init__(self) -> None:
|
|
7
|
-
self._str_to_int: dict[tuple[str, str], int] = {}
|
|
8
|
-
self._int_to_str: dict[int, tuple[str, str]] = {}
|
|
9
|
-
|
|
10
|
-
def numerical_id_to_namespace_id(self, index: int) -> tuple[str, str]:
|
|
11
|
-
return self._int_to_str[index]
|
|
12
|
-
|
|
13
|
-
def namespace_id_to_numerical_id(self, namespace: str, base_name: str) -> int:
|
|
14
|
-
return self._str_to_int[(namespace, base_name)]
|
|
15
|
-
|
|
16
|
-
def register(self, index: int, block_id: tuple[str, str]) -> None:
|
|
17
|
-
if block_id in self._str_to_int:
|
|
18
|
-
raise RuntimeError(f"id {block_id} has already been registered")
|
|
19
|
-
if index in self._int_to_str:
|
|
20
|
-
raise RuntimeError(f"index {index} has already been registered")
|
|
21
|
-
self._str_to_int[block_id] = index
|
|
22
|
-
self._int_to_str[index] = block_id
|
|
23
|
-
|
|
24
|
-
@overload
|
|
25
|
-
def __getitem__(self, key: int) -> tuple[str, str]: ...
|
|
26
|
-
|
|
27
|
-
@overload
|
|
28
|
-
def __getitem__(self, key: tuple[str, str]) -> int: ...
|
|
29
|
-
|
|
30
|
-
def __getitem__(self, key: int | tuple[str, str]) -> int | tuple[str, str]:
|
|
31
|
-
if isinstance(key, int):
|
|
32
|
-
return self._int_to_str[key]
|
|
33
|
-
else:
|
|
34
|
-
return self._str_to_int[key]
|
|
35
|
-
|
|
36
|
-
def __len__(self) -> int:
|
|
37
|
-
return len(self._int_to_str)
|
|
38
|
-
|
|
39
|
-
def __iter__(self) -> Iterator[int]:
|
|
40
|
-
yield from self._int_to_str
|
amulet/level/java/__init__.pyi
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from amulet.level.java._level import JavaLevel
|
|
4
|
-
|
|
5
|
-
from . import (
|
|
6
|
-
_chunk_handle,
|
|
7
|
-
_dimension,
|
|
8
|
-
_level,
|
|
9
|
-
_raw,
|
|
10
|
-
anvil,
|
|
11
|
-
chunk,
|
|
12
|
-
chunk_components,
|
|
13
|
-
long_array,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
__all__ = ["JavaLevel", "anvil", "chunk", "chunk_components", "long_array"]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
3
|
-
|
|
4
|
-
from amulet.level.abc import ChunkHandle
|
|
5
|
-
from ..abc._chunk_handle import ChunkT
|
|
6
|
-
from .chunk import JavaChunk
|
|
7
|
-
|
|
8
|
-
if TYPE_CHECKING:
|
|
9
|
-
from ._level import JavaLevel
|
|
10
|
-
from ._raw import JavaRawDimension
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class JavaChunkHandle(ChunkHandle["JavaLevel", "JavaRawDimension", JavaChunk]):
|
|
14
|
-
@staticmethod
|
|
15
|
-
def _validate_chunk(chunk: ChunkT) -> None:
|
|
16
|
-
if not isinstance(chunk, JavaChunk):
|
|
17
|
-
raise TypeError
|
amulet/level/java/_dimension.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING
|
|
2
|
-
|
|
3
|
-
from amulet.level.abc import Dimension
|
|
4
|
-
from ._chunk_handle import JavaChunkHandle
|
|
5
|
-
|
|
6
|
-
if TYPE_CHECKING:
|
|
7
|
-
from ._level import JavaLevel
|
|
8
|
-
from ._raw import JavaRawDimension
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class JavaDimension(Dimension["JavaLevel", "JavaRawDimension", JavaChunkHandle]):
|
|
12
|
-
def _create_chunk_handle(self, cx: int, cz: int) -> JavaChunkHandle:
|
|
13
|
-
return JavaChunkHandle(
|
|
14
|
-
self._l_ref,
|
|
15
|
-
self._chunk_history,
|
|
16
|
-
self._chunk_data_history,
|
|
17
|
-
self.dimension_id,
|
|
18
|
-
cx,
|
|
19
|
-
cz,
|
|
20
|
-
)
|
amulet/level/java/_level.py
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Any, Type, Callable
|
|
4
|
-
import os
|
|
5
|
-
import logging
|
|
6
|
-
|
|
7
|
-
from PIL import Image
|
|
8
|
-
from amulet_nbt import (
|
|
9
|
-
read_nbt,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
from amulet.data_types import DimensionId
|
|
13
|
-
from amulet.level.abc import (
|
|
14
|
-
DiskLevel,
|
|
15
|
-
CreatableLevel,
|
|
16
|
-
LoadableLevel,
|
|
17
|
-
CompactableLevel,
|
|
18
|
-
LevelOpenData,
|
|
19
|
-
PlayerStorage,
|
|
20
|
-
)
|
|
21
|
-
from amulet.utils.call_spec import (
|
|
22
|
-
StringArg,
|
|
23
|
-
IntArg,
|
|
24
|
-
CallableArg,
|
|
25
|
-
BoolArg,
|
|
26
|
-
DirectoryPathArg,
|
|
27
|
-
PositionalArgs,
|
|
28
|
-
method_spec,
|
|
29
|
-
)
|
|
30
|
-
from amulet.utils.weakref import DetachableWeakRef
|
|
31
|
-
from amulet.level import register_level_class
|
|
32
|
-
from amulet.version import VersionNumber, PlatformType
|
|
33
|
-
|
|
34
|
-
from ._dimension import JavaDimension
|
|
35
|
-
from ._raw import JavaCreateArgsV1, JavaRawLevel, InternalDimensionId
|
|
36
|
-
from amulet.chunk import Chunk
|
|
37
|
-
|
|
38
|
-
log = logging.getLogger(__name__)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class JavaLevelOpenData(LevelOpenData):
|
|
42
|
-
back_reference: Callable[[], JavaLevel | None]
|
|
43
|
-
detach_back_reference: Callable[[], None]
|
|
44
|
-
dimensions: dict[DimensionId | InternalDimensionId, JavaDimension]
|
|
45
|
-
|
|
46
|
-
def __init__(self, level: JavaLevel) -> None:
|
|
47
|
-
super().__init__()
|
|
48
|
-
self.back_reference, self.detach_back_reference = DetachableWeakRef.new(level)
|
|
49
|
-
self.dimensions = {}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class JavaLevel(
|
|
53
|
-
DiskLevel[JavaLevelOpenData, JavaDimension, JavaRawLevel],
|
|
54
|
-
CreatableLevel,
|
|
55
|
-
LoadableLevel,
|
|
56
|
-
CompactableLevel,
|
|
57
|
-
):
|
|
58
|
-
__slots__ = ("_raw_level",)
|
|
59
|
-
|
|
60
|
-
def __init__(self, _ikwiad: bool = False) -> None:
|
|
61
|
-
if not _ikwiad:
|
|
62
|
-
raise RuntimeError(
|
|
63
|
-
"BedrockRawLevel must be constructed using the create or load classmethod."
|
|
64
|
-
)
|
|
65
|
-
super().__init__()
|
|
66
|
-
|
|
67
|
-
def __init(self, raw: JavaRawLevel) -> None:
|
|
68
|
-
self._raw_level = raw
|
|
69
|
-
self._raw_level.opened.connect(self.open)
|
|
70
|
-
self._raw_level.closed.connect(self.close)
|
|
71
|
-
|
|
72
|
-
@classmethod
|
|
73
|
-
@method_spec(
|
|
74
|
-
CallableArg(
|
|
75
|
-
JavaCreateArgsV1,
|
|
76
|
-
BoolArg(True),
|
|
77
|
-
DirectoryPathArg(),
|
|
78
|
-
CallableArg(
|
|
79
|
-
VersionNumber,
|
|
80
|
-
PositionalArgs(IntArg(min_value=0), (IntArg(1), IntArg(20))),
|
|
81
|
-
),
|
|
82
|
-
StringArg("New World"),
|
|
83
|
-
)
|
|
84
|
-
)
|
|
85
|
-
def create(cls, args: JavaCreateArgsV1) -> JavaLevel:
|
|
86
|
-
raw = JavaRawLevel.create(args)
|
|
87
|
-
self = cls(True)
|
|
88
|
-
self.__init(raw)
|
|
89
|
-
return self
|
|
90
|
-
|
|
91
|
-
@staticmethod
|
|
92
|
-
def can_load(token: Any) -> bool:
|
|
93
|
-
if (
|
|
94
|
-
isinstance(token, str)
|
|
95
|
-
and os.path.isdir(token)
|
|
96
|
-
and os.path.isfile(os.path.join(token, "level.dat"))
|
|
97
|
-
):
|
|
98
|
-
try:
|
|
99
|
-
level_dat_root = read_nbt(os.path.join(token, "level.dat")).compound
|
|
100
|
-
except Exception:
|
|
101
|
-
pass
|
|
102
|
-
else:
|
|
103
|
-
return "Data" in level_dat_root and "FML" not in level_dat_root
|
|
104
|
-
return False
|
|
105
|
-
|
|
106
|
-
@classmethod
|
|
107
|
-
def load(cls, path: str) -> JavaLevel:
|
|
108
|
-
raw = JavaRawLevel.load(path)
|
|
109
|
-
self = cls(True)
|
|
110
|
-
self.__init(raw)
|
|
111
|
-
return self
|
|
112
|
-
|
|
113
|
-
def reload(self) -> None:
|
|
114
|
-
self.raw.reload()
|
|
115
|
-
|
|
116
|
-
def _open(self) -> None:
|
|
117
|
-
self.raw.open()
|
|
118
|
-
self._open_data = JavaLevelOpenData(self)
|
|
119
|
-
|
|
120
|
-
def _close(self) -> None:
|
|
121
|
-
self._o.detach_back_reference()
|
|
122
|
-
self._open_data = None
|
|
123
|
-
self.raw.close()
|
|
124
|
-
|
|
125
|
-
def save(self) -> None:
|
|
126
|
-
raise NotImplementedError
|
|
127
|
-
|
|
128
|
-
@property
|
|
129
|
-
def platform(self) -> PlatformType:
|
|
130
|
-
return self.raw.platform
|
|
131
|
-
|
|
132
|
-
@property
|
|
133
|
-
def max_game_version(self) -> VersionNumber:
|
|
134
|
-
return self.raw.data_version
|
|
135
|
-
|
|
136
|
-
@property
|
|
137
|
-
def level_name(self) -> str:
|
|
138
|
-
return self.raw.level_name
|
|
139
|
-
|
|
140
|
-
@property
|
|
141
|
-
def modified_time(self) -> float:
|
|
142
|
-
return self.raw.modified_time
|
|
143
|
-
|
|
144
|
-
@property
|
|
145
|
-
def path(self) -> str:
|
|
146
|
-
return self.raw.path
|
|
147
|
-
|
|
148
|
-
@property
|
|
149
|
-
def thumbnail(self) -> Image.Image:
|
|
150
|
-
try:
|
|
151
|
-
return Image.open(os.path.join(self.path, "icon.png"))
|
|
152
|
-
except Exception:
|
|
153
|
-
return super().thumbnail
|
|
154
|
-
|
|
155
|
-
def dimension_ids(self) -> frozenset[DimensionId]:
|
|
156
|
-
return self.raw.dimension_ids()
|
|
157
|
-
|
|
158
|
-
def get_dimension(
|
|
159
|
-
self, dimension_id: DimensionId | InternalDimensionId
|
|
160
|
-
) -> JavaDimension:
|
|
161
|
-
if dimension_id not in self._o.dimensions:
|
|
162
|
-
raw_dimension = self.raw.get_dimension(dimension_id)
|
|
163
|
-
self._o.dimensions[raw_dimension.dimension_id] = self._o.dimensions[
|
|
164
|
-
raw_dimension.relative_path
|
|
165
|
-
] = JavaDimension(self._o.back_reference, raw_dimension.dimension_id)
|
|
166
|
-
return self._o.dimensions[dimension_id]
|
|
167
|
-
|
|
168
|
-
@property
|
|
169
|
-
def player(self) -> PlayerStorage:
|
|
170
|
-
raise NotImplementedError
|
|
171
|
-
|
|
172
|
-
@property
|
|
173
|
-
def native_chunk_class(self) -> Type[Chunk]:
|
|
174
|
-
raise NotImplementedError
|
|
175
|
-
|
|
176
|
-
@property
|
|
177
|
-
def raw(self) -> JavaRawLevel:
|
|
178
|
-
return self._raw_level
|
|
179
|
-
|
|
180
|
-
def compact(self) -> None:
|
|
181
|
-
self.raw.compact()
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
register_level_class(JavaLevel)
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from builtins import str as InternalDimensionId
|
|
4
|
-
|
|
5
|
-
from amulet.level.java._raw._dimension import JavaRawDimension
|
|
6
|
-
from amulet.level.java._raw._level import JavaCreateArgsV1, JavaRawLevel
|
|
7
|
-
|
|
8
|
-
from . import _chunk, _constant, _data_pack, _dimension, _level, _typing
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"InternalDimensionId",
|
|
12
|
-
"JavaCreateArgsV1",
|
|
13
|
-
"JavaRawDimension",
|
|
14
|
-
"JavaRawLevel",
|
|
15
|
-
]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import amulet.level.java.chunk
|
|
6
|
-
import amulet_nbt
|
|
7
|
-
|
|
8
|
-
__all__ = ["decode_chunk", "encode_chunk"]
|
|
9
|
-
|
|
10
|
-
def decode_chunk(
|
|
11
|
-
arg0: typing.Any,
|
|
12
|
-
arg1: typing.Any,
|
|
13
|
-
arg2: dict[str, amulet_nbt.NamedTag],
|
|
14
|
-
arg3: int,
|
|
15
|
-
arg4: int,
|
|
16
|
-
) -> amulet.level.java.chunk.JavaChunk: ...
|
|
17
|
-
def encode_chunk(
|
|
18
|
-
arg0: typing.Any,
|
|
19
|
-
arg1: typing.Any,
|
|
20
|
-
arg2: amulet.level.java.chunk.JavaChunk,
|
|
21
|
-
arg3: int,
|
|
22
|
-
arg4: int,
|
|
23
|
-
) -> dict[str, amulet_nbt.NamedTag]: ...
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from amulet.selection import SelectionBox, SelectionGroup
|
|
2
|
-
|
|
3
|
-
OVERWORLD = "minecraft:overworld"
|
|
4
|
-
THE_NETHER = "minecraft:the_nether"
|
|
5
|
-
THE_END = "minecraft:the_end"
|
|
6
|
-
|
|
7
|
-
DefaultSelection = SelectionGroup(
|
|
8
|
-
SelectionBox((-30_000_000, 0, -30_000_000), (30_000_000, 256, 30_000_000))
|
|
9
|
-
)
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from abc import ABC, abstractmethod
|
|
3
|
-
from typing import Iterable, Protocol
|
|
4
|
-
from types import TracebackType
|
|
5
|
-
import os
|
|
6
|
-
import json
|
|
7
|
-
from zipfile import ZipFile
|
|
8
|
-
import re
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Readable(Protocol):
|
|
12
|
-
def read(self, n: int = -1) -> bytes: ...
|
|
13
|
-
|
|
14
|
-
def __enter__(self) -> Readable: ...
|
|
15
|
-
|
|
16
|
-
def __exit__(
|
|
17
|
-
self,
|
|
18
|
-
exc_type: type[BaseException] | None,
|
|
19
|
-
exc_val: BaseException | None,
|
|
20
|
-
exc_tb: TracebackType | None,
|
|
21
|
-
) -> None: ...
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class BaseWrapper(ABC):
|
|
25
|
-
def __init__(self, path: str):
|
|
26
|
-
self._path = path
|
|
27
|
-
|
|
28
|
-
@staticmethod
|
|
29
|
-
@abstractmethod
|
|
30
|
-
def is_valid(path: str) -> bool:
|
|
31
|
-
"""
|
|
32
|
-
Is the given path valid for this class.
|
|
33
|
-
|
|
34
|
-
:param path: The path to test.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
@property
|
|
38
|
-
def path(self) -> str:
|
|
39
|
-
"""The path to the data."""
|
|
40
|
-
return self._path
|
|
41
|
-
|
|
42
|
-
@property
|
|
43
|
-
@abstractmethod
|
|
44
|
-
def all_files(self) -> Iterable[str]:
|
|
45
|
-
"""
|
|
46
|
-
The relative paths of all files contained within.
|
|
47
|
-
|
|
48
|
-
:return: An iterable of paths.
|
|
49
|
-
"""
|
|
50
|
-
raise NotImplementedError
|
|
51
|
-
|
|
52
|
-
def all_files_match(self, match: str) -> Iterable[str]:
|
|
53
|
-
"""
|
|
54
|
-
The relative paths of all files contained within that match the given regex.
|
|
55
|
-
|
|
56
|
-
:param match: The regex string to match again.
|
|
57
|
-
:return: An iterable of file paths that match the given regex.
|
|
58
|
-
"""
|
|
59
|
-
re_match = re.compile(match)
|
|
60
|
-
return tuple(path for path in self.all_files if re_match.fullmatch(path))
|
|
61
|
-
|
|
62
|
-
@abstractmethod
|
|
63
|
-
def has_file(self, relative_path: str) -> bool:
|
|
64
|
-
"""
|
|
65
|
-
Does the requested file exist.
|
|
66
|
-
|
|
67
|
-
:param relative_path:
|
|
68
|
-
:return:
|
|
69
|
-
"""
|
|
70
|
-
raise NotImplementedError
|
|
71
|
-
|
|
72
|
-
@abstractmethod
|
|
73
|
-
def open(self, relative_path: str) -> Readable:
|
|
74
|
-
"""
|
|
75
|
-
Get the contents of the file.
|
|
76
|
-
|
|
77
|
-
:param relative_path:
|
|
78
|
-
:return:
|
|
79
|
-
"""
|
|
80
|
-
raise NotImplementedError
|
|
81
|
-
|
|
82
|
-
@abstractmethod
|
|
83
|
-
def close(self) -> None:
|
|
84
|
-
"""Close the contents."""
|
|
85
|
-
raise NotImplementedError
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class ZipWrapper(BaseWrapper):
|
|
89
|
-
def __init__(self, path: str):
|
|
90
|
-
BaseWrapper.__init__(self, path)
|
|
91
|
-
self._zip_file = ZipFile(path)
|
|
92
|
-
|
|
93
|
-
@staticmethod
|
|
94
|
-
def is_valid(path: str) -> bool:
|
|
95
|
-
return os.path.isfile(path) and path.endswith(".zip")
|
|
96
|
-
|
|
97
|
-
@property
|
|
98
|
-
def all_files(self) -> Iterable[str]:
|
|
99
|
-
for path in self._zip_file.NameToInfo:
|
|
100
|
-
if not path.endswith("/"):
|
|
101
|
-
yield path
|
|
102
|
-
|
|
103
|
-
def has_file(self, relative_path: str) -> bool:
|
|
104
|
-
if relative_path.endswith("/"):
|
|
105
|
-
# is a directory
|
|
106
|
-
return False
|
|
107
|
-
else:
|
|
108
|
-
return relative_path in self._zip_file.NameToInfo
|
|
109
|
-
|
|
110
|
-
def open(self, name: str) -> Readable:
|
|
111
|
-
return self._zip_file.open(name)
|
|
112
|
-
|
|
113
|
-
def close(self) -> None:
|
|
114
|
-
self._zip_file.close()
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
class DirWrapper(BaseWrapper):
|
|
118
|
-
def __init__(self, path: str):
|
|
119
|
-
BaseWrapper.__init__(self, path)
|
|
120
|
-
|
|
121
|
-
@staticmethod
|
|
122
|
-
def is_valid(path: str) -> bool:
|
|
123
|
-
return os.path.isdir(path)
|
|
124
|
-
|
|
125
|
-
@property
|
|
126
|
-
def all_files(self) -> Iterable[str]:
|
|
127
|
-
for abs_path, _, files in os.walk(self.path):
|
|
128
|
-
rel_path = os.path.normpath(os.path.relpath(abs_path, self.path)).replace(
|
|
129
|
-
os.sep, "/"
|
|
130
|
-
)
|
|
131
|
-
if rel_path == ".":
|
|
132
|
-
yield from files
|
|
133
|
-
else:
|
|
134
|
-
for f in files:
|
|
135
|
-
yield f"{rel_path}/{f}"
|
|
136
|
-
|
|
137
|
-
def has_file(self, relative_path: str) -> bool:
|
|
138
|
-
return os.path.isfile(os.path.join(self.path, relative_path))
|
|
139
|
-
|
|
140
|
-
def open(self, relative_path: str) -> Readable:
|
|
141
|
-
return open(os.path.join(self.path, relative_path), "rb")
|
|
142
|
-
|
|
143
|
-
def close(self) -> None:
|
|
144
|
-
pass
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def _open_wrapper(path: str) -> BaseWrapper:
|
|
148
|
-
for cls in (ZipWrapper, DirWrapper):
|
|
149
|
-
if cls.is_valid(path):
|
|
150
|
-
return cls(path)
|
|
151
|
-
raise FileNotFoundError(f"The given path {path} is not valid.")
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
class DataPack:
|
|
155
|
-
"""The DataPack class wraps a single data pack."""
|
|
156
|
-
|
|
157
|
-
def __init__(self, path: str):
|
|
158
|
-
self._path = path
|
|
159
|
-
self._wrapper = _open_wrapper(path)
|
|
160
|
-
self._is_valid = self.is_wrapper_valid(self._wrapper)
|
|
161
|
-
|
|
162
|
-
@property
|
|
163
|
-
def path(self) -> str:
|
|
164
|
-
"""The path to the data."""
|
|
165
|
-
return self._path
|
|
166
|
-
|
|
167
|
-
@staticmethod
|
|
168
|
-
def is_path_valid(path: str) -> bool:
|
|
169
|
-
"""
|
|
170
|
-
Check if the given path is a valid data pack.
|
|
171
|
-
|
|
172
|
-
:param path: The path to the data pack. Can be a zip file or directory.
|
|
173
|
-
:return: True if the path is a valid data pack, False otherwise.
|
|
174
|
-
"""
|
|
175
|
-
try:
|
|
176
|
-
wrapper = _open_wrapper(path)
|
|
177
|
-
except FileNotFoundError:
|
|
178
|
-
return False
|
|
179
|
-
is_valid = DataPack.is_wrapper_valid(wrapper)
|
|
180
|
-
wrapper.close()
|
|
181
|
-
return is_valid
|
|
182
|
-
|
|
183
|
-
@property
|
|
184
|
-
def is_valid(self) -> bool:
|
|
185
|
-
return self._is_valid
|
|
186
|
-
|
|
187
|
-
@staticmethod
|
|
188
|
-
def is_wrapper_valid(wrapper: BaseWrapper) -> bool:
|
|
189
|
-
if wrapper.has_file("pack.mcmeta"):
|
|
190
|
-
with wrapper.open("pack.mcmeta") as m:
|
|
191
|
-
try:
|
|
192
|
-
meta_file = json.load(m)
|
|
193
|
-
except json.JSONDecodeError:
|
|
194
|
-
pass
|
|
195
|
-
else:
|
|
196
|
-
if isinstance(meta_file, dict) and isinstance(
|
|
197
|
-
meta_file.get("pack", {}).get("pack_format", None), int
|
|
198
|
-
):
|
|
199
|
-
# TODO: check the actual value
|
|
200
|
-
return True
|
|
201
|
-
return False
|
|
202
|
-
|
|
203
|
-
@property
|
|
204
|
-
def all_files(self) -> Iterable[str]:
|
|
205
|
-
"""
|
|
206
|
-
The relative paths of all files contained within.
|
|
207
|
-
|
|
208
|
-
:return: An iterable of paths.
|
|
209
|
-
"""
|
|
210
|
-
return self._wrapper.all_files
|
|
211
|
-
|
|
212
|
-
def all_files_match(self, match: str) -> Iterable[str]:
|
|
213
|
-
"""
|
|
214
|
-
The relative paths of all files contained within that match the given regex.
|
|
215
|
-
|
|
216
|
-
:param match: The regex string to match again.
|
|
217
|
-
:return: An iterable of file paths that match the given regex.
|
|
218
|
-
"""
|
|
219
|
-
return self._wrapper.all_files_match(match)
|
|
220
|
-
|
|
221
|
-
def has_file(self, relative_path: str) -> bool:
|
|
222
|
-
"""
|
|
223
|
-
Does the requested file exist.
|
|
224
|
-
|
|
225
|
-
:param relative_path:
|
|
226
|
-
:return:
|
|
227
|
-
"""
|
|
228
|
-
return self._wrapper.has_file(relative_path)
|
|
229
|
-
|
|
230
|
-
def open(self, relative_path: str) -> Readable:
|
|
231
|
-
"""
|
|
232
|
-
Get the contents of the file.
|
|
233
|
-
|
|
234
|
-
:param relative_path:
|
|
235
|
-
:return:
|
|
236
|
-
"""
|
|
237
|
-
return self._wrapper.open(relative_path)
|
|
238
|
-
|
|
239
|
-
def close(self) -> None:
|
|
240
|
-
"""Close the contents."""
|
|
241
|
-
self._wrapper.close()
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
from typing import Iterable
|
|
2
|
-
from .data_pack import DataPack, Readable
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class DataPackManager:
|
|
6
|
-
"""
|
|
7
|
-
The DataPackManager class contains one or more data packs.
|
|
8
|
-
It manages loading them so that the stacking order is maintained.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
def __init__(self, data_packs: Iterable[DataPack]):
|
|
12
|
-
"""
|
|
13
|
-
Construct a new DataPackManager class.
|
|
14
|
-
|
|
15
|
-
:param data_packs: The data packs to load from. Later in the list get higher priority.
|
|
16
|
-
"""
|
|
17
|
-
self._data_packs = tuple(
|
|
18
|
-
reversed(
|
|
19
|
-
tuple(
|
|
20
|
-
pack
|
|
21
|
-
for pack in data_packs
|
|
22
|
-
if isinstance(pack, DataPack) and pack.is_valid
|
|
23
|
-
)
|
|
24
|
-
)
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
@property
|
|
28
|
-
def all_files(self) -> Iterable[str]:
|
|
29
|
-
"""
|
|
30
|
-
The relative paths of all files contained within.
|
|
31
|
-
|
|
32
|
-
:return: An iterable of paths.
|
|
33
|
-
"""
|
|
34
|
-
all_files: set[str] = set()
|
|
35
|
-
for pack in self._data_packs:
|
|
36
|
-
all_files.update(pack.all_files)
|
|
37
|
-
return all_files
|
|
38
|
-
|
|
39
|
-
def all_files_match(self, match: str) -> Iterable[str]:
|
|
40
|
-
"""
|
|
41
|
-
The relative paths of all files contained within that match the given regex.
|
|
42
|
-
|
|
43
|
-
:param match: The regex string to match again.
|
|
44
|
-
:return: An iterable of file paths that match the given regex.
|
|
45
|
-
"""
|
|
46
|
-
all_files: set[str] = set()
|
|
47
|
-
for pack in self._data_packs:
|
|
48
|
-
all_files.update(pack.all_files_match(match))
|
|
49
|
-
return all_files
|
|
50
|
-
|
|
51
|
-
def has_file(self, relative_path: str) -> bool:
|
|
52
|
-
"""
|
|
53
|
-
Does the requested file exist.
|
|
54
|
-
|
|
55
|
-
:param relative_path:
|
|
56
|
-
:return:
|
|
57
|
-
"""
|
|
58
|
-
return any(pack.has_file(relative_path) for pack in self._data_packs)
|
|
59
|
-
|
|
60
|
-
def open(self, relative_path: str) -> Readable:
|
|
61
|
-
"""
|
|
62
|
-
Get the contents of the file.
|
|
63
|
-
|
|
64
|
-
:param relative_path:
|
|
65
|
-
:return:
|
|
66
|
-
"""
|
|
67
|
-
for pack in self._data_packs:
|
|
68
|
-
if pack.has_file(relative_path):
|
|
69
|
-
return pack.open(relative_path)
|
|
70
|
-
raise FileNotFoundError(
|
|
71
|
-
f"The requested path {relative_path} could not be found."
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
def close(self) -> None:
|
|
75
|
-
"""Close the contents."""
|
|
76
|
-
for pack in self._data_packs:
|
|
77
|
-
pack.close()
|