amulet-core 2.0a6__cp311-cp311-win_amd64.whl → 2.0a8__cp311-cp311-win_amd64.whl

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

Potentially problematic release.


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

Files changed (149) hide show
  1. amulet/__init__.cp311-win_amd64.pyd +0 -0
  2. amulet/__init__.py.cpp +6 -0
  3. amulet/__init__.pyi +2 -2
  4. amulet/_init.py +0 -2
  5. amulet/_version.py +3 -3
  6. amulet/biome.pyi +0 -2
  7. amulet/block.pyi +0 -2
  8. amulet/block_entity.pyi +0 -2
  9. amulet/chunk.hpp +2 -1
  10. amulet/chunk.pyi +0 -2
  11. amulet/chunk_components.pyi +20 -18
  12. amulet/collections/eq.py.hpp +1 -1
  13. amulet/collections/mapping.py.hpp +18 -11
  14. amulet/collections/mutable_mapping.py.hpp +17 -6
  15. amulet/collections/sequence.py.hpp +5 -6
  16. amulet/collections.pyi +8 -5
  17. amulet/entity.py +22 -20
  18. amulet/game/translate/_functions/_code_functions/_text.py +2 -2
  19. amulet/game/translate/_functions/abc.py +10 -3
  20. amulet/img/__init__.py +10 -0
  21. amulet/img/missing_no.png +0 -0
  22. amulet/img/missing_pack.png +0 -0
  23. amulet/level/__init__.pyi +2 -6
  24. amulet/level/abc/_chunk_handle.py +45 -22
  25. amulet/level/abc/_level/_creatable_level.py +1 -2
  26. amulet/level/abc/_level/_level.py +1 -5
  27. amulet/level/java/__init__.pyi +0 -5
  28. amulet/level/java/_raw/__init__.pyi +0 -4
  29. amulet/level/java/_raw/java_chunk_decode.cpp +2 -4
  30. amulet/level/java/long_array.pyi +2 -1
  31. amulet/mesh/block/__init__.pyi +301 -0
  32. amulet/mesh/block/_cube.py +198 -0
  33. amulet/mesh/block/_missing_block.py +20 -0
  34. amulet/mesh/block/block_mesh.cpp +107 -0
  35. amulet/mesh/block/block_mesh.hpp +207 -0
  36. amulet/mesh/util.py +17 -0
  37. amulet/player.py +4 -6
  38. amulet/pybind11/collections.hpp +80 -38
  39. amulet/pybind11/numpy.hpp +26 -0
  40. amulet/pybind11/py_module.hpp +16 -51
  41. amulet/pybind11/type_hints.hpp +51 -0
  42. amulet/pybind11/types.hpp +14 -6
  43. amulet/pybind11/typing.hpp +7 -0
  44. amulet/resource_pack/__init__.py +63 -0
  45. amulet/resource_pack/abc/__init__.py +2 -0
  46. amulet/resource_pack/abc/resource_pack.py +38 -0
  47. amulet/resource_pack/abc/resource_pack_manager.py +85 -0
  48. amulet/resource_pack/java/__init__.py +2 -0
  49. amulet/resource_pack/java/download_resources.py +212 -0
  50. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
  51. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
  52. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
  53. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
  54. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
  55. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
  56. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
  57. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
  58. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
  59. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
  60. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
  61. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
  62. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
  63. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
  64. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
  65. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
  66. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
  67. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
  68. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
  69. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
  70. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
  71. amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
  72. amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
  73. amulet/resource_pack/java/resource_pack.py +44 -0
  74. amulet/resource_pack/java/resource_pack_manager.py +563 -0
  75. amulet/resource_pack/unknown_resource_pack.py +10 -0
  76. amulet/utils/__init__.pyi +0 -5
  77. amulet/utils/call_spec/_call_spec.py +2 -7
  78. amulet/utils/cast.py +10 -0
  79. amulet/utils/comment_json.py +188 -0
  80. amulet/utils/matrix.py +3 -3
  81. amulet/utils/numpy_helpers.py +2 -2
  82. amulet/utils/shareable_lock.py +2 -2
  83. amulet/utils/world_utils.py +2 -2
  84. amulet/version.pyi +0 -8
  85. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/METADATA +2 -2
  86. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/RECORD +91 -103
  87. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/WHEEL +1 -1
  88. amulet/chunk_/components/biome.py +0 -155
  89. amulet/chunk_/components/block_entity.py +0 -117
  90. amulet/chunk_/components/entity.py +0 -64
  91. amulet/chunk_/components/height_2d.py +0 -16
  92. amulet/level/bedrock/__init__.py +0 -2
  93. amulet/level/bedrock/_chunk_handle.py +0 -19
  94. amulet/level/bedrock/_dimension.py +0 -22
  95. amulet/level/bedrock/_level.py +0 -187
  96. amulet/level/bedrock/_raw/__init__.py +0 -5
  97. amulet/level/bedrock/_raw/_actor_counter.py +0 -53
  98. amulet/level/bedrock/_raw/_chunk.py +0 -54
  99. amulet/level/bedrock/_raw/_chunk_decode.py +0 -668
  100. amulet/level/bedrock/_raw/_chunk_encode.py +0 -602
  101. amulet/level/bedrock/_raw/_constant.py +0 -9
  102. amulet/level/bedrock/_raw/_dimension.py +0 -343
  103. amulet/level/bedrock/_raw/_level.py +0 -463
  104. amulet/level/bedrock/_raw/_level_dat.py +0 -90
  105. amulet/level/bedrock/_raw/_typing.py +0 -6
  106. amulet/level/bedrock/_raw/leveldb_chunk_versions.py +0 -83
  107. amulet/level/bedrock/chunk/__init__.py +0 -1
  108. amulet/level/bedrock/chunk/_chunk.py +0 -126
  109. amulet/level/bedrock/chunk/components/chunk_version.py +0 -12
  110. amulet/level/bedrock/chunk/components/finalised_state.py +0 -13
  111. amulet/level/bedrock/chunk/components/raw_chunk.py +0 -15
  112. amulet/level/construction/__init__.py +0 -0
  113. amulet/level/java/_chunk_handle.pyi +0 -15
  114. amulet/level/java/_dimension.pyi +0 -13
  115. amulet/level/java/_level.pyi +0 -120
  116. amulet/level/java/_raw/_chunk_decode.py +0 -561
  117. amulet/level/java/_raw/_chunk_encode.py +0 -463
  118. amulet/level/java/_raw/_constant.pyi +0 -20
  119. amulet/level/java/_raw/_data_pack/__init__.pyi +0 -8
  120. amulet/level/java/_raw/_data_pack/data_pack.pyi +0 -197
  121. amulet/level/java/_raw/_data_pack/data_pack_manager.pyi +0 -75
  122. amulet/level/java/_raw/_dimension.pyi +0 -72
  123. amulet/level/java/_raw/_level.pyi +0 -238
  124. amulet/level/java/_raw/_typing.pyi +0 -5
  125. amulet/level/java/anvil/__init__.pyi +0 -11
  126. amulet/level/java/anvil/_dimension.pyi +0 -109
  127. amulet/level/java/anvil/_region.pyi +0 -197
  128. amulet/level/java/anvil/_sector_manager.pyi +0 -142
  129. amulet/level/java_forge/__init__.py +0 -0
  130. amulet/level/mcstructure/__init__.py +0 -0
  131. amulet/level/nbt/__init__.py +0 -0
  132. amulet/level/schematic/__init__.py +0 -0
  133. amulet/level/sponge_schematic/__init__.py +0 -0
  134. amulet/pybind11/python.hpp +0 -14
  135. amulet/utils/call_spec/__init__.pyi +0 -53
  136. amulet/utils/call_spec/_call_spec.pyi +0 -272
  137. amulet/utils/matrix.pyi +0 -177
  138. amulet/utils/shareable_lock.pyi +0 -190
  139. amulet/utils/signal/__init__.pyi +0 -25
  140. amulet/utils/signal/_signal.pyi +0 -84
  141. amulet/utils/task_manager.pyi +0 -168
  142. amulet/utils/typing.py +0 -4
  143. amulet/utils/typing.pyi +0 -6
  144. amulet/utils/weakref.pyi +0 -50
  145. amulet/utils/world_utils.pyi +0 -109
  146. /amulet/img/{missing_world_icon.png → missing_world.png} +0 -0
  147. /amulet/{level/bedrock/chunk/components → mesh}/__init__.py +0 -0
  148. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/entry_points.txt +0 -0
  149. {amulet_core-2.0a6.dist-info → amulet_core-2.0a8.dist-info}/top_level.txt +0 -0
@@ -1,75 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import amulet.level.java._raw._data_pack.data_pack
4
- from amulet.level.java._raw._data_pack.data_pack import DataPack, Readable
5
-
6
- __all__ = ["DataPack", "DataPackManager", "Readable"]
7
-
8
- class DataPackManager:
9
- """
10
-
11
- The DataPackManager class contains one or more data packs.
12
- It manages loading them so that the stacking order is maintained.
13
-
14
- """
15
-
16
- def __init__(
17
- self,
18
- data_packs: typing.Iterable[
19
- amulet.level.java._raw._data_pack.data_pack.DataPack
20
- ],
21
- ):
22
- """
23
-
24
- Construct a new DataPackManager class.
25
-
26
- :param data_packs: The data packs to load from. Later in the list get higher priority.
27
-
28
- """
29
-
30
- def all_files_match(self, match: str) -> typing.Iterable[str]:
31
- """
32
-
33
- The relative paths of all files contained within that match the given regex.
34
-
35
- :param match: The regex string to match again.
36
- :return: An iterable of file paths that match the given regex.
37
-
38
- """
39
-
40
- def close(self) -> None:
41
- """
42
- Close the contents.
43
- """
44
-
45
- def has_file(self, relative_path: str) -> bool:
46
- """
47
-
48
- Does the requested file exist.
49
-
50
- :param relative_path:
51
- :return:
52
-
53
- """
54
-
55
- def open(
56
- self, relative_path: str
57
- ) -> amulet.level.java._raw._data_pack.data_pack.Readable:
58
- """
59
-
60
- Get the contents of the file.
61
-
62
- :param relative_path:
63
- :return:
64
-
65
- """
66
-
67
- @property
68
- def all_files(self) -> typing.Iterable[str]:
69
- """
70
-
71
- The relative paths of all files contained within.
72
-
73
- :return: An iterable of paths.
74
-
75
- """
@@ -1,72 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import types
4
- import typing
5
- from builtins import str as DimensionId
6
- from builtins import str as InternalDimensionId
7
-
8
- import amulet.level.abc._raw_level
9
- from amulet.biome import Biome
10
- from amulet.block import BlockStack
11
- from amulet.level.abc._raw_level import RawDimension, RawLevelFriend
12
- from amulet.level.java._raw._chunk import decode_chunk, encode_chunk
13
- from amulet.level.java.anvil._dimension import AnvilDimension
14
- from amulet.level.java.chunk import JavaChunk
15
- from amulet.selection.group import SelectionGroup
16
-
17
- __all__ = [
18
- "AnvilDimension",
19
- "Biome",
20
- "BlockStack",
21
- "ChunkCoordinates",
22
- "DimensionId",
23
- "InternalDimensionId",
24
- "JavaChunk",
25
- "JavaRawDimension",
26
- "RawChunkType",
27
- "RawDimension",
28
- "RawLevelFriend",
29
- "SelectionGroup",
30
- "decode_chunk",
31
- "encode_chunk",
32
- ]
33
-
34
- class JavaRawDimension(
35
- amulet.level.abc._raw_level.RawLevelFriend, amulet.level.abc._raw_level.RawDimension
36
- ):
37
- def __init__(
38
- self,
39
- raw_level_ref: typing.Callable[[], JavaRawLevel | None],
40
- anvil_dimension: AnvilDimension,
41
- relative_path: InternalDimensionId,
42
- dimension_id: DimensionId,
43
- bounds: SelectionGroup,
44
- default_block: BlockStack,
45
- default_biome: Biome,
46
- ) -> None: ...
47
- def all_chunk_coords(self) -> typing.Iterable[ChunkCoordinates]: ...
48
- def bounds(self) -> SelectionGroup: ...
49
- def compact(self) -> None:
50
- """
51
- Compact all region files
52
- """
53
-
54
- def default_biome(self) -> Biome: ...
55
- def default_block(self) -> BlockStack: ...
56
- def delete_chunk(self, cx: int, cz: int) -> None: ...
57
- def get_raw_chunk(self, cx: int, cz: int) -> RawChunkType: ...
58
- def has_chunk(self, cx: int, cz: int) -> bool: ...
59
- def native_chunk_to_raw_chunk(
60
- self, chunk: JavaChunk, cx: int, cz: int
61
- ) -> RawChunkType: ...
62
- def raw_chunk_to_native_chunk(
63
- self, raw_chunk: RawChunkType, cx: int, cz: int
64
- ) -> JavaChunk: ...
65
- def set_raw_chunk(self, cx: int, cz: int, chunk: RawChunkType) -> None: ...
66
- @property
67
- def dimension_id(self) -> DimensionId: ...
68
- @property
69
- def relative_path(self) -> InternalDimensionId: ...
70
-
71
- ChunkCoordinates: types.GenericAlias # value = tuple[int, int]
72
- RawChunkType: types.GenericAlias # value = dict[str, amulet_nbt.NamedTag]
@@ -1,238 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import copy as copy
4
- import glob as glob
5
- import json as json
6
- import logging as logging
7
- import os as os
8
- import shutil as shutil
9
- import struct as struct
10
- import time as time
11
- import typing
12
- from builtins import str as DimensionId
13
- from builtins import str as InternalDimensionId
14
- from dataclasses import dataclass
15
- from threading import RLock
16
- from typing import BinaryIO
17
-
18
- import amulet.level.abc._raw_level
19
- import amulet.selection.group
20
- import portalocker as portalocker
21
- from amulet.biome import Biome
22
- from amulet.block import Block, BlockStack
23
- from amulet.errors import LevelWriteError
24
- from amulet.game._game import get_game_version
25
- from amulet.level.abc._raw_level import RawLevel
26
- from amulet.level.abc._registry import IdRegistry
27
- from amulet.level.java._raw._data_pack.data_pack import DataPack
28
- from amulet.level.java._raw._data_pack.data_pack_manager import DataPackManager
29
- from amulet.level.java._raw._dimension import JavaRawDimension
30
- from amulet.level.java.anvil._dimension import AnvilDimension
31
- from amulet.selection.box import SelectionBox
32
- from amulet.selection.group import SelectionGroup
33
- from amulet.utils.signal._signal import Signal
34
- from amulet.utils.weakref import DetachableWeakRef
35
- from amulet.version import VersionNumber
36
- from amulet_nbt import (
37
- CompoundTag,
38
- IntTag,
39
- ListTag,
40
- LongTag,
41
- NamedTag,
42
- StringTag,
43
- read_nbt,
44
- )
45
-
46
- __all__ = [
47
- "AnvilDimension",
48
- "BinaryIO",
49
- "Biome",
50
- "Block",
51
- "BlockStack",
52
- "CompoundTag",
53
- "DataPack",
54
- "DataPackManager",
55
- "DefaultSelection",
56
- "DetachableWeakRef",
57
- "DimensionId",
58
- "IdRegistry",
59
- "IntTag",
60
- "InternalDimensionId",
61
- "JavaCreateArgsV1",
62
- "JavaRawDimension",
63
- "JavaRawLevel",
64
- "JavaRawLevelOpenData",
65
- "LevelWriteError",
66
- "ListTag",
67
- "LongTag",
68
- "NamedTag",
69
- "OVERWORLD",
70
- "RLock",
71
- "RawLevel",
72
- "SelectionBox",
73
- "SelectionGroup",
74
- "Signal",
75
- "SignalInstanceCacheName",
76
- "StringTag",
77
- "THE_END",
78
- "THE_NETHER",
79
- "VersionNumber",
80
- "copy",
81
- "dataclass",
82
- "get_game_version",
83
- "glob",
84
- "json",
85
- "log",
86
- "logging",
87
- "os",
88
- "portalocker",
89
- "read_nbt",
90
- "shutil",
91
- "struct",
92
- "time",
93
- ]
94
-
95
- class JavaCreateArgsV1:
96
- """
97
- A class to house call arguments to create.
98
-
99
- If the call arguments to create need to be modified in the future a new arguments class can be created.
100
- The create method can inspect which class it was given and access arguments accordingly.
101
-
102
- """
103
-
104
- __hash__: typing.ClassVar[None] = None
105
- def __eq__(self, other): ...
106
- def __init__(
107
- self, overwrite: bool, path: str, version: VersionNumber, level_name: str
108
- ) -> None: ...
109
- def __repr__(self): ...
110
-
111
- class JavaRawLevel(amulet.level.abc._raw_level.RawLevel):
112
- __slots__: typing.ClassVar[tuple] = (
113
- "_path",
114
- "_level_dat",
115
- "_data_version",
116
- "_raw_open_data",
117
- "_SignalCache",
118
- )
119
- level_name: str
120
- @staticmethod
121
- def closed(*args, **kwargs): ...
122
- @staticmethod
123
- def opened(*args, **kwargs): ...
124
- @classmethod
125
- def create(cls, args: JavaCreateArgsV1) -> JavaRawLevel: ...
126
- @classmethod
127
- def load(cls, path: str) -> JavaRawLevel: ...
128
- def __init__(self, _ikwiad: bool = False) -> None: ...
129
- def _find_dimensions(self) -> None: ...
130
- def _get_dimension_bounds(
131
- self, dimension_type_str: DimensionId
132
- ) -> SelectionGroup: ...
133
- def _register_dimension(
134
- self, relative_dimension_path: InternalDimensionId, dimension_name: DimensionId
135
- ) -> None:
136
- """
137
-
138
- Register a new dimension.
139
-
140
- :param relative_dimension_path: The relative path to the dimension directory from the world root.
141
- "" for the world root.
142
- :param dimension_name: The name of the dimension shown to the user
143
-
144
- """
145
-
146
- def _update_data_version(self) -> None:
147
- """
148
- Pull the data version from the level.dat file
149
- """
150
-
151
- def close(self) -> None:
152
- """
153
- Close the raw level.
154
- """
155
-
156
- def compact(self) -> None:
157
- """
158
- Compact all region files
159
- """
160
-
161
- def dimension_ids(self) -> frozenset[DimensionId]: ...
162
- def get_dimension(self, dimension_id: DimensionId) -> JavaRawDimension: ...
163
- def is_open(self) -> bool: ...
164
- def open(self) -> None:
165
- """
166
- Open the raw level.
167
- """
168
-
169
- def reload(self) -> None:
170
- """
171
- Reload the raw level.
172
- """
173
-
174
- @property
175
- def _o(self) -> JavaRawLevelOpenData: ...
176
- @property
177
- def biome_id_override(self) -> IdRegistry:
178
- """
179
-
180
- A two-way map from hard coded numerical biome id <-> biome string.
181
- This only stores overridden values. If the value is not present here you should check the translator.
182
-
183
- """
184
-
185
- @property
186
- def block_id_override(self) -> IdRegistry:
187
- """
188
-
189
- A two-way map from hard coded numerical block id <-> block string.
190
- This only stores overridden values. If the value is not present here you should check the translator.
191
-
192
- """
193
-
194
- @property
195
- def data_version(self) -> VersionNumber:
196
- """
197
-
198
- The game data version that the level was last opened in.
199
- This is used to determine the data format to save in.
200
-
201
- """
202
-
203
- @property
204
- def level_dat(self) -> NamedTag:
205
- """
206
- Get the level.dat file for the world
207
- """
208
-
209
- @level_dat.setter
210
- def level_dat(self, level_dat: NamedTag) -> None: ...
211
- @property
212
- def modified_time(self) -> float:
213
- """
214
- Unix timestamp of when the level was last modified.
215
- """
216
-
217
- @property
218
- def path(self) -> str: ...
219
- @property
220
- def platform(self) -> str: ...
221
-
222
- class JavaRawLevelOpenData:
223
- def __init__(
224
- self,
225
- raw_level: JavaRawLevel,
226
- lock_file: BinaryIO,
227
- lock_time: float,
228
- data_pack: DataPackManager,
229
- ) -> None: ...
230
-
231
- DefaultSelection: (
232
- amulet.selection.group.SelectionGroup
233
- ) # value = SelectionGroup([SelectionBox((-30000000, 0, -30000000), (30000000, 256, 30000000))])
234
- OVERWORLD: str
235
- SignalInstanceCacheName: str
236
- THE_END: str
237
- THE_NETHER: str
238
- log: logging.Logger # value = <Logger amulet.level.java._raw._level (INFO)>
@@ -1,5 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from builtins import str as InternalDimensionId
4
-
5
- __all__ = ["InternalDimensionId"]
@@ -1,11 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import types
4
-
5
- from amulet.level.java.anvil._dimension import AnvilDimension, AnvilDimensionLayer
6
- from amulet.level.java.anvil._region import AnvilRegion
7
-
8
- from . import _dimension, _region, _sector_manager
9
-
10
- __all__ = ["AnvilDimension", "AnvilDimensionLayer", "AnvilRegion", "RawChunkType"]
11
- RawChunkType: types.GenericAlias # value = dict[str, amulet_nbt.NamedTag]
@@ -1,109 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os as os
4
- import re as re
5
- import threading as threading
6
- import types
7
- import typing
8
- from collections.abc import Iterator, Sequence
9
-
10
- from amulet.errors import ChunkDoesNotExist
11
- from amulet.level.java.anvil._region import AnvilRegion
12
- from amulet.utils import world_utils
13
- from amulet_nbt import NamedTag
14
-
15
- __all__ = [
16
- "AnvilDimension",
17
- "AnvilDimensionLayer",
18
- "AnvilRegion",
19
- "ChunkCoordinates",
20
- "ChunkDoesNotExist",
21
- "Iterator",
22
- "NamedTag",
23
- "RawChunkType",
24
- "RegionCoordinates",
25
- "Sequence",
26
- "os",
27
- "re",
28
- "threading",
29
- "world_utils",
30
- ]
31
-
32
- class AnvilDimension:
33
- """
34
-
35
- A class to manage the data for a dimension.
36
- This can consist of multiple layers. Eg the region layer which contains chunk data and the entities layer which contains entities.
37
-
38
- """
39
-
40
- level_regex: typing.ClassVar[
41
- re.Pattern
42
- ] # value = re.compile('DIM(?P<level>-?\\d+)')
43
- def __init__(
44
- self,
45
- directory: str,
46
- *,
47
- mcc: bool = False,
48
- layers: typing.Sequence[str] = ("region"),
49
- ) -> None: ...
50
- def all_chunk_coords(self) -> typing.Iterator[ChunkCoordinates]: ...
51
- def compact(self) -> None:
52
- """
53
- Compact all region files in this dimension
54
- """
55
-
56
- def delete_chunk(self, cx: int, cz: int) -> None: ...
57
- def get_chunk_data(self, cx: int, cz: int) -> RawChunkType:
58
- """
59
- Get the chunk data for each layer
60
- """
61
-
62
- def has_chunk(self, cx: int, cz: int) -> bool: ...
63
- def put_chunk_data(self, cx: int, cz: int, data_layers: RawChunkType) -> None:
64
- """
65
- Put one or more layers of data
66
- """
67
-
68
- class AnvilDimensionLayer:
69
- """
70
- A class to manage a directory of region files.
71
- """
72
-
73
- def __init__(self, directory: str, *, mcc: bool = False): ...
74
- def _get_region(self, rx: int, rz: int, create: bool = False) -> AnvilRegion: ...
75
- def _has_region(self, rx: int, rz: int) -> bool:
76
- """
77
- Does a region file exist.
78
- """
79
-
80
- def _iter_regions(self) -> typing.Iterator[AnvilRegion]: ...
81
- def _region_path(self, rx: int, rz: int) -> str:
82
- """
83
- Get the file path for a region file.
84
- """
85
-
86
- def all_chunk_coords(self) -> typing.Iterator[ChunkCoordinates]: ...
87
- def compact(self) -> None:
88
- """
89
- Compact all region files in this layer
90
- """
91
-
92
- def delete_chunk(self, cx: int, cz: int) -> None: ...
93
- def get_chunk_data(self, cx: int, cz: int) -> NamedTag:
94
- """
95
-
96
- Get a NamedTag of a chunk from the database.
97
- Will raise ChunkDoesNotExist if the region or chunk does not exist
98
-
99
- """
100
-
101
- def has_chunk(self, cx: int, cz: int) -> bool: ...
102
- def put_chunk_data(self, cx: int, cz: int, data: NamedTag) -> None:
103
- """
104
- pass data to the region file class
105
- """
106
-
107
- ChunkCoordinates: types.GenericAlias # value = tuple[int, int]
108
- RawChunkType: types.GenericAlias # value = dict[str, amulet_nbt.NamedTag]
109
- RegionCoordinates: types.GenericAlias # value = tuple[int, int]
@@ -1,197 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import enum
4
- import gzip as gzip
5
- import logging as logging
6
- import os as os
7
- import re as re
8
- import struct as struct
9
- import threading as threading
10
- import time as time
11
- import types
12
- import typing
13
- import zlib as zlib
14
- from collections.abc import Iterator
15
- from enum import IntEnum
16
- from typing import BinaryIO
17
-
18
- import _struct
19
- import amulet.level.java.anvil._sector_manager
20
- import numpy as numpy
21
- from amulet.errors import ChunkDoesNotExist, ChunkLoadError
22
- from amulet.level.java.anvil._sector_manager import Sector, SectorManager
23
- from amulet_nbt import NamedTag, read_nbt
24
- from lz4 import block as lz4_block
25
-
26
- __all__ = [
27
- "AnvilRegion",
28
- "BinaryIO",
29
- "COMPRESSION_METHOD_LZ4",
30
- "COMPRESSION_METHOD_RAW",
31
- "ChunkCoordinates",
32
- "ChunkDoesNotExist",
33
- "ChunkLoadError",
34
- "HeaderSector",
35
- "IntEnum",
36
- "Iterator",
37
- "LZ4_HEADER",
38
- "LZ4_MAGIC",
39
- "MaxRegionSize",
40
- "NamedTag",
41
- "RegionFileVersion",
42
- "Sector",
43
- "SectorManager",
44
- "SectorSize",
45
- "gzip",
46
- "log",
47
- "logging",
48
- "lz4_block",
49
- "numpy",
50
- "os",
51
- "re",
52
- "read_nbt",
53
- "struct",
54
- "threading",
55
- "time",
56
- "zlib",
57
- ]
58
-
59
- class AnvilRegion:
60
- """
61
-
62
- A class to read and write Minecraft Java Edition Region files.
63
- Only one class should exist per region file at any given time otherwise bad things may happen.
64
-
65
- """
66
-
67
- __slots__: typing.ClassVar[tuple] = (
68
- "_path",
69
- "_rx",
70
- "_rz",
71
- "_mcc",
72
- "_sector_manager",
73
- "_chunk_locations",
74
- "_lock",
75
- )
76
- region_regex: typing.ClassVar[
77
- re.Pattern
78
- ] # value = re.compile('r\\.(?P<rx>-?\\d+)\\.(?P<rz>-?\\d+)\\.mca')
79
- @classmethod
80
- def get_coords(cls, file_path: str) -> tuple[int, int]:
81
- """
82
- Parse a region file path to get the region coordinates.
83
- """
84
-
85
- def __init__(self, file_path: str, *, mcc: bool = False) -> None:
86
- """
87
-
88
- A class wrapper for a region file
89
- :param file_path: The file path of the region file
90
- :param create: bool - if true will create the region from scratch. If false will try loading from disk
91
-
92
- """
93
-
94
- def _load(self) -> None:
95
- """
96
- Load region metadata. The lock must be acquired when calling this.
97
- """
98
-
99
- def _write_data(self, cx: int, cz: int, data: bytes | None) -> None: ...
100
- def all_coords(self) -> typing.Iterator[ChunkCoordinates]:
101
- """
102
- An iterable of chunk coordinates in world space.
103
- """
104
-
105
- def compact(self) -> None:
106
- """
107
- Compact the region file.
108
- This moves all entries to the front of the file and deletes any unused space.
109
- """
110
-
111
- def delete_data(self, cx: int, cz: int) -> None:
112
- """
113
- Delete the data from the region file.
114
- """
115
-
116
- def get_data(self, cx: int, cz: int) -> NamedTag: ...
117
- def get_mcc_path(self, cx: int, cz: int) -> str:
118
- """
119
- Get the mcc path. Coordinates are world chunk coordinates.
120
- """
121
-
122
- def has_data(self, cx: int, cz: int) -> bool:
123
- """
124
- Does the chunk exists. Coords are in world space.
125
- """
126
-
127
- def set_data(self, cx: int, cz: int, data: NamedTag) -> None:
128
- """
129
- Write the data to the region file.
130
- """
131
-
132
- @property
133
- def path(self) -> str:
134
- """
135
- The file path to the region file.
136
- """
137
-
138
- @property
139
- def rx(self) -> int:
140
- """
141
- The region x coordinate.
142
- """
143
-
144
- @property
145
- def rz(self) -> int:
146
- """
147
- The region z coordinate.
148
- """
149
-
150
- class RegionFileVersion(enum.IntEnum):
151
- VERSION_DEFLATE: typing.ClassVar[
152
- RegionFileVersion
153
- ] # value = <RegionFileVersion.VERSION_DEFLATE: 2>
154
- VERSION_GZIP: typing.ClassVar[
155
- RegionFileVersion
156
- ] # value = <RegionFileVersion.VERSION_GZIP: 1>
157
- VERSION_LZ4: typing.ClassVar[
158
- RegionFileVersion
159
- ] # value = <RegionFileVersion.VERSION_LZ4: 4>
160
- VERSION_NONE: typing.ClassVar[
161
- RegionFileVersion
162
- ] # value = <RegionFileVersion.VERSION_NONE: 3>
163
- @classmethod
164
- def __new__(cls, value): ...
165
- def __format__(self, format_spec):
166
- """
167
- Convert to a string according to format_spec.
168
- """
169
-
170
- def _compress(tag: NamedTag) -> bytes:
171
- """
172
- Convert an NBTFile into a compressed bytes object
173
- """
174
-
175
- def _decompress(data: bytes) -> NamedTag:
176
- """
177
- Convert a bytes object into an NBTFile
178
- """
179
-
180
- def _decompress_lz4(data: bytes) -> bytes:
181
- """
182
- The LZ4 compression format is a sequence of LZ4 blocks with some header data.
183
- """
184
-
185
- def _sanitise_file(handler: BinaryIO) -> None: ...
186
-
187
- COMPRESSION_METHOD_LZ4: int = 32
188
- COMPRESSION_METHOD_RAW: int = 16
189
- ChunkCoordinates: types.GenericAlias # value = tuple[int, int]
190
- HeaderSector: (
191
- amulet.level.java.anvil._sector_manager.Sector
192
- ) # value = Sector(start=0, stop=8192)
193
- LZ4_HEADER: _struct.Struct # value = <_struct.Struct object>
194
- LZ4_MAGIC: bytes # value = b'LZ4Block'
195
- MaxRegionSize: int = 1044480
196
- SectorSize: int = 4096
197
- log: logging.Logger # value = <Logger amulet.level.java.anvil._region (INFO)>