amulet-core 2.0a7__cp312-cp312-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a0__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 (325) 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.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/METADATA +25 -20
  40. amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/RECORD +45 -0
  41. {amulet_core-2.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/WHEEL +1 -1
  42. amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/entry_points.txt +2 -0
  43. amulet/__init__.cp312-win_amd64.pyd +0 -0
  44. amulet/__init__.py.cpp +0 -43
  45. amulet/__init__.pyi +0 -28
  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 -99
  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 -335
  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__.py +0 -1
  195. amulet/mesh/block/block_mesh.py +0 -369
  196. amulet/mesh/block/cube.py +0 -149
  197. amulet/mesh/block/missing_block.py +0 -20
  198. amulet/mesh/util.py +0 -17
  199. amulet/palette/biome_palette.hpp +0 -85
  200. amulet/palette/block_palette.cpp +0 -32
  201. amulet/palette/block_palette.hpp +0 -93
  202. amulet/player.py +0 -62
  203. amulet/pybind11/collections.hpp +0 -118
  204. amulet/pybind11/numpy.hpp +0 -26
  205. amulet/pybind11/py_module.hpp +0 -34
  206. amulet/pybind11/type_hints.hpp +0 -51
  207. amulet/pybind11/types.hpp +0 -25
  208. amulet/pybind11/typing.hpp +0 -7
  209. amulet/resource_pack/__init__.py +0 -62
  210. amulet/resource_pack/abc/__init__.py +0 -2
  211. amulet/resource_pack/abc/resource_pack.py +0 -38
  212. amulet/resource_pack/abc/resource_pack_manager.py +0 -87
  213. amulet/resource_pack/bedrock/__init__.py +0 -2
  214. amulet/resource_pack/bedrock/bedrock_vanilla_fix/pack_icon.png +0 -0
  215. amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_carried.png +0 -0
  216. amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_side_carried.png +0 -0
  217. amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/water.png +0 -0
  218. amulet/resource_pack/bedrock/blockshapes/__init__.py +0 -31
  219. amulet/resource_pack/bedrock/blockshapes/air.py +0 -35
  220. amulet/resource_pack/bedrock/blockshapes/base_blockshape.py +0 -29
  221. amulet/resource_pack/bedrock/blockshapes/bubble_column.py +0 -29
  222. amulet/resource_pack/bedrock/blockshapes/cake.py +0 -46
  223. amulet/resource_pack/bedrock/blockshapes/chest.py +0 -54
  224. amulet/resource_pack/bedrock/blockshapes/comparator.py +0 -51
  225. amulet/resource_pack/bedrock/blockshapes/cross_texture.py +0 -186
  226. amulet/resource_pack/bedrock/blockshapes/cross_texture0.py +0 -17
  227. amulet/resource_pack/bedrock/blockshapes/cross_texture_green.py +0 -16
  228. amulet/resource_pack/bedrock/blockshapes/cube.py +0 -38
  229. amulet/resource_pack/bedrock/blockshapes/default.py +0 -14
  230. amulet/resource_pack/bedrock/blockshapes/door.py +0 -38
  231. amulet/resource_pack/bedrock/blockshapes/door1.py +0 -14
  232. amulet/resource_pack/bedrock/blockshapes/door2.py +0 -14
  233. amulet/resource_pack/bedrock/blockshapes/door3.py +0 -14
  234. amulet/resource_pack/bedrock/blockshapes/door4.py +0 -14
  235. amulet/resource_pack/bedrock/blockshapes/door5.py +0 -14
  236. amulet/resource_pack/bedrock/blockshapes/door6.py +0 -14
  237. amulet/resource_pack/bedrock/blockshapes/double_plant.py +0 -40
  238. amulet/resource_pack/bedrock/blockshapes/enchanting_table.py +0 -22
  239. amulet/resource_pack/bedrock/blockshapes/farmland.py +0 -22
  240. amulet/resource_pack/bedrock/blockshapes/fence.py +0 -22
  241. amulet/resource_pack/bedrock/blockshapes/flat.py +0 -55
  242. amulet/resource_pack/bedrock/blockshapes/flat_wall.py +0 -55
  243. amulet/resource_pack/bedrock/blockshapes/furnace.py +0 -44
  244. amulet/resource_pack/bedrock/blockshapes/furnace_lit.py +0 -14
  245. amulet/resource_pack/bedrock/blockshapes/green_cube.py +0 -39
  246. amulet/resource_pack/bedrock/blockshapes/ladder.py +0 -36
  247. amulet/resource_pack/bedrock/blockshapes/lilypad.py +0 -14
  248. amulet/resource_pack/bedrock/blockshapes/partial_block.py +0 -57
  249. amulet/resource_pack/bedrock/blockshapes/piston.py +0 -44
  250. amulet/resource_pack/bedrock/blockshapes/piston_arm.py +0 -72
  251. amulet/resource_pack/bedrock/blockshapes/portal_frame.py +0 -22
  252. amulet/resource_pack/bedrock/blockshapes/pressure_plate.py +0 -29
  253. amulet/resource_pack/bedrock/blockshapes/pumpkin.py +0 -36
  254. amulet/resource_pack/bedrock/blockshapes/pumpkin_carved.py +0 -14
  255. amulet/resource_pack/bedrock/blockshapes/pumpkin_lit.py +0 -14
  256. amulet/resource_pack/bedrock/blockshapes/red_dust.py +0 -14
  257. amulet/resource_pack/bedrock/blockshapes/repeater.py +0 -53
  258. amulet/resource_pack/bedrock/blockshapes/slab.py +0 -33
  259. amulet/resource_pack/bedrock/blockshapes/slab_double.py +0 -15
  260. amulet/resource_pack/bedrock/blockshapes/tree.py +0 -41
  261. amulet/resource_pack/bedrock/blockshapes/turtle_egg.py +0 -15
  262. amulet/resource_pack/bedrock/blockshapes/vine.py +0 -52
  263. amulet/resource_pack/bedrock/blockshapes/wall.py +0 -22
  264. amulet/resource_pack/bedrock/blockshapes/water.py +0 -38
  265. amulet/resource_pack/bedrock/download_resources.py +0 -147
  266. amulet/resource_pack/bedrock/resource_pack.py +0 -40
  267. amulet/resource_pack/bedrock/resource_pack_manager.py +0 -361
  268. amulet/resource_pack/bedrock/sort_blockshapes.py +0 -15
  269. amulet/resource_pack/java/__init__.py +0 -2
  270. amulet/resource_pack/java/download_resources.py +0 -212
  271. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
  272. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
  273. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
  274. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
  275. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
  276. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
  277. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
  278. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
  279. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
  280. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
  281. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
  282. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
  283. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
  284. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
  285. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
  286. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
  287. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
  288. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
  289. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
  290. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
  291. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
  292. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
  293. amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
  294. amulet/resource_pack/java/resource_pack.py +0 -44
  295. amulet/resource_pack/java/resource_pack_manager.py +0 -551
  296. amulet/resource_pack/unknown_resource_pack.py +0 -10
  297. amulet/selection/__init__.py +0 -2
  298. amulet/selection/abstract_selection.py +0 -342
  299. amulet/selection/box.py +0 -852
  300. amulet/selection/group.py +0 -481
  301. amulet/utils/__init__.pyi +0 -23
  302. amulet/utils/call_spec/__init__.py +0 -24
  303. amulet/utils/call_spec/_call_spec.py +0 -257
  304. amulet/utils/comment_json.py +0 -188
  305. amulet/utils/format_utils.py +0 -41
  306. amulet/utils/generator.py +0 -18
  307. amulet/utils/matrix.py +0 -243
  308. amulet/utils/numpy.hpp +0 -36
  309. amulet/utils/numpy.pyi +0 -11
  310. amulet/utils/numpy_helpers.py +0 -19
  311. amulet/utils/shareable_lock.py +0 -335
  312. amulet/utils/signal/__init__.py +0 -10
  313. amulet/utils/signal/_signal.py +0 -228
  314. amulet/utils/task_manager.py +0 -235
  315. amulet/utils/typed_property.py +0 -111
  316. amulet/utils/weakref.py +0 -70
  317. amulet/utils/world_utils.py +0 -102
  318. amulet/version.cpp +0 -136
  319. amulet/version.hpp +0 -142
  320. amulet/version.py.cpp +0 -281
  321. amulet_core-2.0a7.dist-info/RECORD +0 -295
  322. amulet_core-2.0a7.dist-info/entry_points.txt +0 -2
  323. /amulet/{__pyinstaller → core/__pyinstaller}/__init__.py +0 -0
  324. /amulet/{py.typed → core/py.typed} +0 -0
  325. {amulet_core-2.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/top_level.txt +0 -0
@@ -1,39 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import numpy
4
- import numpy.typing
5
- import typing_extensions
6
-
7
- __all__ = ["decode_long_array", "encode_long_array"]
8
-
9
- def decode_long_array(
10
- long_array: typing_extensions.Buffer,
11
- size: int,
12
- bits_per_entry: int,
13
- dense: bool = True,
14
- ) -> numpy.ndarray:
15
- """
16
- Decode a long array (from BlockStates or Heightmaps)
17
-
18
- :param long_array: Encoded long array
19
- :param size: The expected size of the returned array
20
- :param bits_per_entry: The number of bits per entry in the encoded array.
21
- :param dense: If true the long arrays will be treated as a bit stream. If false they are distinct values with padding
22
- :return: Decoded array as numpy array
23
- """
24
-
25
- def encode_long_array(
26
- array: typing_extensions.Buffer,
27
- bits_per_entry: None | int = None,
28
- dense: bool = True,
29
- min_bits_per_entry: int = 1,
30
- ) -> numpy.typing.NDArray[numpy.uint64]:
31
- """
32
- Encode a long array (from BlockStates or Heightmaps)
33
-
34
- :param array: A numpy array of the data to be encoded.
35
- :param bits_per_entry: The number of bits to use to store each value. If left as None will use the smallest bits per entry.
36
- :param dense: If true the long arrays will be treated as a bit stream. If false they are distinct values with padding
37
- :param min_bits_per_entry: The mimimum value that bits_per_entry can be. If it is less than this it will be capped at this value.
38
- :return: Encoded array as numpy array
39
- """
@@ -1 +0,0 @@
1
- from ._level import TemporaryLevel
@@ -1,16 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Any
4
- from amulet.level.abc import Level, CreatableLevel
5
- from amulet.utils.call_spec import method_spec
6
-
7
-
8
- class TemporaryLevel(Level, CreatableLevel):
9
- """A temporary level that exists only in memory."""
10
-
11
- __slots__ = ()
12
-
13
- @classmethod
14
- @method_spec()
15
- def create(cls, *args: Any, **kwargs: Any) -> TemporaryLevel:
16
- raise NotImplementedError
amulet/mesh/__init__.py DELETED
File without changes
@@ -1 +0,0 @@
1
- from .block_mesh import BlockMesh
@@ -1,369 +0,0 @@
1
- from __future__ import annotations
2
- from typing import Optional, Any
3
- from collections.abc import Iterable
4
- import numpy
5
- import itertools
6
- from enum import IntEnum
7
-
8
- from amulet.mesh.util import rotate_3d
9
-
10
- FACE_KEYS = {"down", "up", "north", "east", "south", "west", None}
11
-
12
-
13
- def _create_cull_map() -> dict[tuple[int, int], dict[Optional[str], Optional[str]]]:
14
- cull_remap_ = {}
15
- roty_map = ["north", "east", "south", "west"]
16
- for roty in range(-3, 4):
17
- for rotx in range(-3, 4):
18
- roty_map_rotated = roty_map[roty:] + roty_map[:roty]
19
- rotx_map = [roty_map_rotated[0], "down", roty_map_rotated[2], "up"]
20
- rotx_map_rotated = rotx_map[rotx:] + rotx_map[:rotx]
21
- roty_remap = dict(zip(roty_map, roty_map_rotated))
22
- rotx_remap = dict(zip(rotx_map, rotx_map_rotated))
23
- cull_remap_value: dict[Optional[str], Optional[str]] = {}
24
- cull_remap_[(roty, rotx)] = cull_remap_value
25
- for key in FACE_KEYS:
26
- if key is None:
27
- cull_remap_value[key] = None
28
- else:
29
- roty_value = roty_remap.get(key, key)
30
- cull_remap_value[key] = rotx_remap.get(roty_value, roty_value)
31
- return cull_remap_
32
-
33
-
34
- cull_remap_all = _create_cull_map()
35
-
36
-
37
- class Transparency(IntEnum):
38
- FullOpaque = 0 # the block is a full block with opaque textures
39
- FullTranslucent = (
40
- 1 # the block is a full block with transparent/translucent textures
41
- )
42
- Partial = 2 # the block is not a full block
43
-
44
-
45
- class BlockMesh:
46
- """Class for storing model data"""
47
-
48
- @classmethod
49
- def merge(cls, models: Iterable[BlockMesh]) -> BlockMesh:
50
- textures_src: list[str] = []
51
- texture_count = 0
52
- vert_count: dict[Optional[str], int] = {side: 0 for side in FACE_KEYS}
53
- verts_src: dict[Optional[str], list[numpy.ndarray]] = {
54
- side: [] for side in FACE_KEYS
55
- }
56
- tverts_src: dict[Optional[str], list[numpy.ndarray]] = {
57
- side: [] for side in FACE_KEYS
58
- }
59
- tint_verts_src: dict[Optional[str], list[numpy.ndarray]] = {
60
- side: [] for side in FACE_KEYS
61
- }
62
- faces_src: dict[Optional[str], list[numpy.ndarray]] = {
63
- side: [] for side in FACE_KEYS
64
- }
65
- texture_indexes_src: dict[Optional[str], list[numpy.ndarray]] = {
66
- side: [] for side in FACE_KEYS
67
- }
68
- transparent: Transparency = Transparency.Partial
69
-
70
- cull_dir: Optional[str]
71
- for temp_model in models:
72
- for cull_dir in temp_model.faces.keys():
73
- verts_src[cull_dir].append(temp_model.verts[cull_dir])
74
- tverts_src[cull_dir].append(temp_model.texture_coords[cull_dir])
75
- tint_verts_src[cull_dir].append(temp_model.tint_verts[cull_dir])
76
- face_table = temp_model.faces[cull_dir].copy()
77
- texture_index = temp_model.texture_index[cull_dir].copy()
78
- face_table += vert_count[cull_dir]
79
- texture_index += texture_count
80
- faces_src[cull_dir].append(face_table)
81
- texture_indexes_src[cull_dir].append(texture_index)
82
-
83
- vert_count[cull_dir] += int(
84
- temp_model.verts[cull_dir].shape[0] / temp_model.face_mode
85
- )
86
-
87
- textures_src += temp_model.textures
88
- texture_count += len(temp_model.textures)
89
- transparent = min(transparent, temp_model.is_transparent)
90
-
91
- if textures_src:
92
- textures_, texture_index_map = numpy.unique(
93
- textures_src, return_inverse=True, axis=0
94
- )
95
- textures = tuple(textures_)
96
- texture_index_map = texture_index_map.astype(numpy.uint32)
97
- else:
98
- textures = ()
99
- texture_index_map = numpy.array([], dtype=numpy.uint8)
100
-
101
- verts: dict[Optional[str], numpy.ndarray] = {}
102
- tverts: dict[Optional[str], numpy.ndarray] = {}
103
- tint_verts: dict[Optional[str], numpy.ndarray] = {}
104
- faces: dict[Optional[str], numpy.ndarray] = {}
105
- texture_indexes: dict[Optional[str], numpy.ndarray] = {}
106
-
107
- for cull_dir in FACE_KEYS:
108
- if faces_src[cull_dir]:
109
- faces[cull_dir] = numpy.concatenate(faces_src[cull_dir], axis=None)
110
- texture_indexes[cull_dir] = texture_index_map[
111
- numpy.concatenate(texture_indexes_src[cull_dir], axis=None)
112
- ]
113
- if verts_src[cull_dir]:
114
- verts[cull_dir] = numpy.concatenate(verts_src[cull_dir], axis=None)
115
- tverts[cull_dir] = numpy.concatenate(
116
- tverts_src[cull_dir], axis=None
117
- )
118
- tint_verts[cull_dir] = numpy.concatenate(
119
- tint_verts_src[cull_dir], axis=None
120
- )
121
- else:
122
- verts[cull_dir] = numpy.zeros((0, 3), float)
123
- tverts[cull_dir] = numpy.zeros((0, 2), float)
124
- tint_verts[cull_dir] = numpy.zeros(0, float)
125
-
126
- return cls(
127
- 3, verts, tverts, tint_verts, faces, texture_indexes, textures, transparent
128
- )
129
-
130
- def __init__(
131
- self,
132
- face_width: int,
133
- verts: dict[Optional[str], numpy.ndarray],
134
- texture_coords: dict[Optional[str], numpy.ndarray],
135
- tint_verts: dict[Optional[str], numpy.ndarray],
136
- # normals: dict[Optional[str], numpy.ndarray],
137
- faces: dict[Optional[str], numpy.ndarray],
138
- texture_index: dict[Optional[str], numpy.ndarray],
139
- textures: tuple[str, ...],
140
- transparency: Transparency,
141
- ):
142
- """
143
-
144
- :param face_width: the number of vertices per face (3 or 4)
145
- :param verts: a numpy float array containing the vert data. One line per vertex
146
- :param texture_coords: a numpy float array containing the texture coordinate data. One line per vertex
147
- :param tint_verts: a numpy bool array if the vertex should have a tint applied to it. One line per vertex
148
- :param faces: a dictionary of numpy int arrays (stored under cull direction) containing
149
- the vertex indexes (<face_width> columns) and
150
- texture index (1 column)
151
- :param texture_index:
152
- :param textures:
153
- :param transparency: is the model a full non-transparent block
154
-
155
- Workflow:
156
- find the directions a block is not being culled in
157
- look them up in the face table
158
- the face table will tell you which vertices are needed for the face
159
- """
160
- assert isinstance(verts, dict) and all(
161
- key in FACE_KEYS
162
- and isinstance(val, numpy.ndarray)
163
- and val.ndim == 1
164
- and val.shape[0] % 3 == 0
165
- for key, val in verts.items()
166
- ), "The format for verts is incorrect"
167
-
168
- assert isinstance(texture_coords, dict) and all(
169
- key in FACE_KEYS
170
- and isinstance(val, numpy.ndarray)
171
- and val.ndim == 1
172
- and val.shape[0] % 2 == 0
173
- for key, val in texture_coords.items()
174
- ), "The format for texture coords is incorrect"
175
-
176
- assert isinstance(tint_verts, dict) and all(
177
- key in FACE_KEYS
178
- and isinstance(val, numpy.ndarray)
179
- and val.ndim == 1
180
- and val.shape[0] % 3 == 0
181
- for key, val in tint_verts.items()
182
- ), "The format of tint verts is incorrect"
183
-
184
- assert isinstance(faces, dict) and all(
185
- key in FACE_KEYS
186
- and isinstance(val, numpy.ndarray)
187
- and numpy.issubdtype(val.dtype, numpy.unsignedinteger)
188
- and val.ndim == 1
189
- and val.shape[0] % face_width == 0
190
- for key, val in faces.items()
191
- ), "The format of faces is incorrect"
192
-
193
- assert isinstance(texture_index, dict) and all(
194
- key in FACE_KEYS
195
- and isinstance(val, numpy.ndarray)
196
- and numpy.issubdtype(val.dtype, numpy.unsignedinteger)
197
- and val.ndim == 1
198
- and val.shape[0] == faces[key].shape[0] / face_width
199
- for key, val in texture_index.items()
200
- ), "The format of texture index is incorrect"
201
-
202
- assert isinstance(textures, Iterable) and all(
203
- isinstance(texture, str) for texture in textures
204
- ), "The format of the textures is incorrect"
205
-
206
- self._face_mode = face_width
207
- self._verts = verts
208
- self._texture_coords = texture_coords
209
- self._tint_verts = tint_verts
210
- self._vert_tables: Optional[dict[Optional[str], numpy.ndarray]] = None
211
-
212
- self._faces = faces
213
- self._texture_index = texture_index
214
- self._textures = tuple(textures)
215
- self._transparency = transparency
216
-
217
- for array in itertools.chain(
218
- self._verts.values(),
219
- self._texture_coords.values(),
220
- self._faces.values(),
221
- self._texture_index.values(),
222
- ):
223
- array.setflags(write=False)
224
-
225
- @property
226
- def face_mode(self) -> int:
227
- """The number of vertices per face"""
228
- return self._face_mode
229
-
230
- @property
231
- def vert_tables(self) -> dict[Optional[str], numpy.ndarray]:
232
- """A dictionary of cull dir -> the flat vert table containing vertices, texture coords and (in the future) normals"""
233
- if self._vert_tables is None:
234
- self._vert_tables = {
235
- key: numpy.hstack(
236
- (
237
- self._verts[key].reshape(-1, self._face_mode),
238
- self._texture_coords[key].reshape(-1, 2),
239
- # TODO: add in face normals
240
- )
241
- ).ravel()
242
- for key in self._verts.keys()
243
- }
244
- for array in self._vert_tables.values():
245
- array.setflags(write=False)
246
- return self._vert_tables
247
-
248
- @property
249
- def verts(self) -> dict[Optional[str], numpy.ndarray]:
250
- """A dictionary mapping face cull direction to the vertex table for that direction.
251
- The vertex table is a flat numpy array who's length is a multiple of 3.
252
- x,y,z coordinates."""
253
- return self._verts
254
-
255
- @property
256
- def texture_coords(self) -> dict[Optional[str], numpy.ndarray]:
257
- """A dictionary mapping face cull direction to the texture coords table for that direction.
258
- The texture coords table is a flat numpy array who's length is a multiple of 2.
259
- tx, ty"""
260
- return self._texture_coords
261
-
262
- @property
263
- def tint_verts(self) -> dict[Optional[str], numpy.ndarray]:
264
- """A dictionary mapping face cull direction to the tint table for that direction.
265
- The tint table is a flat numpy bool array with three values per vertex.
266
- """
267
- return self._tint_verts
268
-
269
- @property
270
- def faces(self) -> dict[Optional[str], numpy.ndarray]:
271
- """A dictionary mapping face cull direction to the face table for that direction.
272
- The face table is a flat numpy array of multiple 3 or 4 depending on face_mode.
273
- First 3 or 4 columns index into the verts table.
274
- Last column indexes into textures."""
275
- return self._faces
276
-
277
- @property
278
- def texture_index(self) -> dict[Optional[str], numpy.ndarray]:
279
- """A dictionary mapping face cull direction to the face table for that direction.
280
- The face table is a flat numpy array of multiple 2 indexing into textures."""
281
- return self._texture_index
282
-
283
- @property
284
- def textures(self) -> tuple[str, ...]:
285
- """A list of all the texture paths."""
286
- return self._textures
287
-
288
- @property
289
- def is_opaque(self) -> bool:
290
- """
291
- If the model covers all surrounding blocks.
292
- Also takes into account texture transparency.
293
- """
294
- return not self._transparency
295
-
296
- @property
297
- def is_transparent(self) -> Transparency:
298
- """
299
- The transparency mode of the block
300
- 0 - the block is a full block with opaque textures
301
- 1 - the block is a full block with transparent/translucent textures
302
- 2 - the block is not a full block
303
- """
304
- return self._transparency
305
-
306
- def rotate(self, rotx: int, roty: int) -> BlockMesh:
307
- """Create a rotated version of this block model. Culling directions are also rotated.
308
- rotx and roty must be ints in the range -3 to 3 inclusive."""
309
- if rotx or roty and (roty, rotx) in cull_remap_all:
310
- cull_remap = cull_remap_all[(roty, rotx)]
311
- return BlockMesh(
312
- self.face_mode,
313
- {
314
- cull_remap[cull_dir]: rotate_3d(
315
- rotate_3d(
316
- self.verts[cull_dir].reshape((-1, self.face_mode)),
317
- rotx * 90,
318
- 0,
319
- 0,
320
- 0.5,
321
- 0.5,
322
- 0.5,
323
- ),
324
- 0,
325
- roty * 90,
326
- 0,
327
- 0.5,
328
- 0.5,
329
- 0.5,
330
- ).ravel()
331
- for cull_dir in self.verts
332
- },
333
- {
334
- cull_remap[cull_dir]: self.texture_coords[cull_dir]
335
- for cull_dir in self.texture_coords
336
- },
337
- {
338
- cull_remap[cull_dir]: self.tint_verts[cull_dir]
339
- for cull_dir in self.tint_verts
340
- },
341
- {cull_remap[cull_dir]: self.faces[cull_dir] for cull_dir in self.faces},
342
- {
343
- cull_remap[cull_dir]: self.texture_index[cull_dir]
344
- for cull_dir in self.texture_index
345
- },
346
- self.textures,
347
- self.is_transparent,
348
- )
349
- return self
350
-
351
- def __eq__(self, other: Any) -> bool:
352
- if not isinstance(other, BlockMesh):
353
- return NotImplemented
354
- return (
355
- self.face_mode == other.face_mode
356
- and all(
357
- obj1.keys() == obj2.keys()
358
- and all(numpy.array_equal(obj1[key], obj2[key]) for key in obj1.keys())
359
- for obj1, obj2 in (
360
- (self.verts, other.verts),
361
- (self.texture_coords, other.texture_coords),
362
- (self.tint_verts, other.tint_verts),
363
- (self.faces, other.faces),
364
- (self.texture_index, other.texture_index),
365
- )
366
- )
367
- and self.textures == other.textures
368
- and self.is_transparent == other.is_transparent
369
- )
amulet/mesh/block/cube.py DELETED
@@ -1,149 +0,0 @@
1
- from typing import Optional
2
- import numpy
3
- import itertools
4
-
5
- from amulet.mesh.block.block_mesh import BlockMesh, Transparency
6
-
7
- BoundsType = tuple[tuple[float, float], tuple[float, float], tuple[float, float]]
8
- TextureUVType = tuple[
9
- tuple[float, float, float, float],
10
- tuple[float, float, float, float],
11
- tuple[float, float, float, float],
12
- tuple[float, float, float, float],
13
- tuple[float, float, float, float],
14
- tuple[float, float, float, float],
15
- ]
16
-
17
-
18
- unit_box_coordinates = numpy.array(
19
- list(itertools.product((0, 1), (0, 1), (0, 1)))
20
- ) # X, Y, Z
21
- cube_face_lut = (
22
- { # This maps face direction to the vertices used (defined in unit_box_coordinates)
23
- "down": numpy.array([0, 4, 5, 1]),
24
- "up": numpy.array([3, 7, 6, 2]),
25
- "north": numpy.array([4, 0, 2, 6]),
26
- "east": numpy.array([5, 4, 6, 7]),
27
- "south": numpy.array([1, 5, 7, 3]),
28
- "west": numpy.array([0, 1, 3, 2]),
29
- }
30
- )
31
- tri_face = numpy.array([0, 1, 2, 0, 2, 3], numpy.uint32)
32
-
33
- # cube_vert_lut = { # This maps from vertex index to index in [minx, miny, minz, maxx, maxy, maxz]
34
- # 1: [0, 1, 5],
35
- # 3: [0, 4, 5],
36
- # 0: [0, 1, 2],
37
- # 2: [0, 4, 2],
38
- # 5: [3, 1, 5],
39
- # 7: [3, 4, 5],
40
- # 4: [3, 1, 2],
41
- # 6: [3, 4, 2],
42
- # }
43
- #
44
- # # combines the above two to map from face to index in [minx, miny, minz, maxx, maxy, maxz]. Used to index a numpy array
45
- # # The above two have been kept separate because the merged result is unintuitive and difficult to edit.
46
- # cube_lut = {
47
- # face_dir_: [
48
- # vert_coord_ for vert_ in vert_index_ for vert_coord_ in cube_vert_lut[vert_]
49
- # ]
50
- # for face_dir_, vert_index_ in cube_face_lut.items()
51
- # }
52
-
53
- uv_rotation_lut = [0, 3, 2, 3, 2, 1, 0, 1] # remap
54
-
55
-
56
- # tvert_lut = { # TODO: implement this for the cases where the UV is not defined
57
- # 'down': [],
58
- # 'up': [],
59
- # 'north': [],
60
- # 'east': [],
61
- # 'south': [],
62
- # 'west': []
63
- # }
64
-
65
-
66
- def get_cube(
67
- down: str,
68
- up: str,
69
- north: str,
70
- east: str,
71
- south: str,
72
- west: str,
73
- transparency: Transparency = Transparency.FullOpaque,
74
- tint: tuple[int, int, int] = (1, 1, 1),
75
- bounds: BoundsType = ((0, 1), (0, 1), (0, 1)),
76
- texture_uv: TextureUVType = ((0, 0, 1, 1),) * 6,
77
- do_not_cull: tuple[bool, bool, bool, bool, bool, bool] = (
78
- False,
79
- False,
80
- False,
81
- False,
82
- False,
83
- False,
84
- ),
85
- ) -> BlockMesh:
86
- box_coordinates = numpy.array(list(itertools.product(*bounds)))
87
- _texture_uv: dict[Optional[str], numpy.ndarray] = {
88
- face: numpy.array(texture_uv[i], float) for i, face in enumerate(cube_face_lut)
89
- }
90
- _verts: dict[Optional[str], numpy.ndarray] = {}
91
- _texture_coords: dict[Optional[str], numpy.ndarray] = {}
92
- _tint_verts: dict[Optional[str], numpy.ndarray] = {}
93
- _tri_faces: dict[Optional[str], numpy.ndarray] = {}
94
- for _face_dir in cube_face_lut:
95
- _verts[_face_dir] = box_coordinates[
96
- cube_face_lut[_face_dir]
97
- ].ravel() # vertex coordinates for this face
98
- _texture_coords[_face_dir] = _texture_uv[_face_dir][
99
- uv_rotation_lut
100
- ] # texture vertices
101
- _tint_verts[_face_dir] = numpy.full((4, 3), tint, dtype=float).ravel()
102
- _tri_faces[_face_dir] = tri_face
103
-
104
- texture_paths_arr, texture_index = numpy.unique(
105
- (down, up, north, east, south, west), return_inverse=True
106
- )
107
- texture_paths = tuple(texture_paths_arr)
108
- _tri_texture_index: dict[Optional[str], numpy.ndarray] = {
109
- side: numpy.full(2, texture_index[side_index], dtype=numpy.uint32)
110
- for side_index, side in enumerate(cube_face_lut)
111
- }
112
-
113
- if any(do_not_cull):
114
- do_not_cull_faces = tuple(
115
- face for face, not_cull in zip(cube_face_lut, do_not_cull) if not_cull
116
- )
117
- for obj in (_verts, _texture_coords, _tint_verts, _tri_texture_index):
118
- obj[None] = numpy.concatenate([obj[key] for key in do_not_cull_faces])
119
- for key in do_not_cull_faces:
120
- del obj[key]
121
- _tri_faces[None] = numpy.concatenate(
122
- [_tri_faces[key] + 4 * i for i, key in enumerate(do_not_cull_faces)]
123
- )
124
- for key in do_not_cull_faces:
125
- del _tri_faces[key]
126
-
127
- return BlockMesh(
128
- 3,
129
- _verts,
130
- _texture_coords,
131
- _tint_verts,
132
- _tri_faces,
133
- _tri_texture_index,
134
- texture_paths,
135
- transparency,
136
- )
137
-
138
-
139
- def get_unit_cube(
140
- down: str,
141
- up: str,
142
- north: str,
143
- east: str,
144
- south: str,
145
- west: str,
146
- transparency: Transparency = Transparency.FullOpaque,
147
- tint: tuple[int, int, int] = (1, 1, 1),
148
- ) -> BlockMesh:
149
- return get_cube(down, up, north, east, south, west, transparency, tint)
@@ -1,20 +0,0 @@
1
- from __future__ import annotations
2
- from typing import TYPE_CHECKING
3
-
4
- from .block_mesh import BlockMesh
5
- from .cube import get_unit_cube
6
-
7
- if TYPE_CHECKING:
8
- from amulet.resource_pack.abc import BaseResourcePackManager
9
-
10
-
11
- def get_missing_block(resource_pack: BaseResourcePackManager) -> BlockMesh:
12
- texture_path = resource_pack.get_texture_path("minecraft", "missing_no")
13
- return get_unit_cube(
14
- texture_path,
15
- texture_path,
16
- texture_path,
17
- texture_path,
18
- texture_path,
19
- texture_path,
20
- )
amulet/mesh/util.py DELETED
@@ -1,17 +0,0 @@
1
- import numpy
2
-
3
-
4
- def rotate_3d(
5
- verts: numpy.ndarray, x: float, y: float, z: float, dx: float, dy: float, dz: float
6
- ) -> numpy.ndarray:
7
- sb, sh, sa = numpy.sin(numpy.radians([x, y, z]))
8
- cb, ch, ca = numpy.cos(numpy.radians([x, y, z]))
9
- trmtx = numpy.array(
10
- [
11
- [ch * ca, -ch * sa * cb + sh * sb, ch * sa * sb + sh * cb],
12
- [sa, ca * cb, -ca * sb],
13
- [-sh * ca, sh * sa * cb + ch * sb, -sh * sa * sb + ch * cb],
14
- ]
15
- )
16
- origin = numpy.array([dx, dy, dz])
17
- return numpy.matmul(verts - origin, trmtx) + origin # type: ignore