amulet-core 2.0a6__cp312-cp312-win_amd64.whl → 2.0a7__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 (201) hide show
  1. amulet/__init__.cp312-win_amd64.pyd +0 -0
  2. amulet/__init__.py.cpp +4 -0
  3. amulet/__init__.pyi +0 -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.pyi +0 -2
  10. amulet/chunk_components.pyi +20 -18
  11. amulet/collections/eq.py.hpp +1 -1
  12. amulet/collections/mapping.py.hpp +18 -11
  13. amulet/collections/mutable_mapping.py.hpp +17 -6
  14. amulet/collections/sequence.py.hpp +5 -6
  15. amulet/collections.pyi +8 -5
  16. amulet/entity.py +22 -20
  17. amulet/game/translate/_functions/_code_functions/_text.py +2 -2
  18. amulet/game/translate/_functions/abc.py +10 -3
  19. amulet/img/__init__.py +10 -0
  20. amulet/img/missing_no.png +0 -0
  21. amulet/img/missing_pack.png +0 -0
  22. amulet/level/__init__.pyi +2 -6
  23. amulet/level/abc/_level/_creatable_level.py +1 -2
  24. amulet/level/abc/_level/_level.py +1 -5
  25. amulet/level/java/__init__.pyi +0 -5
  26. amulet/level/java/_raw/__init__.pyi +0 -4
  27. amulet/level/java/_raw/java_chunk_decode.cpp +2 -4
  28. amulet/level/java/long_array.pyi +2 -1
  29. amulet/mesh/block/__init__.py +1 -0
  30. amulet/mesh/block/block_mesh.py +369 -0
  31. amulet/mesh/block/cube.py +149 -0
  32. amulet/mesh/block/missing_block.py +20 -0
  33. amulet/mesh/util.py +17 -0
  34. amulet/player.py +4 -6
  35. amulet/pybind11/collections.hpp +80 -38
  36. amulet/pybind11/numpy.hpp +26 -0
  37. amulet/pybind11/py_module.hpp +16 -51
  38. amulet/pybind11/type_hints.hpp +51 -0
  39. amulet/pybind11/types.hpp +14 -6
  40. amulet/pybind11/typing.hpp +7 -0
  41. amulet/resource_pack/__init__.py +62 -0
  42. amulet/resource_pack/abc/__init__.py +2 -0
  43. amulet/resource_pack/abc/resource_pack.py +38 -0
  44. amulet/resource_pack/abc/resource_pack_manager.py +87 -0
  45. amulet/resource_pack/bedrock/__init__.py +2 -0
  46. amulet/resource_pack/bedrock/bedrock_vanilla_fix/pack_icon.png +0 -0
  47. amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_carried.png +0 -0
  48. amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_side_carried.png +0 -0
  49. amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/water.png +0 -0
  50. amulet/resource_pack/bedrock/blockshapes/__init__.py +31 -0
  51. amulet/resource_pack/bedrock/blockshapes/air.py +35 -0
  52. amulet/resource_pack/bedrock/blockshapes/base_blockshape.py +29 -0
  53. amulet/resource_pack/bedrock/blockshapes/bubble_column.py +29 -0
  54. amulet/resource_pack/bedrock/blockshapes/cake.py +46 -0
  55. amulet/resource_pack/bedrock/blockshapes/chest.py +54 -0
  56. amulet/resource_pack/bedrock/blockshapes/comparator.py +51 -0
  57. amulet/resource_pack/bedrock/blockshapes/cross_texture.py +186 -0
  58. amulet/resource_pack/bedrock/blockshapes/cross_texture0.py +17 -0
  59. amulet/resource_pack/bedrock/blockshapes/cross_texture_green.py +16 -0
  60. amulet/resource_pack/bedrock/blockshapes/cube.py +38 -0
  61. amulet/resource_pack/bedrock/blockshapes/default.py +14 -0
  62. amulet/resource_pack/bedrock/blockshapes/door.py +38 -0
  63. amulet/resource_pack/bedrock/blockshapes/door1.py +14 -0
  64. amulet/resource_pack/bedrock/blockshapes/door2.py +14 -0
  65. amulet/resource_pack/bedrock/blockshapes/door3.py +14 -0
  66. amulet/resource_pack/bedrock/blockshapes/door4.py +14 -0
  67. amulet/resource_pack/bedrock/blockshapes/door5.py +14 -0
  68. amulet/resource_pack/bedrock/blockshapes/door6.py +14 -0
  69. amulet/resource_pack/bedrock/blockshapes/double_plant.py +40 -0
  70. amulet/resource_pack/bedrock/blockshapes/enchanting_table.py +22 -0
  71. amulet/resource_pack/bedrock/blockshapes/farmland.py +22 -0
  72. amulet/resource_pack/bedrock/blockshapes/fence.py +22 -0
  73. amulet/resource_pack/bedrock/blockshapes/flat.py +55 -0
  74. amulet/resource_pack/bedrock/blockshapes/flat_wall.py +55 -0
  75. amulet/resource_pack/bedrock/blockshapes/furnace.py +44 -0
  76. amulet/resource_pack/bedrock/blockshapes/furnace_lit.py +14 -0
  77. amulet/resource_pack/bedrock/blockshapes/green_cube.py +39 -0
  78. amulet/resource_pack/bedrock/blockshapes/ladder.py +36 -0
  79. amulet/resource_pack/bedrock/blockshapes/lilypad.py +14 -0
  80. amulet/resource_pack/bedrock/blockshapes/partial_block.py +57 -0
  81. amulet/resource_pack/bedrock/blockshapes/piston.py +44 -0
  82. amulet/resource_pack/bedrock/blockshapes/piston_arm.py +72 -0
  83. amulet/resource_pack/bedrock/blockshapes/portal_frame.py +22 -0
  84. amulet/resource_pack/bedrock/blockshapes/pressure_plate.py +29 -0
  85. amulet/resource_pack/bedrock/blockshapes/pumpkin.py +36 -0
  86. amulet/resource_pack/bedrock/blockshapes/pumpkin_carved.py +14 -0
  87. amulet/resource_pack/bedrock/blockshapes/pumpkin_lit.py +14 -0
  88. amulet/resource_pack/bedrock/blockshapes/red_dust.py +14 -0
  89. amulet/resource_pack/bedrock/blockshapes/repeater.py +53 -0
  90. amulet/resource_pack/bedrock/blockshapes/slab.py +33 -0
  91. amulet/resource_pack/bedrock/blockshapes/slab_double.py +15 -0
  92. amulet/resource_pack/bedrock/blockshapes/tree.py +41 -0
  93. amulet/resource_pack/bedrock/blockshapes/turtle_egg.py +15 -0
  94. amulet/resource_pack/bedrock/blockshapes/vine.py +52 -0
  95. amulet/resource_pack/bedrock/blockshapes/wall.py +22 -0
  96. amulet/resource_pack/bedrock/blockshapes/water.py +38 -0
  97. amulet/resource_pack/bedrock/download_resources.py +147 -0
  98. amulet/resource_pack/bedrock/resource_pack.py +40 -0
  99. amulet/resource_pack/bedrock/resource_pack_manager.py +361 -0
  100. amulet/resource_pack/bedrock/sort_blockshapes.py +15 -0
  101. amulet/resource_pack/java/__init__.py +2 -0
  102. amulet/resource_pack/java/download_resources.py +212 -0
  103. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
  104. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
  105. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
  106. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
  107. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
  108. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
  109. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
  110. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
  111. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
  112. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
  113. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
  114. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
  115. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
  116. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
  117. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
  118. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
  119. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
  120. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
  121. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
  122. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
  123. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
  124. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
  125. amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
  126. amulet/resource_pack/java/resource_pack.py +44 -0
  127. amulet/resource_pack/java/resource_pack_manager.py +551 -0
  128. amulet/resource_pack/unknown_resource_pack.py +10 -0
  129. amulet/utils/__init__.pyi +0 -5
  130. amulet/utils/call_spec/_call_spec.py +2 -7
  131. amulet/utils/comment_json.py +188 -0
  132. amulet/utils/matrix.py +3 -3
  133. amulet/utils/numpy_helpers.py +2 -2
  134. amulet/utils/world_utils.py +2 -2
  135. amulet/version.pyi +0 -8
  136. {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/METADATA +2 -2
  137. amulet_core-2.0a7.dist-info/RECORD +295 -0
  138. amulet/chunk_/components/biome.py +0 -155
  139. amulet/chunk_/components/block_entity.py +0 -117
  140. amulet/chunk_/components/entity.py +0 -64
  141. amulet/chunk_/components/height_2d.py +0 -16
  142. amulet/level/bedrock/__init__.py +0 -2
  143. amulet/level/bedrock/_chunk_handle.py +0 -19
  144. amulet/level/bedrock/_dimension.py +0 -22
  145. amulet/level/bedrock/_level.py +0 -187
  146. amulet/level/bedrock/_raw/__init__.py +0 -5
  147. amulet/level/bedrock/_raw/_actor_counter.py +0 -53
  148. amulet/level/bedrock/_raw/_chunk.py +0 -54
  149. amulet/level/bedrock/_raw/_chunk_decode.py +0 -668
  150. amulet/level/bedrock/_raw/_chunk_encode.py +0 -602
  151. amulet/level/bedrock/_raw/_constant.py +0 -9
  152. amulet/level/bedrock/_raw/_dimension.py +0 -343
  153. amulet/level/bedrock/_raw/_level.py +0 -463
  154. amulet/level/bedrock/_raw/_level_dat.py +0 -90
  155. amulet/level/bedrock/_raw/_typing.py +0 -6
  156. amulet/level/bedrock/_raw/leveldb_chunk_versions.py +0 -83
  157. amulet/level/bedrock/chunk/__init__.py +0 -1
  158. amulet/level/bedrock/chunk/_chunk.py +0 -126
  159. amulet/level/bedrock/chunk/components/chunk_version.py +0 -12
  160. amulet/level/bedrock/chunk/components/finalised_state.py +0 -13
  161. amulet/level/bedrock/chunk/components/raw_chunk.py +0 -15
  162. amulet/level/construction/__init__.py +0 -0
  163. amulet/level/java/_chunk_handle.pyi +0 -15
  164. amulet/level/java/_dimension.pyi +0 -13
  165. amulet/level/java/_level.pyi +0 -120
  166. amulet/level/java/_raw/_chunk_decode.py +0 -561
  167. amulet/level/java/_raw/_chunk_encode.py +0 -463
  168. amulet/level/java/_raw/_constant.pyi +0 -20
  169. amulet/level/java/_raw/_data_pack/__init__.pyi +0 -8
  170. amulet/level/java/_raw/_data_pack/data_pack.pyi +0 -197
  171. amulet/level/java/_raw/_data_pack/data_pack_manager.pyi +0 -75
  172. amulet/level/java/_raw/_dimension.pyi +0 -72
  173. amulet/level/java/_raw/_level.pyi +0 -238
  174. amulet/level/java/_raw/_typing.pyi +0 -5
  175. amulet/level/java/anvil/__init__.pyi +0 -11
  176. amulet/level/java/anvil/_dimension.pyi +0 -109
  177. amulet/level/java/anvil/_region.pyi +0 -197
  178. amulet/level/java/anvil/_sector_manager.pyi +0 -142
  179. amulet/level/java_forge/__init__.py +0 -0
  180. amulet/level/mcstructure/__init__.py +0 -0
  181. amulet/level/nbt/__init__.py +0 -0
  182. amulet/level/schematic/__init__.py +0 -0
  183. amulet/level/sponge_schematic/__init__.py +0 -0
  184. amulet/pybind11/python.hpp +0 -14
  185. amulet/utils/call_spec/__init__.pyi +0 -53
  186. amulet/utils/call_spec/_call_spec.pyi +0 -272
  187. amulet/utils/matrix.pyi +0 -177
  188. amulet/utils/shareable_lock.pyi +0 -190
  189. amulet/utils/signal/__init__.pyi +0 -25
  190. amulet/utils/signal/_signal.pyi +0 -84
  191. amulet/utils/task_manager.pyi +0 -168
  192. amulet/utils/typing.py +0 -4
  193. amulet/utils/typing.pyi +0 -6
  194. amulet/utils/weakref.pyi +0 -50
  195. amulet/utils/world_utils.pyi +0 -109
  196. amulet_core-2.0a6.dist-info/RECORD +0 -253
  197. /amulet/img/{missing_world_icon.png → missing_world.png} +0 -0
  198. /amulet/{level/bedrock/chunk/components → mesh}/__init__.py +0 -0
  199. {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/WHEEL +0 -0
  200. {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/entry_points.txt +0 -0
  201. {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/top_level.txt +0 -0
Binary file
amulet/__init__.py.cpp CHANGED
@@ -18,6 +18,10 @@ void init_amulet(py::module m){
18
18
  if (init_run){ return; }
19
19
  init_run = true;
20
20
 
21
+ // This is normally added after initilsation but we need it to pass to subpackages.
22
+ // This may cause issues with frozen installs.
23
+ m.attr("__path__") = py::module::import("importlib.util").attr("find_spec")("amulet").attr("submodule_search_locations");
24
+
21
25
  py::module::import("amulet_nbt");
22
26
 
23
27
  py::module::import("amulet._init").attr("init")(m);
amulet/__init__.pyi CHANGED
@@ -14,7 +14,6 @@ from . import (
14
14
  )
15
15
 
16
16
  __all__ = [
17
- "IMG_DIRECTORY",
18
17
  "biome",
19
18
  "block",
20
19
  "block_entity",
@@ -26,5 +25,4 @@ __all__ = [
26
25
  "utils",
27
26
  "version",
28
27
  ]
29
- IMG_DIRECTORY: str
30
28
  __version__: str
amulet/_init.py CHANGED
@@ -12,8 +12,6 @@ def init(m: Any) -> None:
12
12
 
13
13
  # m.entity_support = False
14
14
 
15
- m.IMG_DIRECTORY = os.path.join(os.path.dirname(__file__), "img")
16
-
17
15
  # Initialise default paths. Applications should override these environment variables.
18
16
  # os.environ.setdefault("DATA_DIR", platformdirs.user_data_dir("AmuletTeam", "AmuletTeam"))
19
17
  # os.environ.setdefault("CONFIG_DIR", platformdirs.user_config_dir("AmuletTeam", "AmuletTeam"))
amulet/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-09-18T10:56:38+0100",
11
+ "date": "2024-09-25T13:37:55+0100",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "6ed1d429cbd7c4f21d779c7e4ac65ddc90512b80",
15
- "version": "2.0a6"
14
+ "full-revisionid": "bef077cfb019dd2608e14edab047d37d75dfba61",
15
+ "version": "2.0a7"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
amulet/biome.pyi CHANGED
@@ -29,7 +29,6 @@ class Biome(amulet.version.PlatformVersionContainer):
29
29
  @typing.overload
30
30
  def __eq__(self, arg0: typing.Any) -> bool | types.NotImplementedType: ...
31
31
  def __ge__(self, arg0: Biome) -> bool: ...
32
- def __getstate__(self) -> bytes: ...
33
32
  def __gt__(self, arg0: Biome) -> bool: ...
34
33
  def __hash__(self) -> int: ...
35
34
  def __init__(
@@ -42,7 +41,6 @@ class Biome(amulet.version.PlatformVersionContainer):
42
41
  def __le__(self, arg0: Biome) -> bool: ...
43
42
  def __lt__(self, arg0: Biome) -> bool: ...
44
43
  def __repr__(self) -> str: ...
45
- def __setstate__(self, arg0: bytes) -> None: ...
46
44
  @property
47
45
  def base_name(self) -> str:
48
46
  """
amulet/block.pyi CHANGED
@@ -74,7 +74,6 @@ class Block(amulet.version.PlatformVersionContainer):
74
74
  @typing.overload
75
75
  def __eq__(self, arg0: typing.Any) -> bool | types.NotImplementedType: ...
76
76
  def __ge__(self, arg0: Block) -> bool: ...
77
- def __getstate__(self) -> bytes: ...
78
77
  def __gt__(self, arg0: Block) -> bool: ...
79
78
  def __hash__(self) -> int: ...
80
79
  def __init__(
@@ -95,7 +94,6 @@ class Block(amulet.version.PlatformVersionContainer):
95
94
  def __le__(self, arg0: Block) -> bool: ...
96
95
  def __lt__(self, arg0: Block) -> bool: ...
97
96
  def __repr__(self) -> str: ...
98
- def __setstate__(self, arg0: bytes) -> None: ...
99
97
  @property
100
98
  def base_name(self) -> str:
101
99
  """
amulet/block_entity.pyi CHANGED
@@ -17,7 +17,6 @@ class BlockEntity(amulet.version.PlatformVersionContainer):
17
17
  def __eq__(self, arg0: BlockEntity) -> bool: ...
18
18
  @typing.overload
19
19
  def __eq__(self, arg0: typing.Any) -> bool | types.NotImplementedType: ...
20
- def __getstate__(self) -> bytes: ...
21
20
  def __hash__(self) -> int: ...
22
21
  def __init__(
23
22
  self,
@@ -28,7 +27,6 @@ class BlockEntity(amulet.version.PlatformVersionContainer):
28
27
  nbt: amulet_nbt.NamedTag,
29
28
  ) -> None: ...
30
29
  def __repr__(self) -> str: ...
31
- def __setstate__(self, arg0: bytes) -> None: ...
32
30
  @property
33
31
  def base_name(self) -> str:
34
32
  """
amulet/chunk.pyi CHANGED
@@ -7,8 +7,6 @@ class Chunk:
7
7
  A base class for all chunk classes.
8
8
  """
9
9
 
10
- def __getstate__(self) -> tuple: ...
11
- def __setstate__(self, arg0: tuple) -> None: ...
12
10
  def reconstruct_chunk(self, arg0: dict[str, bytes | None]) -> None:
13
11
  """
14
12
  This is private. Do not use this. It will be removed in the future.
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import collections.abc
3
4
  import types
4
5
  import typing
5
6
 
@@ -8,6 +9,7 @@ import amulet.collections
8
9
  import amulet.palette.block_palette
9
10
  import amulet.version
10
11
  import numpy
12
+ import numpy.typing
11
13
  import typing_extensions
12
14
 
13
15
  __all__ = ["BlockComponent", "BlockComponentData", "IndexArray3D", "SectionArrayMap"]
@@ -33,11 +35,6 @@ class IndexArray3D:
33
35
  A 3D index array.
34
36
  """
35
37
 
36
- def __buffer__(self, flags):
37
- """
38
- Return a buffer object that exposes the underlying memory of the object.
39
- """
40
-
41
38
  @typing.overload
42
39
  def __init__(self, shape: tuple[int, int, int]) -> None: ...
43
40
  @typing.overload
@@ -46,11 +43,6 @@ class IndexArray3D:
46
43
  def __init__(self, other: IndexArray3D) -> None: ...
47
44
  @typing.overload
48
45
  def __init__(self, arg0: typing_extensions.Buffer) -> None: ...
49
- def __release_buffer__(self, buffer):
50
- """
51
- Release the buffer object that exposes the underlying memory of the object.
52
- """
53
-
54
46
  @property
55
47
  def shape(self) -> tuple[int, int, int]: ...
56
48
  @property
@@ -64,7 +56,7 @@ class SectionArrayMap:
64
56
  def __contains__(self, arg0: int) -> bool: ...
65
57
  def __delitem__(self, arg0: int) -> None: ...
66
58
  def __eq__(self, arg0: typing.Any) -> bool | types.NotImplementedType: ...
67
- def __getitem__(self, arg0: int) -> typing.Any: ...
59
+ def __getitem__(self, arg0: int) -> numpy.typing.NDArray[numpy.uint32]: ...
68
60
  def __hash__(self) -> int: ...
69
61
  def __init__(
70
62
  self,
@@ -76,15 +68,25 @@ class SectionArrayMap:
76
68
  def __setitem__(
77
69
  self, arg0: int, arg1: IndexArray3D | typing_extensions.Buffer
78
70
  ) -> None: ...
79
- def get(self, arg0: typing.Any, arg1: typing.Any) -> typing.Any: ...
80
- def items(self) -> typing.Any: ...
81
- def keys(self) -> typing.Any: ...
82
- def pop(self, key: typing.Any, default: typing.Any = ...) -> typing.Any: ...
83
- def popitem(self) -> tuple[typing.Any, typing.Any]: ...
71
+ def get(
72
+ self, arg0: int, arg1: numpy.typing.NDArray[numpy.uint32] | None
73
+ ) -> numpy.typing.NDArray[numpy.uint32] | None: ...
74
+ def items(
75
+ self,
76
+ ) -> collections.abc.ItemsView[int, numpy.typing.NDArray[numpy.uint32]]: ...
77
+ def keys(self) -> collections.abc.KeysView[int]: ...
78
+ def pop(
79
+ self, key: int, default: numpy.typing.NDArray[numpy.uint32] = ...
80
+ ) -> numpy.typing.NDArray[numpy.uint32]: ...
81
+ def popitem(self) -> tuple[int, numpy.typing.NDArray[numpy.uint32]]: ...
84
82
  def populate(self, arg0: int) -> None: ...
85
- def setdefault(self, arg0: typing.Any, arg1: typing.Any) -> typing.Any: ...
83
+ def setdefault(
84
+ self, arg0: int, arg1: numpy.typing.NDArray[numpy.uint32] | None
85
+ ) -> numpy.typing.NDArray[numpy.uint32] | None: ...
86
86
  def update(self, other: typing.Any = (), **kwargs) -> None: ...
87
- def values(self) -> typing.Any: ...
87
+ def values(
88
+ self,
89
+ ) -> collections.abc.ValuesView[numpy.typing.NDArray[numpy.uint32]]: ...
88
90
  @property
89
91
  def array_shape(self) -> tuple[int, int, int]: ...
90
92
  @property
@@ -30,7 +30,7 @@ void Eq_default(clsT cls) {
30
30
  py::object NotImplemented = py::module::import("builtins").attr("NotImplemented");
31
31
  cls.def(
32
32
  "__eq__",
33
- [NotImplemented](const typename clsT::type& self, py::object other) -> std::variant<bool, py::types::NotImplementedType> {
33
+ [NotImplemented](const typename clsT::type& self, py::object other) -> std::variant<bool, Amulet::pybind11::types::NotImplementedType> {
34
34
  return NotImplemented;
35
35
  }
36
36
  );
@@ -3,8 +3,11 @@
3
3
  #include <memory>
4
4
 
5
5
  #include <pybind11/pybind11.h>
6
+ #include <pybind11/typing.h>
6
7
 
7
8
  #include <amulet/pybind11/types.hpp>
9
+ #include <amulet/pybind11/type_hints.hpp>
10
+ #include <amulet/pybind11/collections.hpp>
8
11
  #include "iterator.py.hpp"
9
12
 
10
13
  namespace py = pybind11;
@@ -35,11 +38,11 @@ namespace collections {
35
38
  );
36
39
  }
37
40
 
38
- template <typename clsT>
41
+ template <typename KT = py::object, typename clsT>
39
42
  void PyMapping_contains(clsT cls) {
40
43
  cls.def(
41
44
  "__contains__",
42
- [](py::object self, py::object key) {
45
+ [](py::object self, Amulet::pybind11::type_hints::PyObjectCpp<KT> key) {
43
46
  try {
44
47
  self.attr("__getitem__")(key);
45
48
  return true;
@@ -56,38 +59,42 @@ namespace collections {
56
59
  );
57
60
  }
58
61
 
59
- template <typename clsT>
62
+ template <typename KT = py::object, typename clsT>
60
63
  void PyMapping_keys(clsT cls) {
61
64
  py::object KeysView = py::module::import("collections.abc").attr("KeysView");
62
65
  cls.def(
63
66
  "keys",
64
- [KeysView](py::object self) { return KeysView(self); }
67
+ [KeysView](py::object self) -> Amulet::pybind11::collections::KeysView<KT> { return KeysView(self); }
65
68
  );
66
69
  }
67
70
 
68
- template <typename clsT>
71
+ template <typename VT = py::object, typename clsT>
69
72
  void PyMapping_values(clsT cls) {
70
73
  py::object ValuesView = py::module::import("collections.abc").attr("ValuesView");
71
74
  cls.def(
72
75
  "values",
73
- [ValuesView](py::object self) { return ValuesView(self); }
76
+ [ValuesView](py::object self) -> Amulet::pybind11::collections::ValuesView<VT> { return ValuesView(self); }
74
77
  );
75
78
  }
76
79
 
77
- template <typename clsT>
80
+ template <typename KT = py::object, typename VT = py::object, typename clsT>
78
81
  void PyMapping_items(clsT cls) {
79
82
  py::object ItemsView = py::module::import("collections.abc").attr("ItemsView");
80
83
  cls.def(
81
84
  "items",
82
- [ItemsView](py::object self) { return ItemsView(self); }
85
+ [ItemsView](py::object self) -> Amulet::pybind11::collections::ItemsView<KT, VT> { return ItemsView(self); }
83
86
  );
84
87
  }
85
88
 
86
- template <typename clsT>
89
+ template <typename KT = py::object, typename VT = py::object, typename clsT>
87
90
  void PyMapping_get(clsT cls) {
88
91
  cls.def(
89
92
  "get",
90
- [](py::object self, py::object key, py::object default_ = py::none()) {
93
+ [](
94
+ py::object self,
95
+ Amulet::pybind11::type_hints::PyObjectCpp<KT> key,
96
+ py::typing::Optional<VT> default_ = py::none()
97
+ ) -> py::typing::Optional<VT> {
91
98
  try {
92
99
  return self.attr("__getitem__")(key);
93
100
  }
@@ -119,7 +126,7 @@ namespace collections {
119
126
  ](
120
127
  py::object self,
121
128
  py::object other
122
- ) -> std::variant<bool, py::types::NotImplementedType> {
129
+ ) -> std::variant<bool, Amulet::pybind11::types::NotImplementedType> {
123
130
  if (!isinstance(other, PyMapping)) {
124
131
  return NotImplemented;
125
132
  }
@@ -10,12 +10,16 @@ namespace py = pybind11;
10
10
 
11
11
  namespace Amulet {
12
12
  namespace collections {
13
- template <typename clsT>
13
+ template <typename KT = py::object, typename VT = py::object, typename clsT>
14
14
  void PyMutableMapping_pop(clsT cls) {
15
15
  py::object marker = py::module::import("builtins").attr("Ellipsis");
16
16
  cls.def(
17
17
  "pop",
18
- [marker](py::object self, py::object key, py::object default_) {
18
+ [marker](
19
+ py::object self,
20
+ Amulet::pybind11::type_hints::PyObjectCpp<KT> key,
21
+ Amulet::pybind11::type_hints::PyObjectCpp<VT> default_
22
+ ) -> Amulet::pybind11::type_hints::PyObjectCpp<VT> {
19
23
  py::object value;
20
24
  try {
21
25
  value = self.attr("__getitem__")(key);
@@ -39,13 +43,16 @@ namespace collections {
39
43
  );
40
44
  }
41
45
 
42
- template <typename clsT>
46
+ template <typename KT = py::object, typename VT = py::object, typename clsT>
43
47
  void PyMutableMapping_popitem(clsT cls) {
44
48
  py::object iter = py::module::import("builtins").attr("iter");
45
49
  py::object next = py::module::import("builtins").attr("next");
46
50
  cls.def(
47
51
  "popitem",
48
- [iter, next](py::object self) {
52
+ [iter, next](py::object self) -> std::pair<
53
+ Amulet::pybind11::type_hints::PyObjectCpp<KT>,
54
+ Amulet::pybind11::type_hints::PyObjectCpp<VT>
55
+ > {
49
56
  py::object key;
50
57
  try {
51
58
  key = next(iter(self));
@@ -132,11 +139,15 @@ namespace collections {
132
139
  );
133
140
  }
134
141
 
135
- template <typename clsT>
142
+ template <typename KT = py::object, typename VT = py::object, typename clsT>
136
143
  void PyMutableMapping_setdefault(clsT cls) {
137
144
  cls.def(
138
145
  "setdefault",
139
- [](py::object self, py::object key, py::object default_ = py::none()) {
146
+ [](
147
+ py::object self,
148
+ Amulet::pybind11::type_hints::PyObjectCpp<KT> key,
149
+ py::typing::Optional<VT> default_ = py::none()
150
+ ) -> py::typing::Optional<VT> {
140
151
  try {
141
152
  return self.attr("__getitem__")(key);
142
153
  }
@@ -7,7 +7,6 @@
7
7
  #include <pybind11/pybind11.h>
8
8
  #include "iterator.py.hpp"
9
9
  #include <amulet/pybind11/collections.hpp>
10
- #include <amulet/pybind11/python.hpp>
11
10
 
12
11
  namespace py = pybind11;
13
12
 
@@ -41,7 +40,7 @@ namespace Amulet {
41
40
  [](py::object self, py::object value) {
42
41
  py::iterator it = py::iter(self);
43
42
  while (it != py::iterator::sentinel()) {
44
- if (py::equals(*it, value)) {
43
+ if (it->equal(value)) {
45
44
  return true;
46
45
  }
47
46
  ++it;
@@ -55,7 +54,7 @@ namespace Amulet {
55
54
  void Sequence_iter(clsT cls) {
56
55
  cls.def(
57
56
  "__iter__",
58
- [](py::object self) -> py::collections::Iterator<elemT> {
57
+ [](py::object self) -> Amulet::pybind11::collections::Iterator<elemT> {
59
58
  return py::cast(
60
59
  static_cast<std::shared_ptr<Amulet::collections::Iterator>>(
61
60
  std::make_shared<PySequenceIterator>(self, 0, 1)
@@ -69,7 +68,7 @@ namespace Amulet {
69
68
  void Sequence_reversed(clsT cls) {
70
69
  cls.def(
71
70
  "__reversed__",
72
- [](py::object self) -> py::collections::Iterator<elemT> {
71
+ [](py::object self) -> Amulet::pybind11::collections::Iterator<elemT> {
73
72
  return py::cast(
74
73
  static_cast<std::shared_ptr<Amulet::collections::Iterator>>(
75
74
  std::make_shared<PySequenceIterator>(self, py::len(self) - 1, -1)
@@ -114,7 +113,7 @@ namespace Amulet {
114
113
  }
115
114
  }
116
115
 
117
- if (py::equals(value, obj)) {
116
+ if (value.equal(obj)) {
118
117
  return start;
119
118
  }
120
119
 
@@ -135,7 +134,7 @@ namespace Amulet {
135
134
  size_t size = py::len(self);
136
135
  py::object getitem = self.attr("__getitem__");
137
136
  for (size_t i = 0; i < size; ++i) {
138
- if (py::equals(value, getitem(i))) {
137
+ if (value.equal(getitem(i))) {
139
138
  count++;
140
139
  }
141
140
  }
amulet/collections.pyi CHANGED
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import collections.abc
3
4
  import types
4
5
  import typing
5
6
 
@@ -22,10 +23,10 @@ class Mapping:
22
23
  def __iter__(self) -> typing.Iterator: ...
23
24
  def __len__(self) -> int: ...
24
25
  def __repr__(self) -> str: ...
25
- def get(self, arg0: typing.Any, arg1: typing.Any) -> typing.Any: ...
26
- def items(self) -> typing.Any: ...
27
- def keys(self) -> typing.Any: ...
28
- def values(self) -> typing.Any: ...
26
+ def get(self, arg0: typing.Any, arg1: typing.Any | None) -> typing.Any | None: ...
27
+ def items(self) -> collections.abc.ItemsView[typing.Any, typing.Any]: ...
28
+ def keys(self) -> collections.abc.KeysView[typing.Any]: ...
29
+ def values(self) -> collections.abc.ValuesView[typing.Any]: ...
29
30
 
30
31
  class MutableMapping(Mapping):
31
32
  def __delitem__(self, arg0: typing.Any) -> None: ...
@@ -33,5 +34,7 @@ class MutableMapping(Mapping):
33
34
  def clear(self) -> None: ...
34
35
  def pop(self, key: typing.Any, default: typing.Any = ...) -> typing.Any: ...
35
36
  def popitem(self) -> tuple[typing.Any, typing.Any]: ...
36
- def setdefault(self, arg0: typing.Any, arg1: typing.Any) -> typing.Any: ...
37
+ def setdefault(
38
+ self, arg0: typing.Any, arg1: typing.Any | None
39
+ ) -> typing.Any | None: ...
37
40
  def update(self, other: typing.Any = (), **kwargs) -> None: ...
amulet/entity.py CHANGED
@@ -54,28 +54,30 @@ class Entity(PlatformVersionContainer):
54
54
  self._nbt = nbt
55
55
 
56
56
  def __getstate__(self) -> tuple[tuple[str, VersionNumber], tuple[str, str, float, float, float, NamedTag]]: # type: ignore[override]
57
- return (
58
- super().__getstate__(),
59
- (
60
- self._namespace,
61
- self._base_name,
62
- self._x,
63
- self._y,
64
- self._z,
65
- self._nbt,
66
- ),
67
- )
57
+ raise NotImplementedError
58
+ # return (
59
+ # super().__getstate__(),
60
+ # (
61
+ # self._namespace,
62
+ # self._base_name,
63
+ # self._x,
64
+ # self._y,
65
+ # self._z,
66
+ # self._nbt,
67
+ # ),
68
+ # )
68
69
 
69
70
  def __setstate__(self, state: tuple[tuple[str, VersionNumber], tuple[str, str, float, float, float, NamedTag]]) -> None: # type: ignore[override]
70
- super().__setstate__(state[0])
71
- (
72
- self._namespace,
73
- self._base_name,
74
- self._x,
75
- self._y,
76
- self._z,
77
- self._nbt,
78
- ) = state[1]
71
+ raise NotImplementedError
72
+ # super().__setstate__(state[0])
73
+ # (
74
+ # self._namespace,
75
+ # self._base_name,
76
+ # self._x,
77
+ # self._y,
78
+ # self._z,
79
+ # self._nbt,
80
+ # ) = state[1]
79
81
 
80
82
  def __eq__(self, other: Any) -> bool:
81
83
  if not isinstance(other, Entity):
@@ -1,5 +1,5 @@
1
1
  from __future__ import annotations
2
- from typing import List, overload, Literal, TypeVar
2
+ from typing import overload, Literal, TypeVar
3
3
  from dataclasses import dataclass, field
4
4
  from copy import deepcopy
5
5
  from enum import Enum
@@ -336,7 +336,7 @@ class RawTextComponent:
336
336
  section_text: str,
337
337
  section_parser: type[AbstractSectionParser],
338
338
  split_newline: Literal[True],
339
- ) -> List[RawTextComponent]: ...
339
+ ) -> list[RawTextComponent]: ...
340
340
 
341
341
  @classmethod
342
342
  def from_section_text(
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, Protocol, cast, Self, ClassVar
4
- from abc import ABC, abstractmethod, ABCMeta
3
+ from typing import Any, Protocol, cast, Self, ClassVar, TypeVar
4
+ from abc import abstractmethod, ABCMeta
5
5
 
6
6
  from amulet_nbt import (
7
7
  read_snbt,
@@ -65,10 +65,17 @@ class Data(Protocol):
65
65
  def __eq__(self, other: Any) -> bool: ...
66
66
 
67
67
 
68
+ class TranslationFunctionProtocol(Protocol):
69
+ _instances: ClassVar[dict[Self, Self]]
70
+
71
+
72
+ T = TypeVar("T", bound=TranslationFunctionProtocol)
73
+
74
+
68
75
  class CacheMeta(ABCMeta):
69
76
  """This modifies the construction of the instance to always return a cached instance, if one exists."""
70
77
 
71
- def __call__(cls: type[AbstractBaseTranslationFunction], *args: Any, **kwargs: Any) -> AbstractBaseTranslationFunction: # type: ignore
78
+ def __call__(cls: type[T], *args: Any, **kwargs: Any) -> T: # type: ignore
72
79
  obj = cls.__new__(cls)
73
80
  obj.__init__(*args, **kwargs) # type: ignore
74
81
  return cls._instances.setdefault(obj, obj)
amulet/img/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ import os
2
+
3
+
4
+ def _get_path(file: str) -> str:
5
+ return os.path.abspath(os.path.join(os.path.dirname(__file__), file))
6
+
7
+
8
+ missing_no_icon_path = _get_path("missing_no.png")
9
+ missing_pack_icon_path = _get_path("missing_pack.png")
10
+ missing_world_icon_path = _get_path("missing_world.png")
Binary file
Binary file
amulet/level/__init__.pyi CHANGED
@@ -1,7 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import typing
4
-
5
3
  from amulet.level._load import (
6
4
  NoValidLevel,
7
5
  get_level,
@@ -11,17 +9,15 @@ from amulet.level._load import (
11
9
  from amulet.level.abc._level._level import Level
12
10
  from amulet.level.java._level import JavaLevel
13
11
 
14
- from . import java
12
+ from . import _load, abc, java
15
13
 
16
14
  __all__ = [
17
15
  "JavaLevel",
18
16
  "Level",
19
17
  "NoValidLevel",
18
+ "abc",
20
19
  "get_level",
21
20
  "java",
22
21
  "register_level_class",
23
22
  "unregister_level_class",
24
23
  ]
25
-
26
- def __dir__() -> typing.Any: ...
27
- def __getattr__(arg0: typing.Any) -> typing.Any: ...
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
  from abc import ABC, abstractmethod
3
3
  from typing import TYPE_CHECKING, Any
4
4
 
5
- from amulet.utils.typing import Intersection
6
5
  from amulet.utils.call_spec import method_spec
7
6
 
8
7
 
@@ -18,7 +17,7 @@ class CreatableLevel(ABC):
18
17
  @classmethod
19
18
  @abstractmethod
20
19
  @method_spec()
21
- def create(cls, *args: Any, **kwargs: Any) -> Intersection[Level, CreatableLevel]:
20
+ def create(cls, *args: Any, **kwargs: Any) -> Level:
22
21
  """
23
22
  Create a new instance without any existing data.
24
23
  You must call :meth:`~amulet.level.abc.Level.open` to open the level for editing.
@@ -3,16 +3,15 @@ from __future__ import annotations
3
3
  from abc import ABC, abstractmethod
4
4
  from typing import TYPE_CHECKING, Optional, TypeVar, Type, Generic, Iterator, Callable
5
5
  from contextlib import contextmanager, AbstractContextManager as ContextManager
6
- import os
7
6
  import logging
8
7
  from weakref import finalize
9
8
 
10
9
  from runtime_final import final
11
10
  from PIL import Image
12
11
 
13
- from amulet import IMG_DIRECTORY
14
12
  from amulet.version import PlatformType, VersionNumber
15
13
  from amulet.data_types import DimensionId
14
+ from amulet.img import missing_world_icon_path
16
15
 
17
16
  from amulet.chunk import Chunk
18
17
 
@@ -31,9 +30,6 @@ if TYPE_CHECKING:
31
30
 
32
31
  log = logging.getLogger(__name__)
33
32
 
34
- missing_world_icon_path = os.path.abspath(
35
- os.path.join(IMG_DIRECTORY, "missing_world_icon.png")
36
- )
37
33
  missing_world_icon: Optional[Image.Image] = None
38
34
 
39
35
 
@@ -1,7 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import typing
4
-
5
3
  from amulet.level.java._level import JavaLevel
6
4
 
7
5
  from . import (
@@ -16,6 +14,3 @@ from . import (
16
14
  )
17
15
 
18
16
  __all__ = ["JavaLevel", "anvil", "chunk", "chunk_components", "long_array"]
19
-
20
- def __dir__() -> typing.Any: ...
21
- def __getattr__(arg0: typing.Any) -> typing.Any: ...
@@ -1,6 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import typing
4
3
  from builtins import str as InternalDimensionId
5
4
 
6
5
  from amulet.level.java._raw._dimension import JavaRawDimension
@@ -14,6 +13,3 @@ __all__ = [
14
13
  "JavaRawDimension",
15
14
  "JavaRawLevel",
16
15
  ]
17
-
18
- def __dir__() -> typing.Any: ...
19
- def __getattr__(arg0: typing.Any) -> typing.Any: ...