amulet-core 1.9.19__py3-none-any.whl → 1.9.20__py3-none-any.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 (198) hide show
  1. amulet/__init__.py +27 -27
  2. amulet/__pyinstaller/__init__.py +2 -2
  3. amulet/__pyinstaller/hook-amulet.py +4 -4
  4. amulet/_version.py +21 -21
  5. amulet/api/__init__.py +2 -2
  6. amulet/api/abstract_base_entity.py +128 -128
  7. amulet/api/block.py +630 -630
  8. amulet/api/block_entity.py +71 -71
  9. amulet/api/cache.py +107 -107
  10. amulet/api/chunk/__init__.py +6 -6
  11. amulet/api/chunk/biomes.py +207 -207
  12. amulet/api/chunk/block_entity_dict.py +175 -175
  13. amulet/api/chunk/blocks.py +46 -46
  14. amulet/api/chunk/chunk.py +389 -389
  15. amulet/api/chunk/entity_list.py +75 -75
  16. amulet/api/chunk/status.py +167 -167
  17. amulet/api/data_types/__init__.py +4 -4
  18. amulet/api/data_types/generic_types.py +4 -4
  19. amulet/api/data_types/operation_types.py +16 -16
  20. amulet/api/data_types/world_types.py +49 -49
  21. amulet/api/data_types/wrapper_types.py +71 -71
  22. amulet/api/entity.py +74 -74
  23. amulet/api/errors.py +119 -119
  24. amulet/api/history/__init__.py +36 -36
  25. amulet/api/history/base/__init__.py +3 -3
  26. amulet/api/history/base/base_history.py +26 -26
  27. amulet/api/history/base/history_manager.py +63 -63
  28. amulet/api/history/base/revision_manager.py +73 -73
  29. amulet/api/history/changeable.py +15 -15
  30. amulet/api/history/data_types.py +7 -7
  31. amulet/api/history/history_manager/__init__.py +3 -3
  32. amulet/api/history/history_manager/container.py +102 -102
  33. amulet/api/history/history_manager/database.py +279 -279
  34. amulet/api/history/history_manager/meta.py +93 -93
  35. amulet/api/history/history_manager/object.py +116 -116
  36. amulet/api/history/revision_manager/__init__.py +2 -2
  37. amulet/api/history/revision_manager/disk.py +33 -33
  38. amulet/api/history/revision_manager/ram.py +12 -12
  39. amulet/api/item.py +75 -75
  40. amulet/api/level/__init__.py +4 -4
  41. amulet/api/level/base_level/__init__.py +1 -1
  42. amulet/api/level/base_level/base_level.py +1035 -1026
  43. amulet/api/level/base_level/chunk_manager.py +227 -227
  44. amulet/api/level/base_level/clone.py +389 -389
  45. amulet/api/level/base_level/player_manager.py +101 -101
  46. amulet/api/level/immutable_structure/__init__.py +1 -1
  47. amulet/api/level/immutable_structure/immutable_structure.py +94 -94
  48. amulet/api/level/immutable_structure/void_format_wrapper.py +117 -117
  49. amulet/api/level/structure.py +22 -22
  50. amulet/api/level/world.py +19 -19
  51. amulet/api/partial_3d_array/__init__.py +2 -2
  52. amulet/api/partial_3d_array/base_partial_3d_array.py +263 -263
  53. amulet/api/partial_3d_array/bounded_partial_3d_array.py +528 -528
  54. amulet/api/partial_3d_array/data_types.py +15 -15
  55. amulet/api/partial_3d_array/unbounded_partial_3d_array.py +229 -229
  56. amulet/api/partial_3d_array/util.py +152 -152
  57. amulet/api/player.py +65 -65
  58. amulet/api/registry/__init__.py +2 -2
  59. amulet/api/registry/base_registry.py +34 -34
  60. amulet/api/registry/biome_manager.py +153 -153
  61. amulet/api/registry/block_manager.py +156 -156
  62. amulet/api/selection/__init__.py +2 -2
  63. amulet/api/selection/abstract_selection.py +315 -315
  64. amulet/api/selection/box.py +805 -805
  65. amulet/api/selection/group.py +488 -488
  66. amulet/api/structure.py +37 -37
  67. amulet/api/wrapper/__init__.py +8 -8
  68. amulet/api/wrapper/chunk/interface.py +441 -441
  69. amulet/api/wrapper/chunk/translator.py +567 -567
  70. amulet/api/wrapper/format_wrapper.py +772 -772
  71. amulet/api/wrapper/structure_format_wrapper.py +116 -116
  72. amulet/api/wrapper/world_format_wrapper.py +63 -63
  73. amulet/level/__init__.py +1 -1
  74. amulet/level/formats/anvil_forge_world.py +40 -40
  75. amulet/level/formats/anvil_world/__init__.py +3 -3
  76. amulet/level/formats/anvil_world/_sector_manager.py +291 -384
  77. amulet/level/formats/anvil_world/data_pack/__init__.py +2 -2
  78. amulet/level/formats/anvil_world/data_pack/data_pack.py +224 -224
  79. amulet/level/formats/anvil_world/data_pack/data_pack_manager.py +77 -77
  80. amulet/level/formats/anvil_world/dimension.py +177 -177
  81. amulet/level/formats/anvil_world/format.py +769 -769
  82. amulet/level/formats/anvil_world/region.py +384 -384
  83. amulet/level/formats/construction/__init__.py +3 -3
  84. amulet/level/formats/construction/format_wrapper.py +515 -515
  85. amulet/level/formats/construction/interface.py +134 -134
  86. amulet/level/formats/construction/section.py +60 -60
  87. amulet/level/formats/construction/util.py +165 -165
  88. amulet/level/formats/leveldb_world/__init__.py +3 -3
  89. amulet/level/formats/leveldb_world/chunk.py +33 -33
  90. amulet/level/formats/leveldb_world/dimension.py +385 -419
  91. amulet/level/formats/leveldb_world/format.py +659 -641
  92. amulet/level/formats/leveldb_world/interface/chunk/__init__.py +36 -36
  93. amulet/level/formats/leveldb_world/interface/chunk/base_leveldb_interface.py +836 -836
  94. amulet/level/formats/leveldb_world/interface/chunk/generate_interface.py +31 -31
  95. amulet/level/formats/leveldb_world/interface/chunk/leveldb_0.py +30 -30
  96. amulet/level/formats/leveldb_world/interface/chunk/leveldb_1.py +12 -12
  97. amulet/level/formats/leveldb_world/interface/chunk/leveldb_10.py +12 -12
  98. amulet/level/formats/leveldb_world/interface/chunk/leveldb_11.py +12 -12
  99. amulet/level/formats/leveldb_world/interface/chunk/leveldb_12.py +12 -12
  100. amulet/level/formats/leveldb_world/interface/chunk/leveldb_13.py +12 -12
  101. amulet/level/formats/leveldb_world/interface/chunk/leveldb_14.py +12 -12
  102. amulet/level/formats/leveldb_world/interface/chunk/leveldb_15.py +12 -12
  103. amulet/level/formats/leveldb_world/interface/chunk/leveldb_16.py +12 -12
  104. amulet/level/formats/leveldb_world/interface/chunk/leveldb_17.py +12 -12
  105. amulet/level/formats/leveldb_world/interface/chunk/leveldb_18.py +12 -12
  106. amulet/level/formats/leveldb_world/interface/chunk/leveldb_19.py +12 -12
  107. amulet/level/formats/leveldb_world/interface/chunk/leveldb_2.py +12 -12
  108. amulet/level/formats/leveldb_world/interface/chunk/leveldb_20.py +12 -12
  109. amulet/level/formats/leveldb_world/interface/chunk/leveldb_21.py +12 -12
  110. amulet/level/formats/leveldb_world/interface/chunk/leveldb_22.py +12 -12
  111. amulet/level/formats/leveldb_world/interface/chunk/leveldb_23.py +10 -10
  112. amulet/level/formats/leveldb_world/interface/chunk/leveldb_24.py +10 -10
  113. amulet/level/formats/leveldb_world/interface/chunk/leveldb_25.py +24 -24
  114. amulet/level/formats/leveldb_world/interface/chunk/leveldb_26.py +10 -10
  115. amulet/level/formats/leveldb_world/interface/chunk/leveldb_27.py +10 -10
  116. amulet/level/formats/leveldb_world/interface/chunk/leveldb_28.py +10 -10
  117. amulet/level/formats/leveldb_world/interface/chunk/leveldb_29.py +33 -33
  118. amulet/level/formats/leveldb_world/interface/chunk/leveldb_3.py +57 -57
  119. amulet/level/formats/leveldb_world/interface/chunk/leveldb_30.py +10 -10
  120. amulet/level/formats/leveldb_world/interface/chunk/leveldb_31.py +10 -10
  121. amulet/level/formats/leveldb_world/interface/chunk/leveldb_32.py +10 -10
  122. amulet/level/formats/leveldb_world/interface/chunk/leveldb_33.py +10 -10
  123. amulet/level/formats/leveldb_world/interface/chunk/leveldb_34.py +10 -10
  124. amulet/level/formats/leveldb_world/interface/chunk/leveldb_35.py +10 -10
  125. amulet/level/formats/leveldb_world/interface/chunk/leveldb_36.py +10 -10
  126. amulet/level/formats/leveldb_world/interface/chunk/leveldb_37.py +10 -10
  127. amulet/level/formats/leveldb_world/interface/chunk/leveldb_38.py +10 -10
  128. amulet/level/formats/leveldb_world/interface/chunk/leveldb_39.py +12 -12
  129. amulet/level/formats/leveldb_world/interface/chunk/leveldb_4.py +12 -12
  130. amulet/level/formats/leveldb_world/interface/chunk/leveldb_40.py +16 -16
  131. amulet/level/formats/leveldb_world/interface/chunk/leveldb_5.py +12 -12
  132. amulet/level/formats/leveldb_world/interface/chunk/leveldb_6.py +12 -12
  133. amulet/level/formats/leveldb_world/interface/chunk/leveldb_7.py +12 -12
  134. amulet/level/formats/leveldb_world/interface/chunk/leveldb_8.py +180 -180
  135. amulet/level/formats/leveldb_world/interface/chunk/leveldb_9.py +18 -18
  136. amulet/level/formats/leveldb_world/interface/chunk/leveldb_chunk_versions.py +79 -79
  137. amulet/level/formats/mcstructure/__init__.py +3 -3
  138. amulet/level/formats/mcstructure/chunk.py +50 -50
  139. amulet/level/formats/mcstructure/format_wrapper.py +408 -408
  140. amulet/level/formats/mcstructure/interface.py +175 -175
  141. amulet/level/formats/schematic/__init__.py +3 -3
  142. amulet/level/formats/schematic/chunk.py +55 -55
  143. amulet/level/formats/schematic/data_types.py +4 -4
  144. amulet/level/formats/schematic/format_wrapper.py +373 -373
  145. amulet/level/formats/schematic/interface.py +142 -142
  146. amulet/level/formats/sponge_schem/__init__.py +4 -4
  147. amulet/level/formats/sponge_schem/chunk.py +62 -62
  148. amulet/level/formats/sponge_schem/format_wrapper.py +463 -463
  149. amulet/level/formats/sponge_schem/interface.py +118 -118
  150. amulet/level/formats/sponge_schem/varint/__init__.py +1 -1
  151. amulet/level/formats/sponge_schem/varint/varint.py +87 -87
  152. amulet/level/interfaces/chunk/anvil/anvil_0.py +72 -72
  153. amulet/level/interfaces/chunk/anvil/anvil_1444.py +336 -336
  154. amulet/level/interfaces/chunk/anvil/anvil_1466.py +94 -94
  155. amulet/level/interfaces/chunk/anvil/anvil_1467.py +37 -37
  156. amulet/level/interfaces/chunk/anvil/anvil_1484.py +20 -20
  157. amulet/level/interfaces/chunk/anvil/anvil_1503.py +20 -20
  158. amulet/level/interfaces/chunk/anvil/anvil_1519.py +34 -34
  159. amulet/level/interfaces/chunk/anvil/anvil_1901.py +20 -20
  160. amulet/level/interfaces/chunk/anvil/anvil_1908.py +20 -20
  161. amulet/level/interfaces/chunk/anvil/anvil_1912.py +21 -21
  162. amulet/level/interfaces/chunk/anvil/anvil_1934.py +20 -20
  163. amulet/level/interfaces/chunk/anvil/anvil_2203.py +69 -69
  164. amulet/level/interfaces/chunk/anvil/anvil_2529.py +19 -19
  165. amulet/level/interfaces/chunk/anvil/anvil_2681.py +76 -76
  166. amulet/level/interfaces/chunk/anvil/anvil_2709.py +19 -19
  167. amulet/level/interfaces/chunk/anvil/anvil_2844.py +267 -267
  168. amulet/level/interfaces/chunk/anvil/anvil_3463.py +19 -19
  169. amulet/level/interfaces/chunk/anvil/anvil_na.py +607 -607
  170. amulet/level/interfaces/chunk/anvil/base_anvil_interface.py +326 -326
  171. amulet/level/load.py +59 -59
  172. amulet/level/loader.py +95 -95
  173. amulet/level/translators/chunk/bedrock/__init__.py +267 -267
  174. amulet/level/translators/chunk/bedrock/bedrock_nbt_blockstate_translator.py +46 -46
  175. amulet/level/translators/chunk/bedrock/bedrock_numerical_translator.py +39 -39
  176. amulet/level/translators/chunk/bedrock/bedrock_psudo_numerical_translator.py +37 -37
  177. amulet/level/translators/chunk/java/java_1_18_translator.py +40 -40
  178. amulet/level/translators/chunk/java/java_blockstate_translator.py +94 -94
  179. amulet/level/translators/chunk/java/java_numerical_translator.py +62 -62
  180. amulet/libs/leveldb/__init__.py +7 -7
  181. amulet/operations/__init__.py +5 -5
  182. amulet/operations/clone.py +18 -18
  183. amulet/operations/delete_chunk.py +32 -32
  184. amulet/operations/fill.py +30 -30
  185. amulet/operations/paste.py +65 -65
  186. amulet/operations/replace.py +58 -58
  187. amulet/utils/__init__.py +14 -14
  188. amulet/utils/format_utils.py +41 -41
  189. amulet/utils/generator.py +15 -15
  190. amulet/utils/matrix.py +243 -243
  191. amulet/utils/numpy_helpers.py +46 -46
  192. amulet/utils/world_utils.py +349 -349
  193. {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/METADATA +97 -97
  194. amulet_core-1.9.20.dist-info/RECORD +208 -0
  195. amulet_core-1.9.19.dist-info/RECORD +0 -208
  196. {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/WHEEL +0 -0
  197. {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/entry_points.txt +0 -0
  198. {amulet_core-1.9.19.dist-info → amulet_core-1.9.20.dist-info}/top_level.txt +0 -0
@@ -1,152 +1,152 @@
1
- import math
2
- from typing import Optional, Tuple
3
-
4
- from .data_types import (
5
- FlexibleSlicesType,
6
- SliceSlicesType,
7
- Integer,
8
- SingleFlexibleSliceType,
9
- )
10
-
11
-
12
- def _sanitise_slice(start: int, stop: int, step: int) -> Tuple[int, int, int]:
13
- step_count = math.ceil(max((stop - start) / step, 0))
14
- stop = start + step_count * step
15
- if step_count:
16
- stop += int(math.copysign(1, step)) - step
17
-
18
- return start, stop, step
19
-
20
-
21
- def sanitise_slice(
22
- start: Optional[int], stop: Optional[int], step: Optional[int], arr_size: int
23
- ) -> Tuple[int, int, int]:
24
- """
25
- Convert slices into a sane format
26
- 0 is always before the first number and arr_size is always after the last number.
27
- """
28
- # set default values
29
- if step is None:
30
- step = 1
31
- elif step == 0:
32
- raise Exception("step cannot be 0")
33
-
34
- if start is None:
35
- if step > 0:
36
- start = 0
37
- else:
38
- start = arr_size - 1
39
- elif start < 0:
40
- start = arr_size + start
41
-
42
- if stop is None:
43
- if step > 0:
44
- stop = arr_size
45
- else:
46
- stop = -1
47
- elif stop < 0:
48
- stop = arr_size + stop
49
-
50
- if step < 0:
51
- start += 1
52
- stop += 1
53
-
54
- # cap at the ends
55
- if step > 0:
56
- start = max(0, start)
57
- stop = min(stop, arr_size)
58
- elif step < 0:
59
- start = min(arr_size, start)
60
- stop = max(stop, 0)
61
-
62
- return _sanitise_slice(start, stop, step)
63
-
64
-
65
- def sanitise_unbounded_slice(
66
- start: Optional[int],
67
- stop: Optional[int],
68
- step: Optional[int],
69
- default_min: int, # the minimum value to default to
70
- default_max: int, # the maximum value to default to
71
- ) -> Tuple[int, int, int]:
72
- if step is None:
73
- step = 1
74
- elif step == 0:
75
- raise Exception("step cannot be 0")
76
-
77
- # cap at the normal limits
78
- if step > 0:
79
- if start is None:
80
- start = default_min
81
- if stop is None:
82
- stop = default_max
83
- else:
84
- if start is None:
85
- start = default_max
86
- if stop is None:
87
- stop = default_min
88
-
89
- if step < 0:
90
- start += 1
91
- stop += 1
92
-
93
- return _sanitise_slice(start, stop, step)
94
-
95
-
96
- def unsanitise_slice(
97
- start: int, stop: int, step: int, arr_size: int
98
- ) -> Tuple[int, int, int]:
99
- """Convert sanitised slices back to the normal format."""
100
- if step < 0:
101
- start -= 1
102
- stop -= 1
103
- if start < 0:
104
- start -= arr_size
105
- if stop < 0:
106
- stop -= arr_size
107
-
108
- return start, stop, step
109
-
110
-
111
- def stack_sanitised_slices(
112
- start1: int, stop1: int, step1: int, start2: int, stop2: int, step2: int
113
- ) -> Tuple[int, int, int]:
114
- step3 = step1 * step2
115
- start3 = start1 + start2 * step1
116
- stop3 = start1 + stop2 * step1
117
-
118
- return _sanitise_slice(start3, stop3, step3)
119
-
120
-
121
- def unpack_slice(item: slice):
122
- return item.start, item.stop, item.step
123
-
124
-
125
- def to_slice(item: SingleFlexibleSliceType) -> slice:
126
- if isinstance(item, Integer):
127
- item = int(item)
128
- return slice(item, item + 1, 1)
129
- elif isinstance(item, slice):
130
- step = item.step
131
- if step == 0:
132
- raise Exception("Step of 0 is invalid")
133
- return slice(item.start, item.stop, 1 if step is None else step)
134
- else:
135
- raise Exception(f"Unsupported slice item {item}")
136
-
137
-
138
- def multi_to_slice(slices: FlexibleSlicesType) -> SliceSlicesType:
139
- return tuple(to_slice(item) for item in slices)
140
-
141
-
142
- def get_sliced_array_size(
143
- start: Optional[int], stop: Optional[int], step: Optional[int], arr_size
144
- ) -> int:
145
- """Find the size of the array the slice would produce from an array of size arr_size"""
146
- start, stop, step = sanitise_slice(start, stop, step, arr_size)
147
- return get_sanitised_sliced_array_size(start, stop, step)
148
-
149
-
150
- def get_sanitised_sliced_array_size(start: int, stop: int, step: int):
151
- """Find the size of a slice that has been pre-sanitised"""
152
- return math.ceil((stop - start) / step)
1
+ import math
2
+ from typing import Optional, Tuple
3
+
4
+ from .data_types import (
5
+ FlexibleSlicesType,
6
+ SliceSlicesType,
7
+ Integer,
8
+ SingleFlexibleSliceType,
9
+ )
10
+
11
+
12
+ def _sanitise_slice(start: int, stop: int, step: int) -> Tuple[int, int, int]:
13
+ step_count = math.ceil(max((stop - start) / step, 0))
14
+ stop = start + step_count * step
15
+ if step_count:
16
+ stop += int(math.copysign(1, step)) - step
17
+
18
+ return start, stop, step
19
+
20
+
21
+ def sanitise_slice(
22
+ start: Optional[int], stop: Optional[int], step: Optional[int], arr_size: int
23
+ ) -> Tuple[int, int, int]:
24
+ """
25
+ Convert slices into a sane format
26
+ 0 is always before the first number and arr_size is always after the last number.
27
+ """
28
+ # set default values
29
+ if step is None:
30
+ step = 1
31
+ elif step == 0:
32
+ raise Exception("step cannot be 0")
33
+
34
+ if start is None:
35
+ if step > 0:
36
+ start = 0
37
+ else:
38
+ start = arr_size - 1
39
+ elif start < 0:
40
+ start = arr_size + start
41
+
42
+ if stop is None:
43
+ if step > 0:
44
+ stop = arr_size
45
+ else:
46
+ stop = -1
47
+ elif stop < 0:
48
+ stop = arr_size + stop
49
+
50
+ if step < 0:
51
+ start += 1
52
+ stop += 1
53
+
54
+ # cap at the ends
55
+ if step > 0:
56
+ start = max(0, start)
57
+ stop = min(stop, arr_size)
58
+ elif step < 0:
59
+ start = min(arr_size, start)
60
+ stop = max(stop, 0)
61
+
62
+ return _sanitise_slice(start, stop, step)
63
+
64
+
65
+ def sanitise_unbounded_slice(
66
+ start: Optional[int],
67
+ stop: Optional[int],
68
+ step: Optional[int],
69
+ default_min: int, # the minimum value to default to
70
+ default_max: int, # the maximum value to default to
71
+ ) -> Tuple[int, int, int]:
72
+ if step is None:
73
+ step = 1
74
+ elif step == 0:
75
+ raise Exception("step cannot be 0")
76
+
77
+ # cap at the normal limits
78
+ if step > 0:
79
+ if start is None:
80
+ start = default_min
81
+ if stop is None:
82
+ stop = default_max
83
+ else:
84
+ if start is None:
85
+ start = default_max
86
+ if stop is None:
87
+ stop = default_min
88
+
89
+ if step < 0:
90
+ start += 1
91
+ stop += 1
92
+
93
+ return _sanitise_slice(start, stop, step)
94
+
95
+
96
+ def unsanitise_slice(
97
+ start: int, stop: int, step: int, arr_size: int
98
+ ) -> Tuple[int, int, int]:
99
+ """Convert sanitised slices back to the normal format."""
100
+ if step < 0:
101
+ start -= 1
102
+ stop -= 1
103
+ if start < 0:
104
+ start -= arr_size
105
+ if stop < 0:
106
+ stop -= arr_size
107
+
108
+ return start, stop, step
109
+
110
+
111
+ def stack_sanitised_slices(
112
+ start1: int, stop1: int, step1: int, start2: int, stop2: int, step2: int
113
+ ) -> Tuple[int, int, int]:
114
+ step3 = step1 * step2
115
+ start3 = start1 + start2 * step1
116
+ stop3 = start1 + stop2 * step1
117
+
118
+ return _sanitise_slice(start3, stop3, step3)
119
+
120
+
121
+ def unpack_slice(item: slice):
122
+ return item.start, item.stop, item.step
123
+
124
+
125
+ def to_slice(item: SingleFlexibleSliceType) -> slice:
126
+ if isinstance(item, Integer):
127
+ item = int(item)
128
+ return slice(item, item + 1, 1)
129
+ elif isinstance(item, slice):
130
+ step = item.step
131
+ if step == 0:
132
+ raise Exception("Step of 0 is invalid")
133
+ return slice(item.start, item.stop, 1 if step is None else step)
134
+ else:
135
+ raise Exception(f"Unsupported slice item {item}")
136
+
137
+
138
+ def multi_to_slice(slices: FlexibleSlicesType) -> SliceSlicesType:
139
+ return tuple(to_slice(item) for item in slices)
140
+
141
+
142
+ def get_sliced_array_size(
143
+ start: Optional[int], stop: Optional[int], step: Optional[int], arr_size
144
+ ) -> int:
145
+ """Find the size of the array the slice would produce from an array of size arr_size"""
146
+ start, stop, step = sanitise_slice(start, stop, step, arr_size)
147
+ return get_sanitised_sliced_array_size(start, stop, step)
148
+
149
+
150
+ def get_sanitised_sliced_array_size(start: int, stop: int, step: int):
151
+ """Find the size of a slice that has been pre-sanitised"""
152
+ return math.ceil((stop - start) / step)
amulet/api/player.py CHANGED
@@ -1,65 +1,65 @@
1
- from __future__ import annotations
2
-
3
- from typing import Tuple
4
-
5
- from amulet.api.history import Changeable
6
- from amulet.api.data_types import Dimension
7
-
8
- LOCAL_PLAYER = "~local_player"
9
-
10
-
11
- class Player(Changeable):
12
- def __init__(
13
- self,
14
- player_id: str,
15
- dimension: str,
16
- location: Tuple[float, float, float],
17
- rotation: Tuple[float, float],
18
- ):
19
- """
20
- Creates a new instance of :class:`Player` with the given UUID, location, and rotation
21
-
22
- :param player_id: The ID of the player
23
- :param location: The location of the player in world coordinates
24
- :param rotation: The rotation of the player
25
- :param dimension: The dimension the player is in
26
- """
27
- super().__init__()
28
- assert isinstance(player_id, str)
29
- assert (
30
- isinstance(location, tuple)
31
- and len(location) == 3
32
- and all(isinstance(f, float) for f in location)
33
- )
34
- assert (
35
- isinstance(rotation, tuple)
36
- and len(rotation) == 2
37
- and all(isinstance(f, float) for f in rotation)
38
- )
39
- self._player_id = player_id
40
- self._location = location
41
- self._rotation = rotation
42
- self._dimension = dimension
43
-
44
- def __repr__(self):
45
- return f"Player({self.player_id}, {self.dimension}, {self.location}, {self.rotation})"
46
-
47
- @property
48
- def player_id(self) -> str:
49
- """The player's ID"""
50
- return self._player_id
51
-
52
- @property
53
- def location(self) -> Tuple[float, float, float]:
54
- """The current location of the player in the world"""
55
- return self._location
56
-
57
- @property
58
- def rotation(self) -> Tuple[float, float]:
59
- """The current rotation of the player in the world"""
60
- return self._rotation
61
-
62
- @property
63
- def dimension(self) -> Dimension:
64
- """The current dimension the player is in"""
65
- return self._dimension
1
+ from __future__ import annotations
2
+
3
+ from typing import Tuple
4
+
5
+ from amulet.api.history import Changeable
6
+ from amulet.api.data_types import Dimension
7
+
8
+ LOCAL_PLAYER = "~local_player"
9
+
10
+
11
+ class Player(Changeable):
12
+ def __init__(
13
+ self,
14
+ player_id: str,
15
+ dimension: str,
16
+ location: Tuple[float, float, float],
17
+ rotation: Tuple[float, float],
18
+ ):
19
+ """
20
+ Creates a new instance of :class:`Player` with the given UUID, location, and rotation
21
+
22
+ :param player_id: The ID of the player
23
+ :param location: The location of the player in world coordinates
24
+ :param rotation: The rotation of the player
25
+ :param dimension: The dimension the player is in
26
+ """
27
+ super().__init__()
28
+ assert isinstance(player_id, str)
29
+ assert (
30
+ isinstance(location, tuple)
31
+ and len(location) == 3
32
+ and all(isinstance(f, float) for f in location)
33
+ )
34
+ assert (
35
+ isinstance(rotation, tuple)
36
+ and len(rotation) == 2
37
+ and all(isinstance(f, float) for f in rotation)
38
+ )
39
+ self._player_id = player_id
40
+ self._location = location
41
+ self._rotation = rotation
42
+ self._dimension = dimension
43
+
44
+ def __repr__(self):
45
+ return f"Player({self.player_id}, {self.dimension}, {self.location}, {self.rotation})"
46
+
47
+ @property
48
+ def player_id(self) -> str:
49
+ """The player's ID"""
50
+ return self._player_id
51
+
52
+ @property
53
+ def location(self) -> Tuple[float, float, float]:
54
+ """The current location of the player in the world"""
55
+ return self._location
56
+
57
+ @property
58
+ def rotation(self) -> Tuple[float, float]:
59
+ """The current rotation of the player in the world"""
60
+ return self._rotation
61
+
62
+ @property
63
+ def dimension(self) -> Dimension:
64
+ """The current dimension the player is in"""
65
+ return self._dimension
@@ -1,2 +1,2 @@
1
- from .biome_manager import BiomeManager
2
- from .block_manager import BlockManager
1
+ from .biome_manager import BiomeManager
2
+ from .block_manager import BlockManager
@@ -1,34 +1,34 @@
1
- from abc import ABC, abstractmethod
2
- from typing import Union, Tuple, Generator, Iterable, Any
3
-
4
- BaseType = Any
5
-
6
-
7
- class BaseRegistry(ABC):
8
- @abstractmethod
9
- def __len__(self):
10
- raise NotImplementedError
11
-
12
- @abstractmethod
13
- def __contains__(self, item: Union[int, BaseType]):
14
- raise NotImplementedError
15
-
16
- @abstractmethod
17
- def __iter__(self) -> Iterable[BaseType]:
18
- raise NotImplementedError
19
-
20
- @abstractmethod
21
- def values(self) -> Tuple[BaseType]:
22
- raise NotImplementedError
23
-
24
- @abstractmethod
25
- def items(self) -> Generator[Tuple[int, BaseType], None, None]:
26
- raise NotImplementedError
27
-
28
- @abstractmethod
29
- def __getitem__(self, item):
30
- raise NotImplementedError
31
-
32
- @abstractmethod
33
- def register(self, item: BaseType) -> int:
34
- raise NotImplementedError
1
+ from abc import ABC, abstractmethod
2
+ from typing import Union, Tuple, Generator, Iterable, Any
3
+
4
+ BaseType = Any
5
+
6
+
7
+ class BaseRegistry(ABC):
8
+ @abstractmethod
9
+ def __len__(self):
10
+ raise NotImplementedError
11
+
12
+ @abstractmethod
13
+ def __contains__(self, item: Union[int, BaseType]):
14
+ raise NotImplementedError
15
+
16
+ @abstractmethod
17
+ def __iter__(self) -> Iterable[BaseType]:
18
+ raise NotImplementedError
19
+
20
+ @abstractmethod
21
+ def values(self) -> Tuple[BaseType]:
22
+ raise NotImplementedError
23
+
24
+ @abstractmethod
25
+ def items(self) -> Generator[Tuple[int, BaseType], None, None]:
26
+ raise NotImplementedError
27
+
28
+ @abstractmethod
29
+ def __getitem__(self, item):
30
+ raise NotImplementedError
31
+
32
+ @abstractmethod
33
+ def register(self, item: BaseType) -> int:
34
+ raise NotImplementedError