amulet-core 1.9.19__py3-none-any.whl → 1.9.20__py3-none-any.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/__init__.py +27 -27
- amulet/__pyinstaller/__init__.py +2 -2
- amulet/__pyinstaller/hook-amulet.py +4 -4
- amulet/_version.py +21 -21
- amulet/api/__init__.py +2 -2
- amulet/api/abstract_base_entity.py +128 -128
- amulet/api/block.py +630 -630
- amulet/api/block_entity.py +71 -71
- amulet/api/cache.py +107 -107
- amulet/api/chunk/__init__.py +6 -6
- amulet/api/chunk/biomes.py +207 -207
- amulet/api/chunk/block_entity_dict.py +175 -175
- amulet/api/chunk/blocks.py +46 -46
- amulet/api/chunk/chunk.py +389 -389
- amulet/api/chunk/entity_list.py +75 -75
- amulet/api/chunk/status.py +167 -167
- amulet/api/data_types/__init__.py +4 -4
- amulet/api/data_types/generic_types.py +4 -4
- amulet/api/data_types/operation_types.py +16 -16
- amulet/api/data_types/world_types.py +49 -49
- amulet/api/data_types/wrapper_types.py +71 -71
- amulet/api/entity.py +74 -74
- amulet/api/errors.py +119 -119
- amulet/api/history/__init__.py +36 -36
- amulet/api/history/base/__init__.py +3 -3
- amulet/api/history/base/base_history.py +26 -26
- amulet/api/history/base/history_manager.py +63 -63
- amulet/api/history/base/revision_manager.py +73 -73
- amulet/api/history/changeable.py +15 -15
- amulet/api/history/data_types.py +7 -7
- amulet/api/history/history_manager/__init__.py +3 -3
- amulet/api/history/history_manager/container.py +102 -102
- amulet/api/history/history_manager/database.py +279 -279
- amulet/api/history/history_manager/meta.py +93 -93
- amulet/api/history/history_manager/object.py +116 -116
- amulet/api/history/revision_manager/__init__.py +2 -2
- amulet/api/history/revision_manager/disk.py +33 -33
- amulet/api/history/revision_manager/ram.py +12 -12
- amulet/api/item.py +75 -75
- amulet/api/level/__init__.py +4 -4
- amulet/api/level/base_level/__init__.py +1 -1
- amulet/api/level/base_level/base_level.py +1035 -1026
- amulet/api/level/base_level/chunk_manager.py +227 -227
- amulet/api/level/base_level/clone.py +389 -389
- amulet/api/level/base_level/player_manager.py +101 -101
- amulet/api/level/immutable_structure/__init__.py +1 -1
- amulet/api/level/immutable_structure/immutable_structure.py +94 -94
- amulet/api/level/immutable_structure/void_format_wrapper.py +117 -117
- amulet/api/level/structure.py +22 -22
- amulet/api/level/world.py +19 -19
- amulet/api/partial_3d_array/__init__.py +2 -2
- amulet/api/partial_3d_array/base_partial_3d_array.py +263 -263
- amulet/api/partial_3d_array/bounded_partial_3d_array.py +528 -528
- amulet/api/partial_3d_array/data_types.py +15 -15
- amulet/api/partial_3d_array/unbounded_partial_3d_array.py +229 -229
- amulet/api/partial_3d_array/util.py +152 -152
- amulet/api/player.py +65 -65
- amulet/api/registry/__init__.py +2 -2
- amulet/api/registry/base_registry.py +34 -34
- amulet/api/registry/biome_manager.py +153 -153
- amulet/api/registry/block_manager.py +156 -156
- amulet/api/selection/__init__.py +2 -2
- amulet/api/selection/abstract_selection.py +315 -315
- amulet/api/selection/box.py +805 -805
- amulet/api/selection/group.py +488 -488
- amulet/api/structure.py +37 -37
- amulet/api/wrapper/__init__.py +8 -8
- amulet/api/wrapper/chunk/interface.py +441 -441
- amulet/api/wrapper/chunk/translator.py +567 -567
- amulet/api/wrapper/format_wrapper.py +772 -772
- amulet/api/wrapper/structure_format_wrapper.py +116 -116
- amulet/api/wrapper/world_format_wrapper.py +63 -63
- amulet/level/__init__.py +1 -1
- amulet/level/formats/anvil_forge_world.py +40 -40
- amulet/level/formats/anvil_world/__init__.py +3 -3
- amulet/level/formats/anvil_world/_sector_manager.py +291 -384
- amulet/level/formats/anvil_world/data_pack/__init__.py +2 -2
- amulet/level/formats/anvil_world/data_pack/data_pack.py +224 -224
- amulet/level/formats/anvil_world/data_pack/data_pack_manager.py +77 -77
- amulet/level/formats/anvil_world/dimension.py +177 -177
- amulet/level/formats/anvil_world/format.py +769 -769
- amulet/level/formats/anvil_world/region.py +384 -384
- amulet/level/formats/construction/__init__.py +3 -3
- amulet/level/formats/construction/format_wrapper.py +515 -515
- amulet/level/formats/construction/interface.py +134 -134
- amulet/level/formats/construction/section.py +60 -60
- amulet/level/formats/construction/util.py +165 -165
- amulet/level/formats/leveldb_world/__init__.py +3 -3
- amulet/level/formats/leveldb_world/chunk.py +33 -33
- amulet/level/formats/leveldb_world/dimension.py +385 -419
- amulet/level/formats/leveldb_world/format.py +659 -641
- amulet/level/formats/leveldb_world/interface/chunk/__init__.py +36 -36
- amulet/level/formats/leveldb_world/interface/chunk/base_leveldb_interface.py +836 -836
- amulet/level/formats/leveldb_world/interface/chunk/generate_interface.py +31 -31
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_0.py +30 -30
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_1.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_10.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_11.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_12.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_13.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_14.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_15.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_16.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_17.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_18.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_19.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_2.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_20.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_21.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_22.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_23.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_24.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_25.py +24 -24
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_26.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_27.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_28.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_29.py +33 -33
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_3.py +57 -57
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_30.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_31.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_32.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_33.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_34.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_35.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_36.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_37.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_38.py +10 -10
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_39.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_4.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_40.py +16 -16
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_5.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_6.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_7.py +12 -12
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_8.py +180 -180
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_9.py +18 -18
- amulet/level/formats/leveldb_world/interface/chunk/leveldb_chunk_versions.py +79 -79
- amulet/level/formats/mcstructure/__init__.py +3 -3
- amulet/level/formats/mcstructure/chunk.py +50 -50
- amulet/level/formats/mcstructure/format_wrapper.py +408 -408
- amulet/level/formats/mcstructure/interface.py +175 -175
- amulet/level/formats/schematic/__init__.py +3 -3
- amulet/level/formats/schematic/chunk.py +55 -55
- amulet/level/formats/schematic/data_types.py +4 -4
- amulet/level/formats/schematic/format_wrapper.py +373 -373
- amulet/level/formats/schematic/interface.py +142 -142
- amulet/level/formats/sponge_schem/__init__.py +4 -4
- amulet/level/formats/sponge_schem/chunk.py +62 -62
- amulet/level/formats/sponge_schem/format_wrapper.py +463 -463
- amulet/level/formats/sponge_schem/interface.py +118 -118
- amulet/level/formats/sponge_schem/varint/__init__.py +1 -1
- amulet/level/formats/sponge_schem/varint/varint.py +87 -87
- amulet/level/interfaces/chunk/anvil/anvil_0.py +72 -72
- amulet/level/interfaces/chunk/anvil/anvil_1444.py +336 -336
- amulet/level/interfaces/chunk/anvil/anvil_1466.py +94 -94
- amulet/level/interfaces/chunk/anvil/anvil_1467.py +37 -37
- amulet/level/interfaces/chunk/anvil/anvil_1484.py +20 -20
- amulet/level/interfaces/chunk/anvil/anvil_1503.py +20 -20
- amulet/level/interfaces/chunk/anvil/anvil_1519.py +34 -34
- amulet/level/interfaces/chunk/anvil/anvil_1901.py +20 -20
- amulet/level/interfaces/chunk/anvil/anvil_1908.py +20 -20
- amulet/level/interfaces/chunk/anvil/anvil_1912.py +21 -21
- amulet/level/interfaces/chunk/anvil/anvil_1934.py +20 -20
- amulet/level/interfaces/chunk/anvil/anvil_2203.py +69 -69
- amulet/level/interfaces/chunk/anvil/anvil_2529.py +19 -19
- amulet/level/interfaces/chunk/anvil/anvil_2681.py +76 -76
- amulet/level/interfaces/chunk/anvil/anvil_2709.py +19 -19
- amulet/level/interfaces/chunk/anvil/anvil_2844.py +267 -267
- amulet/level/interfaces/chunk/anvil/anvil_3463.py +19 -19
- amulet/level/interfaces/chunk/anvil/anvil_na.py +607 -607
- amulet/level/interfaces/chunk/anvil/base_anvil_interface.py +326 -326
- amulet/level/load.py +59 -59
- amulet/level/loader.py +95 -95
- amulet/level/translators/chunk/bedrock/__init__.py +267 -267
- amulet/level/translators/chunk/bedrock/bedrock_nbt_blockstate_translator.py +46 -46
- amulet/level/translators/chunk/bedrock/bedrock_numerical_translator.py +39 -39
- amulet/level/translators/chunk/bedrock/bedrock_psudo_numerical_translator.py +37 -37
- amulet/level/translators/chunk/java/java_1_18_translator.py +40 -40
- amulet/level/translators/chunk/java/java_blockstate_translator.py +94 -94
- amulet/level/translators/chunk/java/java_numerical_translator.py +62 -62
- amulet/libs/leveldb/__init__.py +7 -7
- amulet/operations/__init__.py +5 -5
- amulet/operations/clone.py +18 -18
- amulet/operations/delete_chunk.py +32 -32
- amulet/operations/fill.py +30 -30
- amulet/operations/paste.py +65 -65
- amulet/operations/replace.py +58 -58
- amulet/utils/__init__.py +14 -14
- amulet/utils/format_utils.py +41 -41
- amulet/utils/generator.py +15 -15
- amulet/utils/matrix.py +243 -243
- amulet/utils/numpy_helpers.py +46 -46
- amulet/utils/world_utils.py +349 -349
- {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/METADATA +97 -97
- amulet_core-1.9.20.dist-info/RECORD +208 -0
- amulet_core-1.9.19.dist-info/RECORD +0 -208
- {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/WHEEL +0 -0
- {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/entry_points.txt +0 -0
- {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/top_level.txt +0 -0
amulet/api/chunk/entity_list.py
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
from collections import UserList
|
|
2
|
-
from typing import Iterable
|
|
3
|
-
from amulet.api.entity import Entity
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ChunkList(UserList):
|
|
7
|
-
def __init__(self, iterable: Iterable = ()):
|
|
8
|
-
super().__init__(list(iterable))
|
|
9
|
-
|
|
10
|
-
def _check_all_types(self, value):
|
|
11
|
-
for val in value:
|
|
12
|
-
self._check_type(val)
|
|
13
|
-
|
|
14
|
-
def _check_type(self, value):
|
|
15
|
-
raise NotImplementedError
|
|
16
|
-
|
|
17
|
-
def append(self, value) -> None:
|
|
18
|
-
"""Append value to the end of the list."""
|
|
19
|
-
self._check_type(value)
|
|
20
|
-
super().append(value)
|
|
21
|
-
|
|
22
|
-
def copy(self) -> "ChunkList":
|
|
23
|
-
raise NotImplementedError
|
|
24
|
-
|
|
25
|
-
def extend(self, iterable: Iterable):
|
|
26
|
-
"""Extend list by appending elements from the iterable."""
|
|
27
|
-
self._check_all_types(iterable)
|
|
28
|
-
super().extend(iterable)
|
|
29
|
-
|
|
30
|
-
def insert(self, index: int, value):
|
|
31
|
-
"""Insert value before index."""
|
|
32
|
-
self._check_type(value)
|
|
33
|
-
super().insert(index, value)
|
|
34
|
-
|
|
35
|
-
def __repr__(self):
|
|
36
|
-
if not self:
|
|
37
|
-
return "[]"
|
|
38
|
-
return "[" + "".join(f"\n\t{str(obj)}" for obj in self) + "\n]"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class EntityList(ChunkList):
|
|
42
|
-
"""
|
|
43
|
-
A custom implementation of the list class.
|
|
44
|
-
|
|
45
|
-
It can only store :class:`Entity` instances.
|
|
46
|
-
"""
|
|
47
|
-
|
|
48
|
-
def __init__(self, entities: Iterable[Entity] = ()):
|
|
49
|
-
"""
|
|
50
|
-
Construct an :class:`EntityList`.
|
|
51
|
-
|
|
52
|
-
:param entities: An Iterable of :class:`Entity` objects.
|
|
53
|
-
"""
|
|
54
|
-
for e in entities:
|
|
55
|
-
self._check_type(e)
|
|
56
|
-
super().__init__(entities)
|
|
57
|
-
|
|
58
|
-
def _check_type(self, value):
|
|
59
|
-
assert isinstance(value, Entity), f"{value} is not an instance of Entity"
|
|
60
|
-
|
|
61
|
-
def copy(self) -> "EntityList":
|
|
62
|
-
"""
|
|
63
|
-
Create a shallow copy of the entity container.
|
|
64
|
-
"""
|
|
65
|
-
return EntityList(self)
|
|
66
|
-
|
|
67
|
-
def __iter__(self) -> Iterable[Entity]:
|
|
68
|
-
"""
|
|
69
|
-
An iterable of all the :class:`Entity` objects.
|
|
70
|
-
"""
|
|
71
|
-
yield from self.data
|
|
72
|
-
|
|
73
|
-
def __repr__(self) -> str:
|
|
74
|
-
"""Return repr(self)."""
|
|
75
|
-
return f"EntityList({super().__repr__()})"
|
|
1
|
+
from collections import UserList
|
|
2
|
+
from typing import Iterable
|
|
3
|
+
from amulet.api.entity import Entity
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ChunkList(UserList):
|
|
7
|
+
def __init__(self, iterable: Iterable = ()):
|
|
8
|
+
super().__init__(list(iterable))
|
|
9
|
+
|
|
10
|
+
def _check_all_types(self, value):
|
|
11
|
+
for val in value:
|
|
12
|
+
self._check_type(val)
|
|
13
|
+
|
|
14
|
+
def _check_type(self, value):
|
|
15
|
+
raise NotImplementedError
|
|
16
|
+
|
|
17
|
+
def append(self, value) -> None:
|
|
18
|
+
"""Append value to the end of the list."""
|
|
19
|
+
self._check_type(value)
|
|
20
|
+
super().append(value)
|
|
21
|
+
|
|
22
|
+
def copy(self) -> "ChunkList":
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
|
|
25
|
+
def extend(self, iterable: Iterable):
|
|
26
|
+
"""Extend list by appending elements from the iterable."""
|
|
27
|
+
self._check_all_types(iterable)
|
|
28
|
+
super().extend(iterable)
|
|
29
|
+
|
|
30
|
+
def insert(self, index: int, value):
|
|
31
|
+
"""Insert value before index."""
|
|
32
|
+
self._check_type(value)
|
|
33
|
+
super().insert(index, value)
|
|
34
|
+
|
|
35
|
+
def __repr__(self):
|
|
36
|
+
if not self:
|
|
37
|
+
return "[]"
|
|
38
|
+
return "[" + "".join(f"\n\t{str(obj)}" for obj in self) + "\n]"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class EntityList(ChunkList):
|
|
42
|
+
"""
|
|
43
|
+
A custom implementation of the list class.
|
|
44
|
+
|
|
45
|
+
It can only store :class:`Entity` instances.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def __init__(self, entities: Iterable[Entity] = ()):
|
|
49
|
+
"""
|
|
50
|
+
Construct an :class:`EntityList`.
|
|
51
|
+
|
|
52
|
+
:param entities: An Iterable of :class:`Entity` objects.
|
|
53
|
+
"""
|
|
54
|
+
for e in entities:
|
|
55
|
+
self._check_type(e)
|
|
56
|
+
super().__init__(entities)
|
|
57
|
+
|
|
58
|
+
def _check_type(self, value):
|
|
59
|
+
assert isinstance(value, Entity), f"{value} is not an instance of Entity"
|
|
60
|
+
|
|
61
|
+
def copy(self) -> "EntityList":
|
|
62
|
+
"""
|
|
63
|
+
Create a shallow copy of the entity container.
|
|
64
|
+
"""
|
|
65
|
+
return EntityList(self)
|
|
66
|
+
|
|
67
|
+
def __iter__(self) -> Iterable[Entity]:
|
|
68
|
+
"""
|
|
69
|
+
An iterable of all the :class:`Entity` objects.
|
|
70
|
+
"""
|
|
71
|
+
yield from self.data
|
|
72
|
+
|
|
73
|
+
def __repr__(self) -> str:
|
|
74
|
+
"""Return repr(self)."""
|
|
75
|
+
return f"EntityList({super().__repr__()})"
|
amulet/api/chunk/status.py
CHANGED
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
from typing import Union, Dict, List, Tuple
|
|
2
|
-
from enum import Enum
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
log = logging.getLogger(__name__)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class StatusFormats(Enum):
|
|
9
|
-
"""
|
|
10
|
-
The different formats the status value can be converted to.
|
|
11
|
-
|
|
12
|
-
>>> StatusFormats.Raw # The raw float value
|
|
13
|
-
>>> StatusFormats.Bedrock # as an integer between 0 and 2
|
|
14
|
-
>>> StatusFormats.Java_13 # as a string
|
|
15
|
-
>>> StatusFormats.Java_14 # as a string
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
Raw = 0 # The raw float value
|
|
19
|
-
Bedrock = 1 # as an integer between 0 and 2
|
|
20
|
-
Java_13 = 2 # as a string
|
|
21
|
-
Java_14 = 3 # as a string
|
|
22
|
-
Java_20 = 20 # as a string
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
J13 = StatusFormats.Java_13
|
|
26
|
-
J14 = StatusFormats.Java_14
|
|
27
|
-
J20 = StatusFormats.Java_20
|
|
28
|
-
|
|
29
|
-
states = {
|
|
30
|
-
"empty": [[J13, J14], -1],
|
|
31
|
-
"minecraft:empty": [[J20], -1],
|
|
32
|
-
"structure_starts": [[J14], -0.9],
|
|
33
|
-
"minecraft:structure_starts": [[J20], -0.9],
|
|
34
|
-
"structure_references": [[J14], -0.8],
|
|
35
|
-
"minecraft:structure_references": [[J20], -0.8],
|
|
36
|
-
"biomes": [[J14], -0.7],
|
|
37
|
-
"minecraft:biomes": [[J20], -0.7],
|
|
38
|
-
"noise": [[J14], -0.6],
|
|
39
|
-
"minecraft:noise": [[J20], -0.6],
|
|
40
|
-
"base": [[J13], -0.5],
|
|
41
|
-
"surface": [[J14], -0.5],
|
|
42
|
-
"minecraft:surface": [[J20], -0.5],
|
|
43
|
-
"carved": [[J13], -0.4],
|
|
44
|
-
"carvers": [[J14], -0.4],
|
|
45
|
-
"minecraft:carvers": [[J20], -0.4],
|
|
46
|
-
"liquid_carved": [[J13], -0.3],
|
|
47
|
-
"liquid_carvers": [[J14], -0.3],
|
|
48
|
-
"decorated": [[J13], -0.2],
|
|
49
|
-
"features": [[J14], -0.2],
|
|
50
|
-
"minecraft:features": [[J20], -0.2],
|
|
51
|
-
"lighted": [[J13], -0.1],
|
|
52
|
-
"minecraft:initialize_light": [[J20], -0.1],
|
|
53
|
-
"light": [[J14], -0.1],
|
|
54
|
-
"minecraft:light": [[J20], -0.1],
|
|
55
|
-
# 0.0 needs ticked
|
|
56
|
-
# 1.0 needs population
|
|
57
|
-
"mobs_spawned": [[J13], 1.1],
|
|
58
|
-
"spawn": [[J14], 1.1],
|
|
59
|
-
"minecraft:spawn": [[J20], 1.1],
|
|
60
|
-
"finalized": [[J13], 1.5],
|
|
61
|
-
"heightmaps": [[J14], 1.5],
|
|
62
|
-
"fullchunk": [[J13], 1.9],
|
|
63
|
-
"postprocessed": [[J13], 2.0],
|
|
64
|
-
"full": [[J14], 2.0],
|
|
65
|
-
"minecraft:full": [[J20], 2.0],
|
|
66
|
-
# 2.0 done
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
versions: Dict[StatusFormats, List[Tuple[float, str]]] = {}
|
|
70
|
-
for key, val in states.items():
|
|
71
|
-
for version_ in val[0]:
|
|
72
|
-
versions.setdefault(version_, []).append((val[1], key))
|
|
73
|
-
for data in versions.values():
|
|
74
|
-
data.sort(key=lambda val_: val_[0], reverse=True)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
class Status:
|
|
78
|
-
"""
|
|
79
|
-
A class to represent the generation state of a chunk.
|
|
80
|
-
|
|
81
|
-
This stores the chunk status as a float in the range -1 to 2 where -1 is nothing generated and 2 being fully generated.
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
def __init__(self):
|
|
85
|
-
"""
|
|
86
|
-
Construct an instance of the :class:`Status` class.
|
|
87
|
-
"""
|
|
88
|
-
self._value = 2.0
|
|
89
|
-
|
|
90
|
-
@property
|
|
91
|
-
def value(self) -> float:
|
|
92
|
-
"""
|
|
93
|
-
**Getter**
|
|
94
|
-
|
|
95
|
-
Get the raw status value.
|
|
96
|
-
|
|
97
|
-
>>> status = chunk.status.value
|
|
98
|
-
|
|
99
|
-
:return: The float status value in the range -1 to 2
|
|
100
|
-
|
|
101
|
-
**Setter**
|
|
102
|
-
|
|
103
|
-
Set the status value.
|
|
104
|
-
|
|
105
|
-
>>> chunk.status.value = 2
|
|
106
|
-
>>> chunk.status.value = "full"
|
|
107
|
-
|
|
108
|
-
This can be a float/int or a string. If it is a string it is looked up in the states look up table to find the float value it corresponds with.
|
|
109
|
-
|
|
110
|
-
:param value: The value to set as the generation stage.
|
|
111
|
-
"""
|
|
112
|
-
return self._value
|
|
113
|
-
|
|
114
|
-
@value.setter
|
|
115
|
-
def value(self, value: Union[float, int, str]):
|
|
116
|
-
"""
|
|
117
|
-
Set the status value.
|
|
118
|
-
|
|
119
|
-
>>> chunk.status.value = 2
|
|
120
|
-
>>> chunk.status.value = "full"
|
|
121
|
-
|
|
122
|
-
This can be a float/int or a string. If it is a string it is looked up in the states look up table to find the float value it corresponds with.
|
|
123
|
-
|
|
124
|
-
:param value: The value to set as the generation stage.
|
|
125
|
-
"""
|
|
126
|
-
if isinstance(value, float):
|
|
127
|
-
self._value = value
|
|
128
|
-
elif isinstance(value, int):
|
|
129
|
-
self._value = float(value)
|
|
130
|
-
elif isinstance(value, str) and value in states:
|
|
131
|
-
self._value = states[value][1]
|
|
132
|
-
else:
|
|
133
|
-
log.error(
|
|
134
|
-
f"Unrecognised chunk state {value}. Defaulting to fully generated.\nIf this is a new version report it to the developers."
|
|
135
|
-
)
|
|
136
|
-
self._value = 2.0
|
|
137
|
-
|
|
138
|
-
def as_type(self, status_format: StatusFormats) -> Union[int, float, str]:
|
|
139
|
-
"""
|
|
140
|
-
Get the generation state in a given format.
|
|
141
|
-
|
|
142
|
-
>>> chunk.status.as_type(StatusFormats.Raw)
|
|
143
|
-
2.0
|
|
144
|
-
>>> chunk.status.as_type(StatusFormats.Bedrock)
|
|
145
|
-
2
|
|
146
|
-
>>> chunk.status.as_type(StatusFormats.Java_14)
|
|
147
|
-
'full'
|
|
148
|
-
|
|
149
|
-
:param status_format: The format the status should be returned in. Must be from :class:`StatusFormats`.
|
|
150
|
-
:return: The status code in the requested format.
|
|
151
|
-
"""
|
|
152
|
-
if not isinstance(status_format, StatusFormats):
|
|
153
|
-
raise ValueError("Version must be one of the states of StatusFormats")
|
|
154
|
-
|
|
155
|
-
if status_format == StatusFormats.Raw:
|
|
156
|
-
return self._value
|
|
157
|
-
elif status_format == StatusFormats.Bedrock: # Bedrock (0, 1 or 2)
|
|
158
|
-
return int(max(min(2, self._value), 0))
|
|
159
|
-
elif status_format in versions: # Java 1.13/1.14
|
|
160
|
-
value = next(
|
|
161
|
-
(v for v in versions[status_format] if v[0] <= self._value), None
|
|
162
|
-
)
|
|
163
|
-
if value is None:
|
|
164
|
-
value = next((v for v in versions[status_format] if v[0] <= 2.0), None)
|
|
165
|
-
return value[1]
|
|
166
|
-
else:
|
|
167
|
-
raise ValueError(f"Unsupported status format {status_format}")
|
|
1
|
+
from typing import Union, Dict, List, Tuple
|
|
2
|
+
from enum import Enum
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
log = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class StatusFormats(Enum):
|
|
9
|
+
"""
|
|
10
|
+
The different formats the status value can be converted to.
|
|
11
|
+
|
|
12
|
+
>>> StatusFormats.Raw # The raw float value
|
|
13
|
+
>>> StatusFormats.Bedrock # as an integer between 0 and 2
|
|
14
|
+
>>> StatusFormats.Java_13 # as a string
|
|
15
|
+
>>> StatusFormats.Java_14 # as a string
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
Raw = 0 # The raw float value
|
|
19
|
+
Bedrock = 1 # as an integer between 0 and 2
|
|
20
|
+
Java_13 = 2 # as a string
|
|
21
|
+
Java_14 = 3 # as a string
|
|
22
|
+
Java_20 = 20 # as a string
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
J13 = StatusFormats.Java_13
|
|
26
|
+
J14 = StatusFormats.Java_14
|
|
27
|
+
J20 = StatusFormats.Java_20
|
|
28
|
+
|
|
29
|
+
states = {
|
|
30
|
+
"empty": [[J13, J14], -1],
|
|
31
|
+
"minecraft:empty": [[J20], -1],
|
|
32
|
+
"structure_starts": [[J14], -0.9],
|
|
33
|
+
"minecraft:structure_starts": [[J20], -0.9],
|
|
34
|
+
"structure_references": [[J14], -0.8],
|
|
35
|
+
"minecraft:structure_references": [[J20], -0.8],
|
|
36
|
+
"biomes": [[J14], -0.7],
|
|
37
|
+
"minecraft:biomes": [[J20], -0.7],
|
|
38
|
+
"noise": [[J14], -0.6],
|
|
39
|
+
"minecraft:noise": [[J20], -0.6],
|
|
40
|
+
"base": [[J13], -0.5],
|
|
41
|
+
"surface": [[J14], -0.5],
|
|
42
|
+
"minecraft:surface": [[J20], -0.5],
|
|
43
|
+
"carved": [[J13], -0.4],
|
|
44
|
+
"carvers": [[J14], -0.4],
|
|
45
|
+
"minecraft:carvers": [[J20], -0.4],
|
|
46
|
+
"liquid_carved": [[J13], -0.3],
|
|
47
|
+
"liquid_carvers": [[J14], -0.3],
|
|
48
|
+
"decorated": [[J13], -0.2],
|
|
49
|
+
"features": [[J14], -0.2],
|
|
50
|
+
"minecraft:features": [[J20], -0.2],
|
|
51
|
+
"lighted": [[J13], -0.1],
|
|
52
|
+
"minecraft:initialize_light": [[J20], -0.1],
|
|
53
|
+
"light": [[J14], -0.1],
|
|
54
|
+
"minecraft:light": [[J20], -0.1],
|
|
55
|
+
# 0.0 needs ticked
|
|
56
|
+
# 1.0 needs population
|
|
57
|
+
"mobs_spawned": [[J13], 1.1],
|
|
58
|
+
"spawn": [[J14], 1.1],
|
|
59
|
+
"minecraft:spawn": [[J20], 1.1],
|
|
60
|
+
"finalized": [[J13], 1.5],
|
|
61
|
+
"heightmaps": [[J14], 1.5],
|
|
62
|
+
"fullchunk": [[J13], 1.9],
|
|
63
|
+
"postprocessed": [[J13], 2.0],
|
|
64
|
+
"full": [[J14], 2.0],
|
|
65
|
+
"minecraft:full": [[J20], 2.0],
|
|
66
|
+
# 2.0 done
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
versions: Dict[StatusFormats, List[Tuple[float, str]]] = {}
|
|
70
|
+
for key, val in states.items():
|
|
71
|
+
for version_ in val[0]:
|
|
72
|
+
versions.setdefault(version_, []).append((val[1], key))
|
|
73
|
+
for data in versions.values():
|
|
74
|
+
data.sort(key=lambda val_: val_[0], reverse=True)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class Status:
|
|
78
|
+
"""
|
|
79
|
+
A class to represent the generation state of a chunk.
|
|
80
|
+
|
|
81
|
+
This stores the chunk status as a float in the range -1 to 2 where -1 is nothing generated and 2 being fully generated.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def __init__(self):
|
|
85
|
+
"""
|
|
86
|
+
Construct an instance of the :class:`Status` class.
|
|
87
|
+
"""
|
|
88
|
+
self._value = 2.0
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def value(self) -> float:
|
|
92
|
+
"""
|
|
93
|
+
**Getter**
|
|
94
|
+
|
|
95
|
+
Get the raw status value.
|
|
96
|
+
|
|
97
|
+
>>> status = chunk.status.value
|
|
98
|
+
|
|
99
|
+
:return: The float status value in the range -1 to 2
|
|
100
|
+
|
|
101
|
+
**Setter**
|
|
102
|
+
|
|
103
|
+
Set the status value.
|
|
104
|
+
|
|
105
|
+
>>> chunk.status.value = 2
|
|
106
|
+
>>> chunk.status.value = "full"
|
|
107
|
+
|
|
108
|
+
This can be a float/int or a string. If it is a string it is looked up in the states look up table to find the float value it corresponds with.
|
|
109
|
+
|
|
110
|
+
:param value: The value to set as the generation stage.
|
|
111
|
+
"""
|
|
112
|
+
return self._value
|
|
113
|
+
|
|
114
|
+
@value.setter
|
|
115
|
+
def value(self, value: Union[float, int, str]):
|
|
116
|
+
"""
|
|
117
|
+
Set the status value.
|
|
118
|
+
|
|
119
|
+
>>> chunk.status.value = 2
|
|
120
|
+
>>> chunk.status.value = "full"
|
|
121
|
+
|
|
122
|
+
This can be a float/int or a string. If it is a string it is looked up in the states look up table to find the float value it corresponds with.
|
|
123
|
+
|
|
124
|
+
:param value: The value to set as the generation stage.
|
|
125
|
+
"""
|
|
126
|
+
if isinstance(value, float):
|
|
127
|
+
self._value = value
|
|
128
|
+
elif isinstance(value, int):
|
|
129
|
+
self._value = float(value)
|
|
130
|
+
elif isinstance(value, str) and value in states:
|
|
131
|
+
self._value = states[value][1]
|
|
132
|
+
else:
|
|
133
|
+
log.error(
|
|
134
|
+
f"Unrecognised chunk state {value}. Defaulting to fully generated.\nIf this is a new version report it to the developers."
|
|
135
|
+
)
|
|
136
|
+
self._value = 2.0
|
|
137
|
+
|
|
138
|
+
def as_type(self, status_format: StatusFormats) -> Union[int, float, str]:
|
|
139
|
+
"""
|
|
140
|
+
Get the generation state in a given format.
|
|
141
|
+
|
|
142
|
+
>>> chunk.status.as_type(StatusFormats.Raw)
|
|
143
|
+
2.0
|
|
144
|
+
>>> chunk.status.as_type(StatusFormats.Bedrock)
|
|
145
|
+
2
|
|
146
|
+
>>> chunk.status.as_type(StatusFormats.Java_14)
|
|
147
|
+
'full'
|
|
148
|
+
|
|
149
|
+
:param status_format: The format the status should be returned in. Must be from :class:`StatusFormats`.
|
|
150
|
+
:return: The status code in the requested format.
|
|
151
|
+
"""
|
|
152
|
+
if not isinstance(status_format, StatusFormats):
|
|
153
|
+
raise ValueError("Version must be one of the states of StatusFormats")
|
|
154
|
+
|
|
155
|
+
if status_format == StatusFormats.Raw:
|
|
156
|
+
return self._value
|
|
157
|
+
elif status_format == StatusFormats.Bedrock: # Bedrock (0, 1 or 2)
|
|
158
|
+
return int(max(min(2, self._value), 0))
|
|
159
|
+
elif status_format in versions: # Java 1.13/1.14
|
|
160
|
+
value = next(
|
|
161
|
+
(v for v in versions[status_format] if v[0] <= self._value), None
|
|
162
|
+
)
|
|
163
|
+
if value is None:
|
|
164
|
+
value = next((v for v in versions[status_format] if v[0] <= 2.0), None)
|
|
165
|
+
return value[1]
|
|
166
|
+
else:
|
|
167
|
+
raise ValueError(f"Unsupported status format {status_format}")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .world_types import *
|
|
2
|
-
from .wrapper_types import *
|
|
3
|
-
from .operation_types import *
|
|
4
|
-
from .generic_types import *
|
|
1
|
+
from .world_types import *
|
|
2
|
+
from .wrapper_types import *
|
|
3
|
+
from .operation_types import *
|
|
4
|
+
from .generic_types import *
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Union
|
|
2
|
-
from numpy import integer
|
|
3
|
-
|
|
4
|
-
Int = Union[int, integer]
|
|
1
|
+
from typing import Union
|
|
2
|
+
from numpy import integer
|
|
3
|
+
|
|
4
|
+
Int = Union[int, integer]
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
from typing import Any, Union, Generator, Callable, Tuple, TYPE_CHECKING, Optional
|
|
2
|
-
|
|
3
|
-
if TYPE_CHECKING:
|
|
4
|
-
from amulet.api.level import BaseLevel
|
|
5
|
-
from .world_types import Dimension
|
|
6
|
-
|
|
7
|
-
# Operation types
|
|
8
|
-
|
|
9
|
-
#: The data type that an operation is able to yield.
|
|
10
|
-
OperationYieldType = Union[int, float, Tuple[Union[int, float], str]]
|
|
11
|
-
|
|
12
|
-
#: The data type that an operation is able to return.
|
|
13
|
-
OperationReturnType = Optional[Union[Generator[OperationYieldType, None, Any], Any]]
|
|
14
|
-
|
|
15
|
-
#: The data type for an operation callable object.
|
|
16
|
-
OperationType = Callable[["BaseLevel", "Dimension", Any], OperationReturnType]
|
|
1
|
+
from typing import Any, Union, Generator, Callable, Tuple, TYPE_CHECKING, Optional
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
from amulet.api.level import BaseLevel
|
|
5
|
+
from .world_types import Dimension
|
|
6
|
+
|
|
7
|
+
# Operation types
|
|
8
|
+
|
|
9
|
+
#: The data type that an operation is able to yield.
|
|
10
|
+
OperationYieldType = Union[int, float, Tuple[Union[int, float], str]]
|
|
11
|
+
|
|
12
|
+
#: The data type that an operation is able to return.
|
|
13
|
+
OperationReturnType = Optional[Union[Generator[OperationYieldType, None, Any], Any]]
|
|
14
|
+
|
|
15
|
+
#: The data type for an operation callable object.
|
|
16
|
+
OperationType = Callable[["BaseLevel", "Dimension", Any], OperationReturnType]
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
from typing import Union, Tuple
|
|
2
|
-
import numpy
|
|
3
|
-
|
|
4
|
-
# from nptyping import NDArray
|
|
5
|
-
|
|
6
|
-
#: The data type for a Tuple containing three floats. Use :data:`PointCoordinates` for x, y, z float coordinates.
|
|
7
|
-
FloatTriplet = Tuple[float, float, float]
|
|
8
|
-
|
|
9
|
-
#: The data type for the dimension identifier.
|
|
10
|
-
Dimension = str
|
|
11
|
-
|
|
12
|
-
#: The data type for the x and z coordinates of a region file. Note these are no the same as block coordinates.
|
|
13
|
-
RegionCoordinates = Tuple[int, int]
|
|
14
|
-
|
|
15
|
-
#: The data type for the x and z coordinate of a chunk. Note these are no the same as block coordinates.
|
|
16
|
-
ChunkCoordinates = Tuple[int, int]
|
|
17
|
-
|
|
18
|
-
#: The data type for the x, y and z coordinates of a sub-chunk within the world. Note these are no the same as block coordinates.
|
|
19
|
-
SubChunkCoordinates = Tuple[int, int, int]
|
|
20
|
-
|
|
21
|
-
#: The data type for the dimension and x and z coordinates of a chunk within a world. Note these are no the same as block coordinates.
|
|
22
|
-
DimensionCoordinates = Tuple[Dimension, int, int]
|
|
23
|
-
|
|
24
|
-
#: The data type for the x, y and z location of a block within the world.
|
|
25
|
-
BlockCoordinates = Tuple[int, int, int]
|
|
26
|
-
|
|
27
|
-
#: The data type for the x, y and z location of a block within the world in the form of a numpy array.
|
|
28
|
-
BlockCoordinatesNDArray = numpy.ndarray # NDArray[(3, ), int]
|
|
29
|
-
|
|
30
|
-
#: The data type for the x, y and z location of a block within the world in either tuple or numpy array form.
|
|
31
|
-
BlockCoordinatesAny = Union[BlockCoordinates, BlockCoordinatesNDArray]
|
|
32
|
-
|
|
33
|
-
#: The data type for the x, y and z location of a point within the world.
|
|
34
|
-
PointCoordinates = FloatTriplet
|
|
35
|
-
|
|
36
|
-
#: The data type for the x, y and z location of a point within the world in the form of a numpy array.
|
|
37
|
-
PointCoordinatesNDArray = numpy.ndarray # NDArray[(3, ), numpy.float]
|
|
38
|
-
|
|
39
|
-
#: The data type for the x, y and z location of a point within the world in either tuple or numpy array form.
|
|
40
|
-
PointCoordinatesAny = Union[PointCoordinates, PointCoordinatesNDArray]
|
|
41
|
-
|
|
42
|
-
#: The data type for x, y and z location in either float or int and tuple or numpy array format.
|
|
43
|
-
CoordinatesAny = Union[BlockCoordinatesAny, PointCoordinatesAny]
|
|
44
|
-
|
|
45
|
-
#: The data type for a sub-chunk array. This array should be a 16x16x16 numpy array.
|
|
46
|
-
SubChunkNDArray = numpy.ndarray # NDArray[(16, 16, 16), numpy.uint32]
|
|
47
|
-
|
|
48
|
-
#: The data type for a biome string identifier.
|
|
49
|
-
BiomeType = str
|
|
1
|
+
from typing import Union, Tuple
|
|
2
|
+
import numpy
|
|
3
|
+
|
|
4
|
+
# from nptyping import NDArray
|
|
5
|
+
|
|
6
|
+
#: The data type for a Tuple containing three floats. Use :data:`PointCoordinates` for x, y, z float coordinates.
|
|
7
|
+
FloatTriplet = Tuple[float, float, float]
|
|
8
|
+
|
|
9
|
+
#: The data type for the dimension identifier.
|
|
10
|
+
Dimension = str
|
|
11
|
+
|
|
12
|
+
#: The data type for the x and z coordinates of a region file. Note these are no the same as block coordinates.
|
|
13
|
+
RegionCoordinates = Tuple[int, int]
|
|
14
|
+
|
|
15
|
+
#: The data type for the x and z coordinate of a chunk. Note these are no the same as block coordinates.
|
|
16
|
+
ChunkCoordinates = Tuple[int, int]
|
|
17
|
+
|
|
18
|
+
#: The data type for the x, y and z coordinates of a sub-chunk within the world. Note these are no the same as block coordinates.
|
|
19
|
+
SubChunkCoordinates = Tuple[int, int, int]
|
|
20
|
+
|
|
21
|
+
#: The data type for the dimension and x and z coordinates of a chunk within a world. Note these are no the same as block coordinates.
|
|
22
|
+
DimensionCoordinates = Tuple[Dimension, int, int]
|
|
23
|
+
|
|
24
|
+
#: The data type for the x, y and z location of a block within the world.
|
|
25
|
+
BlockCoordinates = Tuple[int, int, int]
|
|
26
|
+
|
|
27
|
+
#: The data type for the x, y and z location of a block within the world in the form of a numpy array.
|
|
28
|
+
BlockCoordinatesNDArray = numpy.ndarray # NDArray[(3, ), int]
|
|
29
|
+
|
|
30
|
+
#: The data type for the x, y and z location of a block within the world in either tuple or numpy array form.
|
|
31
|
+
BlockCoordinatesAny = Union[BlockCoordinates, BlockCoordinatesNDArray]
|
|
32
|
+
|
|
33
|
+
#: The data type for the x, y and z location of a point within the world.
|
|
34
|
+
PointCoordinates = FloatTriplet
|
|
35
|
+
|
|
36
|
+
#: The data type for the x, y and z location of a point within the world in the form of a numpy array.
|
|
37
|
+
PointCoordinatesNDArray = numpy.ndarray # NDArray[(3, ), numpy.float]
|
|
38
|
+
|
|
39
|
+
#: The data type for the x, y and z location of a point within the world in either tuple or numpy array form.
|
|
40
|
+
PointCoordinatesAny = Union[PointCoordinates, PointCoordinatesNDArray]
|
|
41
|
+
|
|
42
|
+
#: The data type for x, y and z location in either float or int and tuple or numpy array format.
|
|
43
|
+
CoordinatesAny = Union[BlockCoordinatesAny, PointCoordinatesAny]
|
|
44
|
+
|
|
45
|
+
#: The data type for a sub-chunk array. This array should be a 16x16x16 numpy array.
|
|
46
|
+
SubChunkNDArray = numpy.ndarray # NDArray[(16, 16, 16), numpy.uint32]
|
|
47
|
+
|
|
48
|
+
#: The data type for a biome string identifier.
|
|
49
|
+
BiomeType = str
|