amulet-core 2.0a6__cp312-cp312-win_amd64.whl → 2.0a8__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.

Files changed (149) hide show
  1. amulet/__init__.cp312-win_amd64.pyd +0 -0
  2. amulet/__init__.py.cpp +6 -0
  3. amulet/__init__.pyi +2 -2
  4. amulet/_init.py +0 -2
  5. amulet/_version.py +3 -3
  6. amulet/biome.pyi +0 -2
  7. amulet/block.pyi +0 -2
  8. amulet/block_entity.pyi +0 -2
  9. amulet/chunk.hpp +2 -1
  10. amulet/chunk.pyi +0 -2
  11. amulet/chunk_components.pyi +20 -18
  12. amulet/collections/eq.py.hpp +1 -1
  13. amulet/collections/mapping.py.hpp +18 -11
  14. amulet/collections/mutable_mapping.py.hpp +17 -6
  15. amulet/collections/sequence.py.hpp +5 -6
  16. amulet/collections.pyi +8 -5
  17. amulet/entity.py +22 -20
  18. amulet/game/translate/_functions/_code_functions/_text.py +2 -2
  19. amulet/game/translate/_functions/abc.py +10 -3
  20. amulet/img/__init__.py +10 -0
  21. amulet/img/missing_no.png +0 -0
  22. amulet/img/missing_pack.png +0 -0
  23. amulet/level/__init__.pyi +2 -6
  24. amulet/level/abc/_chunk_handle.py +45 -22
  25. amulet/level/abc/_level/_creatable_level.py +1 -2
  26. amulet/level/abc/_level/_level.py +1 -5
  27. amulet/level/java/__init__.pyi +0 -5
  28. amulet/level/java/_raw/__init__.pyi +0 -4
  29. amulet/level/java/_raw/java_chunk_decode.cpp +2 -4
  30. amulet/level/java/long_array.pyi +2 -1
  31. amulet/mesh/block/__init__.pyi +301 -0
  32. amulet/mesh/block/_cube.py +198 -0
  33. amulet/mesh/block/_missing_block.py +20 -0
  34. amulet/mesh/block/block_mesh.cpp +107 -0
  35. amulet/mesh/block/block_mesh.hpp +207 -0
  36. amulet/mesh/util.py +17 -0
  37. amulet/player.py +4 -6
  38. amulet/pybind11/collections.hpp +80 -38
  39. amulet/pybind11/numpy.hpp +26 -0
  40. amulet/pybind11/py_module.hpp +16 -51
  41. amulet/pybind11/type_hints.hpp +51 -0
  42. amulet/pybind11/types.hpp +14 -6
  43. amulet/pybind11/typing.hpp +7 -0
  44. amulet/resource_pack/__init__.py +63 -0
  45. amulet/resource_pack/abc/__init__.py +2 -0
  46. amulet/resource_pack/abc/resource_pack.py +38 -0
  47. amulet/resource_pack/abc/resource_pack_manager.py +85 -0
  48. amulet/resource_pack/java/__init__.py +2 -0
  49. amulet/resource_pack/java/download_resources.py +212 -0
  50. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
  51. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
  52. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
  53. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
  54. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
  55. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
  56. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
  57. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
  58. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
  59. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
  60. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
  61. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
  62. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
  63. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
  64. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
  65. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
  66. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
  67. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
  68. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
  69. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
  70. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
  71. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
  72. amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
  73. amulet/resource_pack/java/resource_pack.py +44 -0
  74. amulet/resource_pack/java/resource_pack_manager.py +563 -0
  75. amulet/resource_pack/unknown_resource_pack.py +10 -0
  76. amulet/utils/__init__.pyi +0 -5
  77. amulet/utils/call_spec/_call_spec.py +2 -7
  78. amulet/utils/cast.py +10 -0
  79. amulet/utils/comment_json.py +188 -0
  80. amulet/utils/matrix.py +3 -3
  81. amulet/utils/numpy_helpers.py +2 -2
  82. amulet/utils/shareable_lock.py +2 -2
  83. amulet/utils/world_utils.py +2 -2
  84. amulet/version.pyi +0 -8
  85. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/METADATA +2 -2
  86. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/RECORD +91 -103
  87. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/WHEEL +1 -1
  88. amulet/chunk_/components/biome.py +0 -155
  89. amulet/chunk_/components/block_entity.py +0 -117
  90. amulet/chunk_/components/entity.py +0 -64
  91. amulet/chunk_/components/height_2d.py +0 -16
  92. amulet/level/bedrock/__init__.py +0 -2
  93. amulet/level/bedrock/_chunk_handle.py +0 -19
  94. amulet/level/bedrock/_dimension.py +0 -22
  95. amulet/level/bedrock/_level.py +0 -187
  96. amulet/level/bedrock/_raw/__init__.py +0 -5
  97. amulet/level/bedrock/_raw/_actor_counter.py +0 -53
  98. amulet/level/bedrock/_raw/_chunk.py +0 -54
  99. amulet/level/bedrock/_raw/_chunk_decode.py +0 -668
  100. amulet/level/bedrock/_raw/_chunk_encode.py +0 -602
  101. amulet/level/bedrock/_raw/_constant.py +0 -9
  102. amulet/level/bedrock/_raw/_dimension.py +0 -343
  103. amulet/level/bedrock/_raw/_level.py +0 -463
  104. amulet/level/bedrock/_raw/_level_dat.py +0 -90
  105. amulet/level/bedrock/_raw/_typing.py +0 -6
  106. amulet/level/bedrock/_raw/leveldb_chunk_versions.py +0 -83
  107. amulet/level/bedrock/chunk/__init__.py +0 -1
  108. amulet/level/bedrock/chunk/_chunk.py +0 -126
  109. amulet/level/bedrock/chunk/components/chunk_version.py +0 -12
  110. amulet/level/bedrock/chunk/components/finalised_state.py +0 -13
  111. amulet/level/bedrock/chunk/components/raw_chunk.py +0 -15
  112. amulet/level/construction/__init__.py +0 -0
  113. amulet/level/java/_chunk_handle.pyi +0 -15
  114. amulet/level/java/_dimension.pyi +0 -13
  115. amulet/level/java/_level.pyi +0 -120
  116. amulet/level/java/_raw/_chunk_decode.py +0 -561
  117. amulet/level/java/_raw/_chunk_encode.py +0 -463
  118. amulet/level/java/_raw/_constant.pyi +0 -20
  119. amulet/level/java/_raw/_data_pack/__init__.pyi +0 -8
  120. amulet/level/java/_raw/_data_pack/data_pack.pyi +0 -197
  121. amulet/level/java/_raw/_data_pack/data_pack_manager.pyi +0 -75
  122. amulet/level/java/_raw/_dimension.pyi +0 -72
  123. amulet/level/java/_raw/_level.pyi +0 -238
  124. amulet/level/java/_raw/_typing.pyi +0 -5
  125. amulet/level/java/anvil/__init__.pyi +0 -11
  126. amulet/level/java/anvil/_dimension.pyi +0 -109
  127. amulet/level/java/anvil/_region.pyi +0 -197
  128. amulet/level/java/anvil/_sector_manager.pyi +0 -142
  129. amulet/level/java_forge/__init__.py +0 -0
  130. amulet/level/mcstructure/__init__.py +0 -0
  131. amulet/level/nbt/__init__.py +0 -0
  132. amulet/level/schematic/__init__.py +0 -0
  133. amulet/level/sponge_schematic/__init__.py +0 -0
  134. amulet/pybind11/python.hpp +0 -14
  135. amulet/utils/call_spec/__init__.pyi +0 -53
  136. amulet/utils/call_spec/_call_spec.pyi +0 -272
  137. amulet/utils/matrix.pyi +0 -177
  138. amulet/utils/shareable_lock.pyi +0 -190
  139. amulet/utils/signal/__init__.pyi +0 -25
  140. amulet/utils/signal/_signal.pyi +0 -84
  141. amulet/utils/task_manager.pyi +0 -168
  142. amulet/utils/typing.py +0 -4
  143. amulet/utils/typing.pyi +0 -6
  144. amulet/utils/weakref.pyi +0 -50
  145. amulet/utils/world_utils.pyi +0 -109
  146. /amulet/img/{missing_world_icon.png → missing_world.png} +0 -0
  147. /amulet/{level/bedrock/chunk/components → mesh}/__init__.py +0 -0
  148. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/entry_points.txt +0 -0
  149. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,188 @@
1
+ from json import JSONDecodeError, loads as json_loads
2
+ from typing import TextIO, Union
3
+
4
+ """
5
+ Some of the Bedrock json files contain comments which is not valid JSON and the standard json parser
6
+ will throw errors. This will first try and use the vanilla json parser and fall back to the slower version if that fails.
7
+ """
8
+
9
+
10
+ JSONValue = Union[str, int, float, bool, None, "JSONDict", "JSONList"]
11
+ JSONDict = dict[str, JSONValue]
12
+ JSONList = list[JSONValue]
13
+
14
+
15
+ class CommentJSONDecodeError(JSONDecodeError):
16
+ pass
17
+
18
+
19
+ def from_file(path: str) -> JSONValue:
20
+ with open(path) as f:
21
+ return load(f)
22
+
23
+
24
+ def load(obj: TextIO) -> JSONValue:
25
+ return loads(obj.read())
26
+
27
+
28
+ def loads(s: str) -> JSONValue:
29
+ try:
30
+ return json_loads(s) # type: ignore
31
+ except JSONDecodeError:
32
+ return _loads(s)
33
+
34
+
35
+ def _loads(text: str) -> JSONValue:
36
+ # given a valid MinecraftJSON string will return the values as python objects
37
+ # in this context MinecraftJSON is standard JSON but with comment blocks and
38
+ # line comments that would normally be illegal in standard JSON
39
+ _number = set("0123456789-")
40
+ _float = set("0123456789-.")
41
+ _whitespace = set(" \t\r\n")
42
+
43
+ def strip_whitespace(index: int) -> int:
44
+ # skips whitespace characters (<space>, <tab>, <charrage return> and <newline>)
45
+ # as well as block comments and line comments
46
+ while text[index] in _whitespace:
47
+ index += 1
48
+ if text[index] == "/":
49
+ if text[index + 1] == "/":
50
+ index += 2
51
+ while text[index] != "\n":
52
+ index += 1
53
+ index = strip_whitespace(index)
54
+ elif text[index + 1] == "*":
55
+ index += 2
56
+ while text[index : index + 2] != "*/":
57
+ index += 1
58
+ if index + 1 >= len(text):
59
+ raise JSONDecodeError(
60
+ "expected */ but reached the end of file", text, index
61
+ )
62
+ index += 2
63
+ index = strip_whitespace(index)
64
+ else:
65
+ raise JSONDecodeError(f"unexpected / at index {index}", text, index)
66
+ return index
67
+
68
+ def parse_json_recursive(index: int = 0) -> tuple[JSONValue, int]:
69
+ index = strip_whitespace(index)
70
+ if text[index] == "{":
71
+ index += 1
72
+ # dictionary
73
+ json_obj = {}
74
+ repeat = True
75
+ while repeat:
76
+ index = strip_whitespace(index)
77
+ # }"
78
+ if text[index] == '"':
79
+ index += 1
80
+ key = ""
81
+ while text[index] != '"':
82
+ key += text[index]
83
+ index += 1
84
+ index += 1
85
+
86
+ index = strip_whitespace(index)
87
+
88
+ if text[index] == ":":
89
+ index += 1
90
+ else:
91
+ raise JSONDecodeError(
92
+ f"expected : got {text[index]} at index {index}",
93
+ text,
94
+ index,
95
+ )
96
+
97
+ index = strip_whitespace(index)
98
+
99
+ json_obj[key], index = parse_json_recursive(index)
100
+
101
+ index = strip_whitespace(index)
102
+
103
+ if text[index] == ",":
104
+ index += 1
105
+ else:
106
+ repeat = False
107
+ else:
108
+ repeat = False
109
+
110
+ if index >= len(text):
111
+ raise JSONDecodeError("expected } but reached end of file", text, index)
112
+ elif text[index] == "}":
113
+ index += 1
114
+ else:
115
+ raise JSONDecodeError(
116
+ f"expected }} got {text[index]} at index {index}", text, index
117
+ )
118
+ return json_obj, index
119
+
120
+ elif text[index] == "[":
121
+ index += 1
122
+ # list
123
+ json_array = []
124
+ index = strip_whitespace(index)
125
+ repeat = text[index] != "]"
126
+ while repeat:
127
+ val, index = parse_json_recursive(index)
128
+ json_array.append(val)
129
+
130
+ index = strip_whitespace(index)
131
+
132
+ if text[index] == ",":
133
+ index += 1
134
+ else:
135
+ repeat = False
136
+ index = strip_whitespace(index)
137
+
138
+ if index >= len(text):
139
+ raise JSONDecodeError("expected ] but reached end of file", text, index)
140
+ elif text[index] == "]":
141
+ index += 1
142
+ else:
143
+ raise JSONDecodeError(
144
+ f"expected ] got {text[index]} at index {index}", text, index
145
+ )
146
+ return json_array, index
147
+
148
+ elif text[index] == '"':
149
+ index += 1
150
+ # string
151
+ json_obj_list = []
152
+ while text[index] != '"':
153
+ json_obj_list.append(text[index])
154
+ index += 1
155
+ index += 1
156
+ return "".join(json_obj_list), index
157
+
158
+ elif text[index] in _number:
159
+ # number
160
+ json_obj_list = []
161
+ while text[index] in _float:
162
+ json_obj_list += text[index]
163
+ index += 1
164
+ if "." in json_obj_list:
165
+ return float("".join(json_obj_list)), index
166
+ else:
167
+ return int("".join(json_obj_list)), index
168
+
169
+ elif text[index] == "n" and text[index : index + 4] == "null":
170
+ index += 4
171
+ return None, index
172
+
173
+ elif text[index] == "t" and text[index : index + 4] == "true":
174
+ index += 4
175
+ return True, index
176
+
177
+ elif text[index] == "f" and text[index : index + 5] == "false":
178
+ index += 5
179
+ return False, index
180
+ else:
181
+ raise JSONDecodeError(
182
+ f'unexpected key {text[index]} at {index}. Expected {{, [, ", num, null, true or false',
183
+ text,
184
+ index,
185
+ )
186
+
187
+ # call recursive function and pass back python object
188
+ return parse_json_recursive()[0]
amulet/utils/matrix.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple, Literal
1
+ from typing import Literal
2
2
  import math
3
3
  import numpy
4
4
  from amulet.data_types import FloatTriplet, PointCoordinates
@@ -193,8 +193,8 @@ def inverse_transform_matrix(
193
193
 
194
194
  def decompose_transformation_matrix(
195
195
  matrix: numpy.ndarray,
196
- ) -> Tuple[
197
- Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]
196
+ ) -> tuple[
197
+ tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]
198
198
  ]:
199
199
  """
200
200
  Decompose a 4x4 transformation matrix into scale, rotation and displacement tuples.
@@ -1,11 +1,11 @@
1
- from typing import Tuple, TypeVar
1
+ from typing import TypeVar
2
2
  from collections.abc import Collection
3
3
  import numpy
4
4
 
5
5
  T = TypeVar("T")
6
6
 
7
7
 
8
- def brute_sort_objects_no_hash(data: Collection[T]) -> Tuple[list[T], numpy.ndarray]:
8
+ def brute_sort_objects_no_hash(data: Collection[T]) -> tuple[list[T], numpy.ndarray]:
9
9
  unique: list[T] = []
10
10
  inverse = numpy.zeros(dtype=numpy.uint32, shape=len(data))
11
11
  for i, d in enumerate(data):
@@ -289,7 +289,7 @@ class ShareableRLock:
289
289
  :raises: LockNotAcquired if the lock could not be acquired.
290
290
  """
291
291
  if not self.acquire_unique(blocking, timeout, task_manager):
292
- raise LockNotAcquired
292
+ raise LockNotAcquired("Lock was not acquired.")
293
293
  try:
294
294
  yield
295
295
  finally:
@@ -328,7 +328,7 @@ class ShareableRLock:
328
328
  :raises: LockNotAcquired if the lock could not be acquired.
329
329
  """
330
330
  if not self.acquire_shared(blocking, timeout, task_manager):
331
- raise LockNotAcquired
331
+ raise LockNotAcquired("Lock was not acquired.")
332
332
  try:
333
333
  yield
334
334
  finally:
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import math
4
- from typing import Tuple, Optional
4
+ from typing import Optional
5
5
  import numpy
6
6
  from numpy import ndarray, zeros, uint8
7
7
  from amulet.data_types import ChunkCoordinates
@@ -9,7 +9,7 @@ from amulet.data_types import ChunkCoordinates
9
9
 
10
10
  def block_coords_to_chunk_coords(
11
11
  *args: int, sub_chunk_size: int = 16
12
- ) -> Tuple[int, ...]:
12
+ ) -> tuple[int, ...]:
13
13
  """
14
14
  Converts the supplied block coordinates into chunk coordinates
15
15
 
amulet/version.pyi CHANGED
@@ -13,10 +13,8 @@ __all__ = [
13
13
  ]
14
14
 
15
15
  class PlatformVersionContainer:
16
- def __getstate__(self) -> bytes: ...
17
16
  def __init__(self, platform: str, version: VersionNumber) -> None: ...
18
17
  def __repr__(self) -> str: ...
19
- def __setstate__(self, arg0: bytes) -> None: ...
20
18
  @property
21
19
  def platform(self) -> str: ...
22
20
  @property
@@ -44,7 +42,6 @@ class VersionNumber:
44
42
  def __getitem__(self, item: typing.SupportsInt) -> int: ...
45
43
  @typing.overload
46
44
  def __getitem__(self, item: slice) -> list[int]: ...
47
- def __getstate__(self) -> bytes: ...
48
45
  def __gt__(self, arg0: VersionNumber) -> bool: ...
49
46
  def __hash__(self) -> int: ...
50
47
  def __init__(self, *args: typing.SupportsInt) -> None: ...
@@ -54,7 +51,6 @@ class VersionNumber:
54
51
  def __lt__(self, arg0: VersionNumber) -> bool: ...
55
52
  def __repr__(self) -> str: ...
56
53
  def __reversed__(self) -> typing.Iterator[int]: ...
57
- def __setstate__(self, arg0: bytes) -> None: ...
58
54
  def __str__(self) -> str: ...
59
55
  def count(self, value: int) -> int: ...
60
56
  def cropped_version(self) -> tuple:
@@ -71,12 +67,10 @@ class VersionNumber:
71
67
  """
72
68
 
73
69
  class VersionRange:
74
- def __getstate__(self) -> bytes: ...
75
70
  def __init__(
76
71
  self, platform: str, min_version: VersionNumber, max_version: VersionNumber
77
72
  ) -> None: ...
78
73
  def __repr__(self) -> str: ...
79
- def __setstate__(self, arg0: bytes) -> None: ...
80
74
  def contains(self, arg0: str, arg1: VersionNumber) -> bool: ...
81
75
  @property
82
76
  def max_version(self) -> VersionNumber: ...
@@ -86,9 +80,7 @@ class VersionRange:
86
80
  def platform(self) -> str: ...
87
81
 
88
82
  class VersionRangeContainer:
89
- def __getstate__(self) -> bytes: ...
90
83
  def __init__(self, version_range: VersionRange) -> None: ...
91
84
  def __repr__(self) -> str: ...
92
- def __setstate__(self, arg0: bytes) -> None: ...
93
85
  @property
94
86
  def version_range(self) -> VersionRange: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: amulet-core
3
- Version: 2.0a6
3
+ Version: 2.0a8
4
4
  Summary: A Python library for reading/writing Minecraft's various save formats.
5
5
  Home-page: https://www.amuletmc.com
6
6
  Author: James Clare, Ben Gothard et al.
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.11
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: numpy~=2.0
14
- Requires-Dist: amulet-nbt~=4.0a2
14
+ Requires-Dist: amulet-nbt~=4.0a6
15
15
  Requires-Dist: portalocker~=2.4
16
16
  Requires-Dist: amulet-leveldb~=1.0b0
17
17
  Requires-Dist: platformdirs~=3.1