amulet-core 2.0a8__cp312-cp312-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a1__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of amulet-core might be problematic. Click here for more details.

Files changed (271) hide show
  1. amulet/core/__init__.py +36 -0
  2. amulet/core/__pyinstaller/hook-amulet.core.py +4 -0
  3. amulet/core/_amulet_core.cp312-win_amd64.pyd +0 -0
  4. amulet/core/_amulet_core.pyi +7 -0
  5. amulet/{_version.py → core/_version.py} +3 -3
  6. amulet/core/amulet_core.dll +0 -0
  7. amulet/core/amulet_core.lib +0 -0
  8. amulet/core/amulet_coreConfig.cmake +18 -0
  9. amulet/{biome.pyi → core/biome/__init__.pyi} +3 -3
  10. amulet/core/biome/biome.hpp +53 -0
  11. amulet/{block.pyi → core/block/__init__.pyi} +25 -26
  12. amulet/core/block/block.hpp +156 -0
  13. amulet/{block_entity.pyi → core/block_entity/__init__.pyi} +7 -7
  14. amulet/core/block_entity/block_entity.hpp +84 -0
  15. amulet/{errors.py → core/chunk/__init__.pyi} +37 -33
  16. amulet/core/chunk/chunk.hpp +126 -0
  17. amulet/core/chunk/component/__init__.pyi +18 -0
  18. amulet/core/chunk/component/biome_3d_component.hpp +96 -0
  19. amulet/core/chunk/component/block_component.hpp +101 -0
  20. amulet/core/chunk/component/block_component.pyi +28 -0
  21. amulet/core/chunk/component/block_entity_component.hpp +119 -0
  22. amulet/core/chunk/component/section_array_map.hpp +129 -0
  23. amulet/{chunk_components.pyi → core/chunk/component/section_array_map.pyi} +4 -24
  24. amulet/core/dll.hpp +21 -0
  25. amulet/core/entity/__init__.pyi +105 -0
  26. amulet/core/entity/entity.hpp +100 -0
  27. amulet/{palette → core/palette}/__init__.pyi +2 -2
  28. amulet/core/palette/biome_palette.hpp +65 -0
  29. amulet/{palette → core/palette}/biome_palette.pyi +8 -8
  30. amulet/core/palette/block_palette.hpp +71 -0
  31. amulet/{palette → core/palette}/block_palette.pyi +12 -10
  32. amulet/core/selection/__init__.pyi +8 -0
  33. amulet/core/selection/box.hpp +86 -0
  34. amulet/core/selection/box.pyi +215 -0
  35. amulet/core/selection/group.hpp +80 -0
  36. amulet/core/selection/group.pyi +213 -0
  37. amulet/{version.pyi → core/version/__init__.pyi} +58 -10
  38. amulet/core/version/version.hpp +204 -0
  39. {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/METADATA +25 -20
  40. amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/RECORD +45 -0
  41. {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/WHEEL +1 -1
  42. amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/entry_points.txt +2 -0
  43. amulet/__init__.cp312-win_amd64.pyd +0 -0
  44. amulet/__init__.py.cpp +0 -45
  45. amulet/__init__.pyi +0 -30
  46. amulet/__pyinstaller/hook-amulet.py +0 -4
  47. amulet/_init.py +0 -26
  48. amulet/biome.cpp +0 -36
  49. amulet/biome.hpp +0 -43
  50. amulet/biome.py.cpp +0 -122
  51. amulet/block.cpp +0 -435
  52. amulet/block.hpp +0 -119
  53. amulet/block.py.cpp +0 -377
  54. amulet/block_entity.cpp +0 -12
  55. amulet/block_entity.hpp +0 -56
  56. amulet/block_entity.py.cpp +0 -115
  57. amulet/chunk.cpp +0 -16
  58. amulet/chunk.hpp +0 -100
  59. amulet/chunk.py.cpp +0 -80
  60. amulet/chunk.pyi +0 -28
  61. amulet/chunk_components/biome_3d_component.cpp +0 -5
  62. amulet/chunk_components/biome_3d_component.hpp +0 -79
  63. amulet/chunk_components/block_component.cpp +0 -41
  64. amulet/chunk_components/block_component.hpp +0 -88
  65. amulet/chunk_components/block_entity_component.cpp +0 -5
  66. amulet/chunk_components/block_entity_component.hpp +0 -147
  67. amulet/chunk_components/section_array_map.cpp +0 -129
  68. amulet/chunk_components/section_array_map.hpp +0 -147
  69. amulet/collections/eq.py.hpp +0 -37
  70. amulet/collections/hash.py.hpp +0 -27
  71. amulet/collections/holder.py.hpp +0 -37
  72. amulet/collections/iterator.py.hpp +0 -80
  73. amulet/collections/mapping.py.hpp +0 -199
  74. amulet/collections/mutable_mapping.py.hpp +0 -226
  75. amulet/collections/sequence.py.hpp +0 -163
  76. amulet/collections.pyi +0 -40
  77. amulet/data_types.py +0 -29
  78. amulet/entity.py +0 -182
  79. amulet/game/__init__.py +0 -7
  80. amulet/game/_game.py +0 -152
  81. amulet/game/_universal/__init__.py +0 -1
  82. amulet/game/_universal/_biome.py +0 -17
  83. amulet/game/_universal/_block.py +0 -47
  84. amulet/game/_universal/_version.py +0 -68
  85. amulet/game/abc/__init__.py +0 -22
  86. amulet/game/abc/_block_specification.py +0 -150
  87. amulet/game/abc/biome.py +0 -213
  88. amulet/game/abc/block.py +0 -331
  89. amulet/game/abc/game_version_container.py +0 -25
  90. amulet/game/abc/json_interface.py +0 -27
  91. amulet/game/abc/version.py +0 -44
  92. amulet/game/bedrock/__init__.py +0 -1
  93. amulet/game/bedrock/_biome.py +0 -35
  94. amulet/game/bedrock/_block.py +0 -42
  95. amulet/game/bedrock/_version.py +0 -165
  96. amulet/game/java/__init__.py +0 -2
  97. amulet/game/java/_biome.py +0 -35
  98. amulet/game/java/_block.py +0 -60
  99. amulet/game/java/_version.py +0 -176
  100. amulet/game/translate/__init__.py +0 -12
  101. amulet/game/translate/_functions/__init__.py +0 -15
  102. amulet/game/translate/_functions/_code_functions/__init__.py +0 -0
  103. amulet/game/translate/_functions/_code_functions/_text.py +0 -553
  104. amulet/game/translate/_functions/_code_functions/banner_pattern.py +0 -67
  105. amulet/game/translate/_functions/_code_functions/bedrock_chest_connection.py +0 -152
  106. amulet/game/translate/_functions/_code_functions/bedrock_moving_block_pos.py +0 -88
  107. amulet/game/translate/_functions/_code_functions/bedrock_sign.py +0 -152
  108. amulet/game/translate/_functions/_code_functions/bedrock_skull_rotation.py +0 -16
  109. amulet/game/translate/_functions/_code_functions/custom_name.py +0 -146
  110. amulet/game/translate/_functions/_frozen.py +0 -66
  111. amulet/game/translate/_functions/_state.py +0 -54
  112. amulet/game/translate/_functions/_typing.py +0 -98
  113. amulet/game/translate/_functions/abc.py +0 -123
  114. amulet/game/translate/_functions/carry_nbt.py +0 -160
  115. amulet/game/translate/_functions/carry_properties.py +0 -80
  116. amulet/game/translate/_functions/code.py +0 -143
  117. amulet/game/translate/_functions/map_block_name.py +0 -66
  118. amulet/game/translate/_functions/map_nbt.py +0 -111
  119. amulet/game/translate/_functions/map_properties.py +0 -93
  120. amulet/game/translate/_functions/multiblock.py +0 -112
  121. amulet/game/translate/_functions/new_block.py +0 -42
  122. amulet/game/translate/_functions/new_entity.py +0 -43
  123. amulet/game/translate/_functions/new_nbt.py +0 -206
  124. amulet/game/translate/_functions/new_properties.py +0 -64
  125. amulet/game/translate/_functions/sequence.py +0 -51
  126. amulet/game/translate/_functions/walk_input_nbt.py +0 -331
  127. amulet/game/translate/_translator.py +0 -433
  128. amulet/img/__init__.py +0 -10
  129. amulet/img/missing_no.png +0 -0
  130. amulet/img/missing_pack.png +0 -0
  131. amulet/img/missing_world.png +0 -0
  132. amulet/io/binary_reader.hpp +0 -45
  133. amulet/io/binary_writer.hpp +0 -30
  134. amulet/item.py +0 -75
  135. amulet/level/__init__.pyi +0 -23
  136. amulet/level/_load.py +0 -100
  137. amulet/level/abc/__init__.py +0 -12
  138. amulet/level/abc/_chunk_handle.py +0 -358
  139. amulet/level/abc/_dimension.py +0 -86
  140. amulet/level/abc/_history/__init__.py +0 -1
  141. amulet/level/abc/_history/_cache.py +0 -224
  142. amulet/level/abc/_history/_history_manager.py +0 -291
  143. amulet/level/abc/_level/__init__.py +0 -5
  144. amulet/level/abc/_level/_compactable_level.py +0 -10
  145. amulet/level/abc/_level/_creatable_level.py +0 -28
  146. amulet/level/abc/_level/_disk_level.py +0 -17
  147. amulet/level/abc/_level/_level.py +0 -449
  148. amulet/level/abc/_level/_loadable_level.py +0 -42
  149. amulet/level/abc/_player_storage.py +0 -7
  150. amulet/level/abc/_raw_level.py +0 -187
  151. amulet/level/abc/_registry.py +0 -40
  152. amulet/level/java/__init__.pyi +0 -16
  153. amulet/level/java/_chunk_handle.py +0 -17
  154. amulet/level/java/_dimension.py +0 -20
  155. amulet/level/java/_level.py +0 -184
  156. amulet/level/java/_raw/__init__.pyi +0 -15
  157. amulet/level/java/_raw/_chunk.pyi +0 -23
  158. amulet/level/java/_raw/_constant.py +0 -9
  159. amulet/level/java/_raw/_data_pack/__init__.py +0 -2
  160. amulet/level/java/_raw/_data_pack/data_pack.py +0 -241
  161. amulet/level/java/_raw/_data_pack/data_pack_manager.py +0 -77
  162. amulet/level/java/_raw/_dimension.py +0 -86
  163. amulet/level/java/_raw/_level.py +0 -507
  164. amulet/level/java/_raw/_typing.py +0 -3
  165. amulet/level/java/_raw/java_chunk_decode.cpp +0 -531
  166. amulet/level/java/_raw/java_chunk_decode.hpp +0 -23
  167. amulet/level/java/_raw/java_chunk_encode.cpp +0 -25
  168. amulet/level/java/_raw/java_chunk_encode.hpp +0 -23
  169. amulet/level/java/anvil/__init__.py +0 -2
  170. amulet/level/java/anvil/_dimension.py +0 -170
  171. amulet/level/java/anvil/_region.py +0 -421
  172. amulet/level/java/anvil/_sector_manager.py +0 -223
  173. amulet/level/java/chunk.pyi +0 -81
  174. amulet/level/java/chunk_/_chunk.py +0 -260
  175. amulet/level/java/chunk_/components/inhabited_time.py +0 -12
  176. amulet/level/java/chunk_/components/last_update.py +0 -12
  177. amulet/level/java/chunk_/components/legacy_version.py +0 -12
  178. amulet/level/java/chunk_/components/light_populated.py +0 -12
  179. amulet/level/java/chunk_/components/named_height_2d.py +0 -37
  180. amulet/level/java/chunk_/components/status.py +0 -11
  181. amulet/level/java/chunk_/components/terrain_populated.py +0 -12
  182. amulet/level/java/chunk_components/data_version_component.cpp +0 -32
  183. amulet/level/java/chunk_components/data_version_component.hpp +0 -31
  184. amulet/level/java/chunk_components/java_raw_chunk_component.cpp +0 -56
  185. amulet/level/java/chunk_components/java_raw_chunk_component.hpp +0 -45
  186. amulet/level/java/chunk_components.pyi +0 -22
  187. amulet/level/java/java_chunk.cpp +0 -170
  188. amulet/level/java/java_chunk.hpp +0 -141
  189. amulet/level/java/long_array.hpp +0 -175
  190. amulet/level/java/long_array.pyi +0 -39
  191. amulet/level/temporary_level/__init__.py +0 -1
  192. amulet/level/temporary_level/_level.py +0 -16
  193. amulet/mesh/__init__.py +0 -0
  194. amulet/mesh/block/__init__.pyi +0 -301
  195. amulet/mesh/block/_cube.py +0 -198
  196. amulet/mesh/block/_missing_block.py +0 -20
  197. amulet/mesh/block/block_mesh.cpp +0 -107
  198. amulet/mesh/block/block_mesh.hpp +0 -207
  199. amulet/mesh/util.py +0 -17
  200. amulet/palette/biome_palette.hpp +0 -85
  201. amulet/palette/block_palette.cpp +0 -32
  202. amulet/palette/block_palette.hpp +0 -93
  203. amulet/player.py +0 -62
  204. amulet/pybind11/collections.hpp +0 -118
  205. amulet/pybind11/numpy.hpp +0 -26
  206. amulet/pybind11/py_module.hpp +0 -34
  207. amulet/pybind11/type_hints.hpp +0 -51
  208. amulet/pybind11/types.hpp +0 -25
  209. amulet/pybind11/typing.hpp +0 -7
  210. amulet/resource_pack/__init__.py +0 -63
  211. amulet/resource_pack/abc/__init__.py +0 -2
  212. amulet/resource_pack/abc/resource_pack.py +0 -38
  213. amulet/resource_pack/abc/resource_pack_manager.py +0 -85
  214. amulet/resource_pack/java/__init__.py +0 -2
  215. amulet/resource_pack/java/download_resources.py +0 -212
  216. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
  217. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
  218. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
  219. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
  220. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
  221. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
  222. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
  223. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
  224. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
  225. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
  226. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
  227. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
  228. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
  229. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
  230. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
  231. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
  232. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
  233. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
  234. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
  235. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
  236. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
  237. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
  238. amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
  239. amulet/resource_pack/java/resource_pack.py +0 -44
  240. amulet/resource_pack/java/resource_pack_manager.py +0 -563
  241. amulet/resource_pack/unknown_resource_pack.py +0 -10
  242. amulet/selection/__init__.py +0 -2
  243. amulet/selection/abstract_selection.py +0 -342
  244. amulet/selection/box.py +0 -852
  245. amulet/selection/group.py +0 -481
  246. amulet/utils/__init__.pyi +0 -23
  247. amulet/utils/call_spec/__init__.py +0 -24
  248. amulet/utils/call_spec/_call_spec.py +0 -257
  249. amulet/utils/cast.py +0 -10
  250. amulet/utils/comment_json.py +0 -188
  251. amulet/utils/format_utils.py +0 -41
  252. amulet/utils/generator.py +0 -18
  253. amulet/utils/matrix.py +0 -243
  254. amulet/utils/numpy.hpp +0 -36
  255. amulet/utils/numpy.pyi +0 -11
  256. amulet/utils/numpy_helpers.py +0 -19
  257. amulet/utils/shareable_lock.py +0 -335
  258. amulet/utils/signal/__init__.py +0 -10
  259. amulet/utils/signal/_signal.py +0 -228
  260. amulet/utils/task_manager.py +0 -235
  261. amulet/utils/typed_property.py +0 -111
  262. amulet/utils/weakref.py +0 -70
  263. amulet/utils/world_utils.py +0 -102
  264. amulet/version.cpp +0 -136
  265. amulet/version.hpp +0 -142
  266. amulet/version.py.cpp +0 -281
  267. amulet_core-2.0a8.dist-info/RECORD +0 -241
  268. amulet_core-2.0a8.dist-info/entry_points.txt +0 -2
  269. /amulet/{__pyinstaller → core/__pyinstaller}/__init__.py +0 -0
  270. /amulet/{py.typed → core/py.typed} +0 -0
  271. {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/top_level.txt +0 -0
@@ -1,152 +0,0 @@
1
- from typing import Callable, Any
2
- from amulet_nbt import CompoundTag, IntTag, ByteTag, StringTag, AbstractBaseTag
3
- from .._state import SrcData, StateData, DstData
4
-
5
-
6
- def _bedrock_chest_connection(
7
- facing_property: str, connections: dict[tuple[Any, int, int], StringTag]
8
- ) -> Callable[[SrcData, StateData, DstData], None]:
9
- def main(src: SrcData, state: StateData, dst: DstData) -> None:
10
- nbt = src.nbt
11
- if nbt is None:
12
- return
13
-
14
- tag = nbt.tag
15
- if not isinstance(tag, CompoundTag):
16
- return
17
-
18
- if tag.get("pairlead") != ByteTag(1):
19
- return
20
-
21
- pairx = tag.get("pairx")
22
- if not isinstance(pairx, IntTag):
23
- return
24
-
25
- pairz = tag.get("pairz")
26
- if not isinstance(pairz, IntTag):
27
- return
28
-
29
- block = src.block
30
- if block is None:
31
- return
32
- extra = src.extra
33
- if extra is None:
34
- dst.extra_needed = True
35
- return
36
-
37
- facing_direction = block.properties.get(facing_property)
38
- if not isinstance(facing_direction, AbstractBaseTag):
39
- return
40
-
41
- dx = pairx.py_int - extra.absolute_coordinates[0]
42
- dz = pairz.py_int - extra.absolute_coordinates[2]
43
-
44
- connection = connections.get((facing_direction.py_data, dx, dz))
45
- if connection is None:
46
- return
47
- dst.properties["connection"] = connection
48
-
49
- return main
50
-
51
-
52
- bedrock_chest_connection_other_left = _bedrock_chest_connection(
53
- "facing_direction",
54
- {
55
- (2, -1, 0): StringTag("left"), # north
56
- (3, 1, 0): StringTag("left"), # south
57
- (4, 0, 1): StringTag("left"), # west
58
- (5, 0, -1): StringTag("left"), # east
59
- },
60
- )
61
-
62
- bedrock_chest_connection_other_right = _bedrock_chest_connection(
63
- "facing_direction",
64
- {
65
- (2, 1, 0): StringTag("right"), # north
66
- (3, -1, 0): StringTag("right"), # south
67
- (4, 0, -1): StringTag("right"), # west
68
- (5, 0, 1): StringTag("right"), # east
69
- },
70
- )
71
-
72
- bedrock_chest_connection_self = _bedrock_chest_connection(
73
- "facing_direction",
74
- {
75
- (2, -1, 0): StringTag("right"), # north
76
- (2, 1, 0): StringTag("left"), # north
77
- (3, 1, 0): StringTag("right"), # south
78
- (3, -1, 0): StringTag("left"), # south
79
- (4, 0, 1): StringTag("right"), # west
80
- (4, 0, -1): StringTag("left"), # west
81
- (5, 0, -1): StringTag("right"), # east
82
- (5, 0, 1): StringTag("left"), # east
83
- },
84
- )
85
-
86
- bedrock_chest_connection_other_left_120 = _bedrock_chest_connection(
87
- "minecraft:cardinal_direction",
88
- {
89
- ("north", -1, 0): StringTag("left"), # north
90
- ("south", 1, 0): StringTag("left"), # south
91
- ("west", 0, 1): StringTag("left"), # west
92
- ("east", 0, -1): StringTag("left"), # east
93
- },
94
- )
95
-
96
- bedrock_chest_connection_other_right_120 = _bedrock_chest_connection(
97
- "minecraft:cardinal_direction",
98
- {
99
- ("north", 1, 0): StringTag("right"), # north
100
- ("south", -1, 0): StringTag("right"), # south
101
- ("west", 0, -1): StringTag("right"), # west
102
- ("east", 0, 1): StringTag("right"), # east
103
- },
104
- )
105
-
106
- bedrock_chest_connection_self_120 = _bedrock_chest_connection(
107
- "minecraft:cardinal_direction",
108
- {
109
- ("north", -1, 0): StringTag("right"), # north
110
- ("north", 1, 0): StringTag("left"), # north
111
- ("south", 1, 0): StringTag("right"), # south
112
- ("south", -1, 0): StringTag("left"), # south
113
- ("west", 0, 1): StringTag("right"), # west
114
- ("west", 0, -1): StringTag("left"), # west
115
- ("east", 0, -1): StringTag("right"), # east
116
- ("east", 0, 1): StringTag("left"), # east
117
- },
118
- )
119
-
120
-
121
- def from_universal(src: SrcData, state: StateData, dst: DstData) -> None:
122
- block = src.block
123
- if block is None:
124
- return
125
-
126
- extra = src.extra
127
- if extra is None:
128
- dst.extra_needed = True
129
- return
130
-
131
- facing = block.properties.get("facing")
132
- if not isinstance(facing, StringTag):
133
- return
134
-
135
- x, _, z = extra.absolute_coordinates
136
- facing_str = facing.py_str
137
- if facing_str == "north":
138
- dst.nbt.append(("", CompoundTag, (), "pairlead", ByteTag(1)))
139
- dst.nbt.append(("", CompoundTag, (), "pairx", IntTag(x - 1)))
140
- dst.nbt.append(("", CompoundTag, (), "pairz", IntTag(z)))
141
- elif facing_str == "south":
142
- dst.nbt.append(("", CompoundTag, (), "pairlead", ByteTag(1)))
143
- dst.nbt.append(("", CompoundTag, (), "pairx", IntTag(x + 1)))
144
- dst.nbt.append(("", CompoundTag, (), "pairz", IntTag(z)))
145
- elif facing_str == "west":
146
- dst.nbt.append(("", CompoundTag, (), "pairlead", ByteTag(1)))
147
- dst.nbt.append(("", CompoundTag, (), "pairx", IntTag(x)))
148
- dst.nbt.append(("", CompoundTag, (), "pairz", IntTag(z + 1)))
149
- elif facing_str == "east":
150
- dst.nbt.append(("", CompoundTag, (), "pairlead", ByteTag(1)))
151
- dst.nbt.append(("", CompoundTag, (), "pairx", IntTag(x)))
152
- dst.nbt.append(("", CompoundTag, (), "pairz", IntTag(z - 1)))
@@ -1,88 +0,0 @@
1
- from amulet_nbt import CompoundTag, IntTag
2
- from .._state import SrcData, StateData, DstData
3
-
4
-
5
- def to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
6
- if src.extra is None:
7
- return
8
-
9
- x, y, z = src.extra.absolute_coordinates
10
-
11
- nbt = src.nbt
12
- if nbt is None:
13
- return
14
-
15
- tag = nbt.tag
16
- if not isinstance(tag, CompoundTag):
17
- return
18
-
19
- pistonPosX = tag.get("pistonPosX")
20
- if not isinstance(pistonPosX, IntTag):
21
- return
22
- pistonPosY = tag.get("pistonPosY")
23
- if not isinstance(pistonPosY, IntTag):
24
- return
25
- pistonPosZ = tag.get("pistonPosZ")
26
- if not isinstance(pistonPosZ, IntTag):
27
- return
28
-
29
- dst.nbt.append(
30
- (
31
- "",
32
- CompoundTag,
33
- (("utags", CompoundTag),),
34
- "pistonPosdX",
35
- IntTag(pistonPosX.py_int - x),
36
- )
37
- )
38
- dst.nbt.append(
39
- (
40
- "",
41
- CompoundTag,
42
- (("utags", CompoundTag),),
43
- "pistonPosdY",
44
- IntTag(pistonPosY.py_int - y),
45
- )
46
- )
47
- dst.nbt.append(
48
- (
49
- "",
50
- CompoundTag,
51
- (("utags", CompoundTag),),
52
- "pistonPosdZ",
53
- IntTag(pistonPosZ.py_int - z),
54
- )
55
- )
56
-
57
-
58
- def from_universal(src: SrcData, state: StateData, dst: DstData) -> None:
59
- if src.extra is None:
60
- return
61
-
62
- x, y, z = src.extra.absolute_coordinates
63
-
64
- nbt = src.nbt
65
- if nbt is None:
66
- return
67
-
68
- tag = nbt.tag
69
- if not isinstance(tag, CompoundTag):
70
- return
71
-
72
- utags = tag.get("utags")
73
- if not isinstance(utags, CompoundTag):
74
- return
75
-
76
- pistonPosdX = utags.get("pistonPosdX")
77
- if not isinstance(pistonPosdX, IntTag):
78
- return
79
- pistonPosdY = utags.get("pistonPosdY")
80
- if not isinstance(pistonPosdY, IntTag):
81
- return
82
- pistonPosdZ = utags.get("pistonPosdZ")
83
- if not isinstance(pistonPosdZ, IntTag):
84
- return
85
-
86
- dst.nbt.append(("", CompoundTag, (), "pistonPosX", IntTag(pistonPosdX.py_int + x)))
87
- dst.nbt.append(("", CompoundTag, (), "pistonPosY", IntTag(pistonPosdY.py_int + y)))
88
- dst.nbt.append(("", CompoundTag, (), "pistonPosZ", IntTag(pistonPosdZ.py_int + z)))
@@ -1,152 +0,0 @@
1
- import json
2
- from typing import Any
3
- from uuid import uuid4
4
-
5
- from amulet_nbt import StringTag, CompoundTag, ListTag
6
- from ._text import RawTextComponent, ExtendedBedrockSectionParser
7
- from .._state import SrcData, StateData, DstData
8
-
9
-
10
- BedrockFrontText = str(uuid4())
11
- BedrockBackText = str(uuid4())
12
-
13
-
14
- def _to_universal(
15
- src: CompoundTag,
16
- src_key: str,
17
- dst: DstData,
18
- universal_native_key: str,
19
- universal_key: str,
20
- ) -> None:
21
- text = src.get_string(src_key)
22
- if not isinstance(text, StringTag):
23
- return
24
-
25
- dst.nbt.append(
26
- (
27
- "",
28
- CompoundTag,
29
- (("utags", CompoundTag),),
30
- universal_native_key,
31
- text,
32
- )
33
- )
34
-
35
- if text:
36
- for line_num, component in enumerate(
37
- RawTextComponent.from_section_text(
38
- text.py_str, ExtendedBedrockSectionParser, True
39
- )
40
- ):
41
- dst.nbt.append(
42
- (
43
- "",
44
- CompoundTag,
45
- (
46
- ("utags", CompoundTag),
47
- (universal_key, CompoundTag),
48
- ("messages", ListTag),
49
- ),
50
- line_num,
51
- StringTag(json.dumps(component.to_java_raw_text())),
52
- )
53
- )
54
-
55
-
56
- def _from_universal(
57
- utags: CompoundTag,
58
- universal_native_key: str,
59
- universal_key: str,
60
- dst: DstData,
61
- native_key: str,
62
- ) -> None:
63
- native_text = utags.get_string(universal_native_key)
64
- text: StringTag
65
- if isinstance(native_text, StringTag):
66
- text = native_text
67
- else:
68
- messages = utags.get_compound(universal_key, CompoundTag()).get_list(
69
- "messages", ListTag()
70
- )
71
-
72
- lines: list[Any] = [""]
73
- if messages.element_class is StringTag:
74
- for line_num in range(4):
75
- if line_num >= len(messages):
76
- lines.append("")
77
- else:
78
- try:
79
- lines.append(json.loads(messages.get_string(line_num).py_str))
80
- except:
81
- lines.append("")
82
- else:
83
- lines.extend([""] * 4)
84
-
85
- text = StringTag(
86
- RawTextComponent.from_java_raw_text(lines).to_section_text(
87
- ExtendedBedrockSectionParser
88
- )
89
- )
90
-
91
- dst.nbt.append(
92
- (
93
- "",
94
- CompoundTag,
95
- (),
96
- native_key,
97
- text,
98
- )
99
- )
100
-
101
-
102
- def to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
103
- nbt = src.nbt
104
- if nbt is None:
105
- return
106
-
107
- tag = nbt.tag
108
- if not isinstance(tag, CompoundTag):
109
- return
110
-
111
- _to_universal(tag, "Text", dst, BedrockFrontText, "front_text")
112
-
113
-
114
- def from_universal(src: SrcData, state: StateData, dst: DstData) -> None:
115
- nbt = src.nbt
116
- if nbt is not None:
117
- tag = nbt.tag
118
- if isinstance(tag, CompoundTag):
119
- utags = tag.get_compound("utags")
120
- if isinstance(utags, CompoundTag):
121
- _from_universal(utags, BedrockFrontText, "front_text", dst, "Text")
122
- return
123
-
124
- dst.nbt.append(("", CompoundTag, (), "Text", StringTag()))
125
-
126
-
127
- def to_universal_120(src: SrcData, state: StateData, dst: DstData) -> None:
128
- nbt = src.nbt
129
- if nbt is None:
130
- return
131
-
132
- tag = nbt.tag
133
- if not isinstance(tag, CompoundTag):
134
- return
135
-
136
- _to_universal(tag, "FrontText", dst, BedrockFrontText, "front_text")
137
- _to_universal(tag, "BackText", dst, BedrockBackText, "back_text")
138
-
139
-
140
- def from_universal_120(src: SrcData, state: StateData, dst: DstData) -> None:
141
- nbt = src.nbt
142
- if nbt is not None:
143
- tag = nbt.tag
144
- if isinstance(tag, CompoundTag):
145
- utags = tag.get_compound("utags")
146
- if isinstance(utags, CompoundTag):
147
- _from_universal(utags, BedrockFrontText, "front_text", dst, "FrontText")
148
- _from_universal(utags, BedrockBackText, "back_text", dst, "BackText")
149
- return
150
-
151
- dst.nbt.append(("", CompoundTag, (), "FrontText", StringTag()))
152
- dst.nbt.append(("", CompoundTag, (), "BackText", StringTag()))
@@ -1,16 +0,0 @@
1
- from amulet_nbt import CompoundTag, FloatTag, StringTag
2
- from .._state import SrcData, StateData, DstData
3
-
4
-
5
- def to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
6
- nbt = src.nbt
7
- if nbt is not None:
8
- tag = nbt.tag
9
- if isinstance(tag, CompoundTag):
10
- rotation = tag.get("Rotation")
11
- if isinstance(rotation, FloatTag):
12
- dst.properties["rotation"] = StringTag(
13
- f"{int(rotation.py_float // 22.5) % 16}"
14
- )
15
- return
16
- dst.properties["rotation"] = StringTag("0")
@@ -1,146 +0,0 @@
1
- from uuid import uuid4
2
- import json
3
- from typing import Callable
4
-
5
- from amulet_nbt import CompoundTag, StringTag
6
-
7
- from .._state import SrcData, StateData, DstData
8
- from ._text import (
9
- RawTextComponent,
10
- BedrockSectionParser,
11
- ExtendedBedrockSectionParser,
12
- JavaSectionParser,
13
- )
14
-
15
-
16
- JavaSectionText = str(uuid4())
17
- JavaRawText = str(uuid4())
18
- BedrockSectionText = str(uuid4())
19
- BedrockExtendedSectionText = str(uuid4())
20
-
21
-
22
- def get_custom_name(src: SrcData, dst: DstData, key: str) -> None:
23
- nbt = src.nbt
24
- if nbt is None:
25
- return
26
-
27
- tag = nbt.tag
28
- if not isinstance(tag, CompoundTag):
29
- return
30
-
31
- custom_name = tag.get("CustomName")
32
- if not isinstance(custom_name, StringTag):
33
- return
34
-
35
- # Store the raw value so we can non-destructively recover it
36
- dst.nbt.append(("", CompoundTag, (("utags", CompoundTag),), key, custom_name))
37
-
38
-
39
- def java_section_to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
40
- get_custom_name(src, dst, JavaSectionText)
41
-
42
-
43
- def java_raw_to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
44
- get_custom_name(src, dst, JavaRawText)
45
-
46
-
47
- def bedrock_to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
48
- get_custom_name(src, dst, BedrockSectionText)
49
-
50
-
51
- def bedrock_extended_to_universal(src: SrcData, state: StateData, dst: DstData) -> None:
52
- get_custom_name(src, dst, BedrockExtendedSectionText)
53
-
54
-
55
- def set_custom_name(
56
- src: SrcData,
57
- dst: DstData,
58
- target: str,
59
- component_to_raw: Callable[[RawTextComponent], StringTag],
60
- ) -> None:
61
- nbt = src.nbt
62
- if nbt is None:
63
- return
64
-
65
- tag = nbt.tag
66
- if not isinstance(tag, CompoundTag):
67
- return
68
-
69
- utags = tag.get("utags")
70
- if not isinstance(utags, CompoundTag):
71
- return
72
-
73
- if isinstance((native_custom_name := utags.get(target)), StringTag):
74
- custom_name = native_custom_name
75
- elif isinstance(
76
- (java_section_custom_name := utags.get(JavaSectionText)), StringTag
77
- ):
78
- component = RawTextComponent.from_section_text(
79
- java_section_custom_name.py_str, JavaSectionParser
80
- )
81
- custom_name = component_to_raw(component)
82
- elif isinstance((java_raw_custom_name := utags.get(JavaRawText)), StringTag):
83
- try:
84
- component = RawTextComponent.from_java_raw_text(
85
- json.loads(java_raw_custom_name.py_str)
86
- )
87
- except:
88
- custom_name = StringTag()
89
- else:
90
- custom_name = component_to_raw(component)
91
-
92
- elif isinstance((bedrock_custom_name := utags.get(BedrockSectionText)), StringTag):
93
- component = RawTextComponent.from_section_text(
94
- bedrock_custom_name.py_str, BedrockSectionParser
95
- )
96
- custom_name = component_to_raw(component)
97
- elif isinstance(
98
- (bedrock_extended_custom_name := utags.get(BedrockExtendedSectionText)),
99
- StringTag,
100
- ):
101
- component = RawTextComponent.from_section_text(
102
- bedrock_extended_custom_name.py_str, ExtendedBedrockSectionParser
103
- )
104
- custom_name = component_to_raw(component)
105
- else:
106
- custom_name = StringTag()
107
-
108
- dst.nbt.append(
109
- (
110
- "",
111
- CompoundTag,
112
- (),
113
- "CustomName",
114
- custom_name,
115
- )
116
- )
117
-
118
-
119
- def java_section_from_universal(src: SrcData, state: StateData, dst: DstData) -> None:
120
- def component_to_raw(component: RawTextComponent) -> StringTag:
121
- return StringTag(component.to_section_text(JavaSectionParser))
122
-
123
- set_custom_name(src, dst, JavaSectionText, component_to_raw)
124
-
125
-
126
- def java_raw_from_universal(src: SrcData, state: StateData, dst: DstData) -> None:
127
- def component_to_raw(component: RawTextComponent) -> StringTag:
128
- return StringTag(json.dumps(component.to_java_raw_text()))
129
-
130
- set_custom_name(src, dst, JavaSectionText, component_to_raw)
131
-
132
-
133
- def bedrock_from_universal(src: SrcData, state: StateData, dst: DstData) -> None:
134
- def component_to_raw(component: RawTextComponent) -> StringTag:
135
- return StringTag(component.to_section_text(BedrockSectionParser))
136
-
137
- set_custom_name(src, dst, BedrockSectionText, component_to_raw)
138
-
139
-
140
- def bedrock_extended_from_universal(
141
- src: SrcData, state: StateData, dst: DstData
142
- ) -> None:
143
- def component_to_raw(component: RawTextComponent) -> StringTag:
144
- return StringTag(component.to_section_text(ExtendedBedrockSectionParser))
145
-
146
- set_custom_name(src, dst, BedrockExtendedSectionText, component_to_raw)
@@ -1,66 +0,0 @@
1
- from typing import TypeVar, Any
2
- from collections.abc import Mapping, Iterator, Hashable, Set, Iterable
3
-
4
- K = TypeVar("K", bound=Hashable)
5
- V = TypeVar("V", bound=Hashable)
6
-
7
-
8
- class FrozenMapping(Mapping[K, V], Hashable):
9
- """
10
- A hashable Mapping class.
11
- All values in the mapping must be hashable.
12
- """
13
-
14
- _map: Mapping[K, V]
15
- _h: int | None
16
-
17
- def __init__(self, mapping: Mapping) -> None:
18
- self._map: dict[K, V] = dict(mapping)
19
- self._h = None
20
-
21
- def __getitem__(self, k: K) -> V:
22
- return self._map[k]
23
-
24
- def __len__(self) -> int:
25
- return len(self._map)
26
-
27
- def __iter__(self) -> Iterator[K]:
28
- return iter(self._map)
29
-
30
- def __hash__(self) -> int:
31
- if self._h is None:
32
- self._h = hash(frozenset(self._map.items()))
33
- return self._h
34
-
35
- def __eq__(self, other: Any) -> bool:
36
- if not isinstance(other, Mapping):
37
- return NotImplemented
38
- return self._map == other
39
-
40
-
41
- class OrderedFrozenSet(Set[K], Hashable):
42
- _map: dict[K, None]
43
- _h: int | None
44
-
45
- def __init__(self, items: Iterable[K]) -> None:
46
- self._map = dict.fromkeys(items)
47
- self._h = None
48
-
49
- def __contains__(self, item: Any) -> bool:
50
- return item in self._map
51
-
52
- def __len__(self) -> int:
53
- return len(self._map)
54
-
55
- def __iter__(self) -> Iterator[K]:
56
- yield from self._map
57
-
58
- def __hash__(self) -> int:
59
- if self._h is None:
60
- self._h = hash(tuple(self._map))
61
- return self._h
62
-
63
- def __eq__(self, other: Any) -> bool:
64
- if not isinstance(other, Set):
65
- return NotImplemented
66
- return self._map.keys() == other
@@ -1,54 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Union, Callable
4
- from dataclasses import dataclass, field
5
-
6
- from amulet_nbt import (
7
- NamedTag,
8
- ListTag,
9
- CompoundTag,
10
- )
11
-
12
- from amulet.block import Block, PropertyValueType
13
- from amulet.block_entity import BlockEntity
14
- from amulet.entity import Entity
15
- from amulet.data_types import BlockCoordinates
16
- from ._typing import NBTTagT, NBTPath
17
-
18
-
19
- @dataclass(frozen=True)
20
- class SrcDataExtra:
21
- absolute_coordinates: BlockCoordinates
22
- get_block_callback: Callable[[BlockCoordinates], tuple[Block, BlockEntity | None]]
23
-
24
-
25
- @dataclass(frozen=True)
26
- class SrcData:
27
- block: Block | None
28
- nbt: NamedTag | None
29
- extra: SrcDataExtra | None
30
-
31
-
32
- @dataclass
33
- class StateData:
34
- relative_location: BlockCoordinates = (0, 0, 0)
35
- # nbt_path is only set when within walk_input_nbt
36
- nbt_path: tuple[str, type[ListTag] | type[CompoundTag], NBTPath] | None = None
37
-
38
-
39
- @dataclass
40
- class DstData:
41
- cls: type[Block] | type[Entity] | None = None
42
- resource_id: tuple[str, str] | None = None
43
- properties: dict[str, PropertyValueType] = field(default_factory=dict)
44
- nbt: list[
45
- tuple[
46
- str,
47
- type[ListTag] | type[CompoundTag],
48
- NBTPath,
49
- Union[str, int],
50
- NBTTagT,
51
- ]
52
- ] = field(default_factory=list)
53
- extra_needed: bool = False
54
- cacheable: bool = True