amulet-core 2.0a8__cp311-cp311-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a1__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.
- amulet/core/__init__.py +36 -0
- amulet/core/__pyinstaller/hook-amulet.core.py +4 -0
- amulet/core/_amulet_core.cp311-win_amd64.pyd +0 -0
- amulet/core/_amulet_core.pyi +7 -0
- amulet/{_version.py → core/_version.py} +3 -3
- amulet/core/amulet_core.dll +0 -0
- amulet/core/amulet_core.lib +0 -0
- amulet/core/amulet_coreConfig.cmake +18 -0
- amulet/{biome.pyi → core/biome/__init__.pyi} +3 -3
- amulet/core/biome/biome.hpp +53 -0
- amulet/{block.pyi → core/block/__init__.pyi} +25 -26
- amulet/core/block/block.hpp +156 -0
- amulet/{block_entity.pyi → core/block_entity/__init__.pyi} +7 -7
- amulet/core/block_entity/block_entity.hpp +84 -0
- amulet/{errors.py → core/chunk/__init__.pyi} +37 -33
- amulet/core/chunk/chunk.hpp +126 -0
- amulet/core/chunk/component/__init__.pyi +18 -0
- amulet/core/chunk/component/biome_3d_component.hpp +96 -0
- amulet/core/chunk/component/block_component.hpp +101 -0
- amulet/core/chunk/component/block_component.pyi +28 -0
- amulet/core/chunk/component/block_entity_component.hpp +119 -0
- amulet/core/chunk/component/section_array_map.hpp +129 -0
- amulet/{chunk_components.pyi → core/chunk/component/section_array_map.pyi} +4 -24
- amulet/core/dll.hpp +21 -0
- amulet/core/entity/__init__.pyi +105 -0
- amulet/core/entity/entity.hpp +100 -0
- amulet/{palette → core/palette}/__init__.pyi +2 -2
- amulet/core/palette/biome_palette.hpp +65 -0
- amulet/{palette → core/palette}/biome_palette.pyi +8 -8
- amulet/core/palette/block_palette.hpp +71 -0
- amulet/{palette → core/palette}/block_palette.pyi +12 -10
- amulet/core/selection/__init__.pyi +8 -0
- amulet/core/selection/box.hpp +86 -0
- amulet/core/selection/box.pyi +215 -0
- amulet/core/selection/group.hpp +80 -0
- amulet/core/selection/group.pyi +213 -0
- amulet/{version.pyi → core/version/__init__.pyi} +58 -10
- amulet/core/version/version.hpp +204 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/METADATA +25 -20
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/RECORD +45 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/WHEEL +1 -1
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/entry_points.txt +2 -0
- amulet/__init__.cp311-win_amd64.pyd +0 -0
- amulet/__init__.py.cpp +0 -45
- amulet/__init__.pyi +0 -30
- amulet/__pyinstaller/hook-amulet.py +0 -4
- amulet/_init.py +0 -26
- amulet/biome.cpp +0 -36
- amulet/biome.hpp +0 -43
- amulet/biome.py.cpp +0 -122
- amulet/block.cpp +0 -435
- amulet/block.hpp +0 -119
- amulet/block.py.cpp +0 -377
- amulet/block_entity.cpp +0 -12
- amulet/block_entity.hpp +0 -56
- amulet/block_entity.py.cpp +0 -115
- amulet/chunk.cpp +0 -16
- amulet/chunk.hpp +0 -100
- amulet/chunk.py.cpp +0 -80
- amulet/chunk.pyi +0 -28
- amulet/chunk_components/biome_3d_component.cpp +0 -5
- amulet/chunk_components/biome_3d_component.hpp +0 -79
- amulet/chunk_components/block_component.cpp +0 -41
- amulet/chunk_components/block_component.hpp +0 -88
- amulet/chunk_components/block_entity_component.cpp +0 -5
- amulet/chunk_components/block_entity_component.hpp +0 -147
- amulet/chunk_components/section_array_map.cpp +0 -129
- amulet/chunk_components/section_array_map.hpp +0 -147
- amulet/collections/eq.py.hpp +0 -37
- amulet/collections/hash.py.hpp +0 -27
- amulet/collections/holder.py.hpp +0 -37
- amulet/collections/iterator.py.hpp +0 -80
- amulet/collections/mapping.py.hpp +0 -199
- amulet/collections/mutable_mapping.py.hpp +0 -226
- amulet/collections/sequence.py.hpp +0 -163
- amulet/collections.pyi +0 -40
- amulet/data_types.py +0 -29
- amulet/entity.py +0 -182
- amulet/game/__init__.py +0 -7
- amulet/game/_game.py +0 -152
- amulet/game/_universal/__init__.py +0 -1
- amulet/game/_universal/_biome.py +0 -17
- amulet/game/_universal/_block.py +0 -47
- amulet/game/_universal/_version.py +0 -68
- amulet/game/abc/__init__.py +0 -22
- amulet/game/abc/_block_specification.py +0 -150
- amulet/game/abc/biome.py +0 -213
- amulet/game/abc/block.py +0 -331
- amulet/game/abc/game_version_container.py +0 -25
- amulet/game/abc/json_interface.py +0 -27
- amulet/game/abc/version.py +0 -44
- amulet/game/bedrock/__init__.py +0 -1
- amulet/game/bedrock/_biome.py +0 -35
- amulet/game/bedrock/_block.py +0 -42
- amulet/game/bedrock/_version.py +0 -165
- amulet/game/java/__init__.py +0 -2
- amulet/game/java/_biome.py +0 -35
- amulet/game/java/_block.py +0 -60
- amulet/game/java/_version.py +0 -176
- amulet/game/translate/__init__.py +0 -12
- amulet/game/translate/_functions/__init__.py +0 -15
- amulet/game/translate/_functions/_code_functions/__init__.py +0 -0
- amulet/game/translate/_functions/_code_functions/_text.py +0 -553
- amulet/game/translate/_functions/_code_functions/banner_pattern.py +0 -67
- amulet/game/translate/_functions/_code_functions/bedrock_chest_connection.py +0 -152
- amulet/game/translate/_functions/_code_functions/bedrock_moving_block_pos.py +0 -88
- amulet/game/translate/_functions/_code_functions/bedrock_sign.py +0 -152
- amulet/game/translate/_functions/_code_functions/bedrock_skull_rotation.py +0 -16
- amulet/game/translate/_functions/_code_functions/custom_name.py +0 -146
- amulet/game/translate/_functions/_frozen.py +0 -66
- amulet/game/translate/_functions/_state.py +0 -54
- amulet/game/translate/_functions/_typing.py +0 -98
- amulet/game/translate/_functions/abc.py +0 -123
- amulet/game/translate/_functions/carry_nbt.py +0 -160
- amulet/game/translate/_functions/carry_properties.py +0 -80
- amulet/game/translate/_functions/code.py +0 -143
- amulet/game/translate/_functions/map_block_name.py +0 -66
- amulet/game/translate/_functions/map_nbt.py +0 -111
- amulet/game/translate/_functions/map_properties.py +0 -93
- amulet/game/translate/_functions/multiblock.py +0 -112
- amulet/game/translate/_functions/new_block.py +0 -42
- amulet/game/translate/_functions/new_entity.py +0 -43
- amulet/game/translate/_functions/new_nbt.py +0 -206
- amulet/game/translate/_functions/new_properties.py +0 -64
- amulet/game/translate/_functions/sequence.py +0 -51
- amulet/game/translate/_functions/walk_input_nbt.py +0 -331
- amulet/game/translate/_translator.py +0 -433
- amulet/img/__init__.py +0 -10
- amulet/img/missing_no.png +0 -0
- amulet/img/missing_pack.png +0 -0
- amulet/img/missing_world.png +0 -0
- amulet/io/binary_reader.hpp +0 -45
- amulet/io/binary_writer.hpp +0 -30
- amulet/item.py +0 -75
- amulet/level/__init__.pyi +0 -23
- amulet/level/_load.py +0 -100
- amulet/level/abc/__init__.py +0 -12
- amulet/level/abc/_chunk_handle.py +0 -358
- amulet/level/abc/_dimension.py +0 -86
- amulet/level/abc/_history/__init__.py +0 -1
- amulet/level/abc/_history/_cache.py +0 -224
- amulet/level/abc/_history/_history_manager.py +0 -291
- amulet/level/abc/_level/__init__.py +0 -5
- amulet/level/abc/_level/_compactable_level.py +0 -10
- amulet/level/abc/_level/_creatable_level.py +0 -28
- amulet/level/abc/_level/_disk_level.py +0 -17
- amulet/level/abc/_level/_level.py +0 -449
- amulet/level/abc/_level/_loadable_level.py +0 -42
- amulet/level/abc/_player_storage.py +0 -7
- amulet/level/abc/_raw_level.py +0 -187
- amulet/level/abc/_registry.py +0 -40
- amulet/level/java/__init__.pyi +0 -16
- amulet/level/java/_chunk_handle.py +0 -17
- amulet/level/java/_dimension.py +0 -20
- amulet/level/java/_level.py +0 -184
- amulet/level/java/_raw/__init__.pyi +0 -15
- amulet/level/java/_raw/_chunk.pyi +0 -23
- amulet/level/java/_raw/_constant.py +0 -9
- amulet/level/java/_raw/_data_pack/__init__.py +0 -2
- amulet/level/java/_raw/_data_pack/data_pack.py +0 -241
- amulet/level/java/_raw/_data_pack/data_pack_manager.py +0 -77
- amulet/level/java/_raw/_dimension.py +0 -86
- amulet/level/java/_raw/_level.py +0 -507
- amulet/level/java/_raw/_typing.py +0 -3
- amulet/level/java/_raw/java_chunk_decode.cpp +0 -531
- amulet/level/java/_raw/java_chunk_decode.hpp +0 -23
- amulet/level/java/_raw/java_chunk_encode.cpp +0 -25
- amulet/level/java/_raw/java_chunk_encode.hpp +0 -23
- amulet/level/java/anvil/__init__.py +0 -2
- amulet/level/java/anvil/_dimension.py +0 -170
- amulet/level/java/anvil/_region.py +0 -421
- amulet/level/java/anvil/_sector_manager.py +0 -223
- amulet/level/java/chunk.pyi +0 -81
- amulet/level/java/chunk_/_chunk.py +0 -260
- amulet/level/java/chunk_/components/inhabited_time.py +0 -12
- amulet/level/java/chunk_/components/last_update.py +0 -12
- amulet/level/java/chunk_/components/legacy_version.py +0 -12
- amulet/level/java/chunk_/components/light_populated.py +0 -12
- amulet/level/java/chunk_/components/named_height_2d.py +0 -37
- amulet/level/java/chunk_/components/status.py +0 -11
- amulet/level/java/chunk_/components/terrain_populated.py +0 -12
- amulet/level/java/chunk_components/data_version_component.cpp +0 -32
- amulet/level/java/chunk_components/data_version_component.hpp +0 -31
- amulet/level/java/chunk_components/java_raw_chunk_component.cpp +0 -56
- amulet/level/java/chunk_components/java_raw_chunk_component.hpp +0 -45
- amulet/level/java/chunk_components.pyi +0 -22
- amulet/level/java/java_chunk.cpp +0 -170
- amulet/level/java/java_chunk.hpp +0 -141
- amulet/level/java/long_array.hpp +0 -175
- amulet/level/java/long_array.pyi +0 -39
- amulet/level/temporary_level/__init__.py +0 -1
- amulet/level/temporary_level/_level.py +0 -16
- amulet/mesh/__init__.py +0 -0
- amulet/mesh/block/__init__.pyi +0 -301
- amulet/mesh/block/_cube.py +0 -198
- amulet/mesh/block/_missing_block.py +0 -20
- amulet/mesh/block/block_mesh.cpp +0 -107
- amulet/mesh/block/block_mesh.hpp +0 -207
- amulet/mesh/util.py +0 -17
- amulet/palette/biome_palette.hpp +0 -85
- amulet/palette/block_palette.cpp +0 -32
- amulet/palette/block_palette.hpp +0 -93
- amulet/player.py +0 -62
- amulet/pybind11/collections.hpp +0 -118
- amulet/pybind11/numpy.hpp +0 -26
- amulet/pybind11/py_module.hpp +0 -34
- amulet/pybind11/type_hints.hpp +0 -51
- amulet/pybind11/types.hpp +0 -25
- amulet/pybind11/typing.hpp +0 -7
- amulet/resource_pack/__init__.py +0 -63
- amulet/resource_pack/abc/__init__.py +0 -2
- amulet/resource_pack/abc/resource_pack.py +0 -38
- amulet/resource_pack/abc/resource_pack_manager.py +0 -85
- amulet/resource_pack/java/__init__.py +0 -2
- amulet/resource_pack/java/download_resources.py +0 -212
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
- amulet/resource_pack/java/resource_pack.py +0 -44
- amulet/resource_pack/java/resource_pack_manager.py +0 -563
- amulet/resource_pack/unknown_resource_pack.py +0 -10
- amulet/selection/__init__.py +0 -2
- amulet/selection/abstract_selection.py +0 -342
- amulet/selection/box.py +0 -852
- amulet/selection/group.py +0 -481
- amulet/utils/__init__.pyi +0 -23
- amulet/utils/call_spec/__init__.py +0 -24
- amulet/utils/call_spec/_call_spec.py +0 -257
- amulet/utils/cast.py +0 -10
- amulet/utils/comment_json.py +0 -188
- amulet/utils/format_utils.py +0 -41
- amulet/utils/generator.py +0 -18
- amulet/utils/matrix.py +0 -243
- amulet/utils/numpy.hpp +0 -36
- amulet/utils/numpy.pyi +0 -11
- amulet/utils/numpy_helpers.py +0 -19
- amulet/utils/shareable_lock.py +0 -335
- amulet/utils/signal/__init__.py +0 -10
- amulet/utils/signal/_signal.py +0 -228
- amulet/utils/task_manager.py +0 -235
- amulet/utils/typed_property.py +0 -111
- amulet/utils/weakref.py +0 -70
- amulet/utils/world_utils.py +0 -102
- amulet/version.cpp +0 -136
- amulet/version.hpp +0 -142
- amulet/version.py.cpp +0 -281
- amulet_core-2.0a8.dist-info/RECORD +0 -241
- amulet_core-2.0a8.dist-info/entry_points.txt +0 -2
- /amulet/{__pyinstaller → core/__pyinstaller}/__init__.py +0 -0
- /amulet/{py.typed → core/py.typed} +0 -0
- {amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <algorithm>
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <initializer_list>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <sstream>
|
|
8
|
+
#include <string>
|
|
9
|
+
#include <vector>
|
|
10
|
+
|
|
11
|
+
#include <amulet/io/binary_reader.hpp>
|
|
12
|
+
#include <amulet/io/binary_writer.hpp>
|
|
13
|
+
|
|
14
|
+
#include <amulet/core/dll.hpp>
|
|
15
|
+
|
|
16
|
+
namespace Amulet {
|
|
17
|
+
|
|
18
|
+
typedef std::string PlatformType;
|
|
19
|
+
|
|
20
|
+
// This class is designed to store semantic versions and data versions and allow comparisons between them.
|
|
21
|
+
// It is a wrapper around std::vector<std::int64_t> with special comparison handling.
|
|
22
|
+
// The version can contain zero to max(int64) values.
|
|
23
|
+
// Undefined trailing values are implied zeros. 1.1 == 1.1.0
|
|
24
|
+
// All methods are thread safe.
|
|
25
|
+
class VersionNumber {
|
|
26
|
+
private:
|
|
27
|
+
std::vector<std::int64_t> _vec;
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
// Get the underlying vector.
|
|
31
|
+
// Thread safe.
|
|
32
|
+
const std::vector<std::int64_t>& get_vector() const { return _vec; }
|
|
33
|
+
|
|
34
|
+
// Constructors
|
|
35
|
+
template <typename... Args>
|
|
36
|
+
requires std::is_constructible_v<std::vector<std::int64_t>, Args...>
|
|
37
|
+
VersionNumber(Args&&... args)
|
|
38
|
+
: _vec(std::forward<Args>(args)...)
|
|
39
|
+
{
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
VersionNumber(std::initializer_list<std::int64_t> args)
|
|
43
|
+
: _vec(args)
|
|
44
|
+
{
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
48
|
+
AMULET_CORE_EXPORT static VersionNumber deserialise(BinaryReader&);
|
|
49
|
+
|
|
50
|
+
// Iterators
|
|
51
|
+
std::vector<std::int64_t>::const_iterator begin() const { return _vec.begin(); }
|
|
52
|
+
std::vector<std::int64_t>::const_iterator end() const { return _vec.end(); }
|
|
53
|
+
std::vector<std::int64_t>::const_reverse_iterator rbegin() const { return _vec.rbegin(); }
|
|
54
|
+
std::vector<std::int64_t>::const_reverse_iterator rend() const { return _vec.rend(); }
|
|
55
|
+
|
|
56
|
+
// Capacity
|
|
57
|
+
size_t size() const { return _vec.size(); }
|
|
58
|
+
|
|
59
|
+
// Element access
|
|
60
|
+
std::int64_t operator[](size_t index) const {
|
|
61
|
+
if (index >= _vec.size()) {
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
return _vec[index];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Comparison
|
|
68
|
+
auto operator<=>(const VersionNumber& other) const
|
|
69
|
+
{
|
|
70
|
+
size_t max_len = std::max(_vec.size(), other.size());
|
|
71
|
+
std::int64_t v1, v2;
|
|
72
|
+
for (size_t i = 0; i < max_len; i++) {
|
|
73
|
+
v1 = (*this)[i];
|
|
74
|
+
v2 = other[i];
|
|
75
|
+
if (v1 < v2) {
|
|
76
|
+
// Less than
|
|
77
|
+
return std::strong_ordering::less;
|
|
78
|
+
}
|
|
79
|
+
if (v1 > v2) {
|
|
80
|
+
// Greater than
|
|
81
|
+
return std::strong_ordering::greater;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// equal
|
|
85
|
+
return std::strong_ordering::equal;
|
|
86
|
+
}
|
|
87
|
+
bool operator==(const VersionNumber& other) const
|
|
88
|
+
{
|
|
89
|
+
return (*this <=> other) == 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Convert the value to its string representation eg "1.1"
|
|
93
|
+
AMULET_CORE_EXPORT std::string toString() const;
|
|
94
|
+
|
|
95
|
+
// The version number with trailing zeros cut off.
|
|
96
|
+
AMULET_CORE_EXPORT std::vector<std::int64_t> cropped_version() const;
|
|
97
|
+
|
|
98
|
+
// Get the version number cropped or padded with zeros to the given length.
|
|
99
|
+
AMULET_CORE_EXPORT std::vector<std::int64_t> padded_version(size_t len) const;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// A class storing platform identifier and version number.
|
|
103
|
+
// Thread safe.
|
|
104
|
+
class PlatformVersionContainer {
|
|
105
|
+
private:
|
|
106
|
+
PlatformType _platform;
|
|
107
|
+
VersionNumber _version;
|
|
108
|
+
|
|
109
|
+
public:
|
|
110
|
+
// Get the platform identifier.
|
|
111
|
+
const PlatformType& get_platform() const { return _platform; }
|
|
112
|
+
|
|
113
|
+
// Get the version number.
|
|
114
|
+
const VersionNumber& get_version() const { return _version; }
|
|
115
|
+
|
|
116
|
+
template <typename PlatformT, typename VersionNumberT>
|
|
117
|
+
PlatformVersionContainer(
|
|
118
|
+
PlatformT&& platform,
|
|
119
|
+
VersionNumberT&& version)
|
|
120
|
+
: _platform(std::forward<PlatformT>(platform))
|
|
121
|
+
, _version(std::forward<VersionNumberT>(version))
|
|
122
|
+
{
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
126
|
+
AMULET_CORE_EXPORT static PlatformVersionContainer deserialise(BinaryReader&);
|
|
127
|
+
|
|
128
|
+
// Comparison operators
|
|
129
|
+
auto operator<=>(const PlatformVersionContainer& other) const
|
|
130
|
+
{
|
|
131
|
+
auto cmp = _platform <=> other._platform;
|
|
132
|
+
if (cmp != 0) {
|
|
133
|
+
return cmp;
|
|
134
|
+
}
|
|
135
|
+
return _version <=> other._version;
|
|
136
|
+
}
|
|
137
|
+
bool operator==(const PlatformVersionContainer& other) const
|
|
138
|
+
{
|
|
139
|
+
return (*this <=> other) == 0;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// A class storing platform identifier and minimum and maximum version numbers.
|
|
144
|
+
// Thread safe.
|
|
145
|
+
class VersionRange {
|
|
146
|
+
private:
|
|
147
|
+
PlatformType _platform;
|
|
148
|
+
VersionNumber _min_version;
|
|
149
|
+
VersionNumber _max_version;
|
|
150
|
+
|
|
151
|
+
public:
|
|
152
|
+
// Get the platform identifier.
|
|
153
|
+
const PlatformType& get_platform() const { return _platform; }
|
|
154
|
+
|
|
155
|
+
// Get the minimum version number
|
|
156
|
+
const VersionNumber& get_min_version() const { return _min_version; }
|
|
157
|
+
|
|
158
|
+
// Get the maximum version number
|
|
159
|
+
const VersionNumber& get_max_version() const { return _max_version; }
|
|
160
|
+
|
|
161
|
+
template <typename PlatformT, typename MinVersionT, typename MaxVersionT>
|
|
162
|
+
VersionRange(
|
|
163
|
+
PlatformT&& platform,
|
|
164
|
+
MinVersionT&& min_version,
|
|
165
|
+
MaxVersionT&& max_version)
|
|
166
|
+
: _platform(std::forward<PlatformT>(platform))
|
|
167
|
+
, _min_version(std::forward<MinVersionT>(min_version))
|
|
168
|
+
, _max_version(std::forward<MaxVersionT>(max_version))
|
|
169
|
+
{
|
|
170
|
+
if (_min_version > _max_version) {
|
|
171
|
+
throw std::invalid_argument("min_version must be less than or equal to max_version");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
176
|
+
AMULET_CORE_EXPORT static VersionRange deserialise(BinaryReader&);
|
|
177
|
+
|
|
178
|
+
// Check if the platform is equal and the version number is within the range.
|
|
179
|
+
AMULET_CORE_EXPORT bool contains(const PlatformType& platform_, const VersionNumber& version) const;
|
|
180
|
+
|
|
181
|
+
// Equality operator
|
|
182
|
+
AMULET_CORE_EXPORT bool operator==(const VersionRange&) const;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// A class that contains a version range.
|
|
186
|
+
class VersionRangeContainer {
|
|
187
|
+
private:
|
|
188
|
+
VersionRange _version_range;
|
|
189
|
+
|
|
190
|
+
public:
|
|
191
|
+
// Get the version range.
|
|
192
|
+
const VersionRange& get_version_range() const { return _version_range; }
|
|
193
|
+
|
|
194
|
+
template <typename VersionRangeT>
|
|
195
|
+
VersionRangeContainer(
|
|
196
|
+
VersionRangeT&& version_range)
|
|
197
|
+
: _version_range(std::forward<VersionRangeT>(version_range))
|
|
198
|
+
{
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
202
|
+
AMULET_CORE_EXPORT static VersionRangeContainer deserialise(BinaryReader&);
|
|
203
|
+
};
|
|
204
|
+
}
|
{amulet_core-2.0a8.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info}/METADATA
RENAMED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: amulet-core
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.0.1.0.1297307203.19.43.34808.0a1
|
|
4
4
|
Summary: A Python library for reading/writing Minecraft's various save formats.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author: James Clare, Ben Gothard
|
|
6
|
+
Project-URL: Homepage, https://www.amuletmc.com
|
|
7
|
+
Project-URL: Repository, https://github.com/Amulet-Team/Amulet-Core
|
|
8
|
+
Project-URL: Issues, https://github.com/Amulet-Team/Amulet-Core/issues
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Requires-Python: >=3.11
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: amulet-compiler-target==1.0
|
|
13
14
|
Requires-Dist: numpy~=2.0
|
|
14
|
-
Requires-Dist: amulet-
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist: amulet-
|
|
17
|
-
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
15
|
+
Requires-Dist: amulet-compiler-version==3.0.0.1297307203.19.43.34808.0
|
|
16
|
+
Requires-Dist: amulet-io~=1.0.0.0
|
|
17
|
+
Requires-Dist: amulet-nbt~=4.0.1.0a0
|
|
18
|
+
Provides-Extra: docs
|
|
19
|
+
Requires-Dist: Sphinx>=1.7.4; extra == "docs"
|
|
20
|
+
Requires-Dist: sphinx-autodoc-typehints>=1.3.0; extra == "docs"
|
|
21
|
+
Requires-Dist: sphinx_rtd_theme>=0.3.1; extra == "docs"
|
|
21
22
|
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: setuptools>=42; extra == "dev"
|
|
24
|
+
Requires-Dist: versioneer; extra == "dev"
|
|
25
|
+
Requires-Dist: packaging; extra == "dev"
|
|
26
|
+
Requires-Dist: wheel; extra == "dev"
|
|
27
|
+
Requires-Dist: pybind11[global]==2.13.6; extra == "dev"
|
|
28
|
+
Requires-Dist: amulet_pybind11_extensions~=1.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pybind11_stubgen>=2.5.4; extra == "dev"
|
|
22
30
|
Requires-Dist: black>=22.3; extra == "dev"
|
|
23
|
-
Requires-Dist: pre-commit>=1.11.1; extra == "dev"
|
|
24
|
-
Requires-Dist: mypy; extra == "dev"
|
|
25
|
-
Requires-Dist: types-pyinstaller; extra == "dev"
|
|
26
31
|
Requires-Dist: isort; extra == "dev"
|
|
27
32
|
Requires-Dist: autoflake; extra == "dev"
|
|
28
|
-
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
|
|
33
|
+
Requires-Dist: mypy; extra == "dev"
|
|
34
|
+
Requires-Dist: types-pyinstaller; extra == "dev"
|
|
35
|
+
Requires-Dist: amulet-test-utils~=1.1; extra == "dev"
|
|
36
|
+
Dynamic: requires-dist
|
|
32
37
|
|
|
33
38
|
# Amulet Core
|
|
34
39
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
amulet/core/__init__.py,sha256=pfhPDVh2laUpJHVmUkoeX-q1P4szpIOsNoL0FdoVCu4,915
|
|
2
|
+
amulet/core/_amulet_core.cp311-win_amd64.pyd,sha256=fhMh_H1Ws1mr_G7YNdLDEY-9dxqRv_57sBhAhPZhm28,687104
|
|
3
|
+
amulet/core/_amulet_core.pyi,sha256=6KCygVcKCdfcpjegv7RMDgxKh9M6F-IHNhPUNGZAlyQ,123
|
|
4
|
+
amulet/core/_version.py,sha256=JGeWrGksQNCazglgs2gtJ8brocuDFo_rCv835tBsVok,520
|
|
5
|
+
amulet/core/amulet_core.dll,sha256=GnYBZdME-1nx5lFllfnWP4tZbZdAqwErjmsYB_DImKM,143360
|
|
6
|
+
amulet/core/amulet_core.lib,sha256=RzD5dY_lZknOz5evjmGdALVddMiCEBjq_mBPWOhYmu8,45026
|
|
7
|
+
amulet/core/amulet_coreConfig.cmake,sha256=eCpbb2Z3J1mDKeDwZGHf7LqsflWwJaYiDN-Fda_TmEc,714
|
|
8
|
+
amulet/core/dll.hpp,sha256=pyhd9lh570R1Qi7TPPnKoiB-fAFmQan8Vnk-oZmuK70,586
|
|
9
|
+
amulet/core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
amulet/core/__pyinstaller/__init__.py,sha256=vNM3T3GSrs58ywzILHdIsQP2sglKq6Jn4qwCGC3CZVQ,56
|
|
11
|
+
amulet/core/__pyinstaller/hook-amulet.core.py,sha256=AmV845T4BRjex63_T_KCeKLUlV0DxEk6aWsUJaLqyGE,172
|
|
12
|
+
amulet/core/biome/__init__.pyi,sha256=rRxGRmd4vq1BlYysmo0SdRYEVzNzyGTbn_hpRHrrdIk,2157
|
|
13
|
+
amulet/core/biome/biome.hpp,sha256=6RftLCHa4jVLr3lmRU8RIuA4K5REU-1J8SmJts7Ty0Y,1539
|
|
14
|
+
amulet/core/block/__init__.pyi,sha256=BMiVVmYDzFABg-Y5I0T7YcmLZRK8N-AL2YCcFD7Ue8w,9592
|
|
15
|
+
amulet/core/block/block.hpp,sha256=iRZyFKwfM7tbiXaHN6MNZeedpVr8SZkkKPPm20Tkgbo,4702
|
|
16
|
+
amulet/core/block_entity/__init__.pyi,sha256=95L-jlRnn4hTin13m_7f72M0uFkP4DQNE1T1PsA3eys,2159
|
|
17
|
+
amulet/core/block_entity/block_entity.hpp,sha256=q_8rzz4JCQ-L4q025G-ooQ2G47Hf6hyn3Wou4GZZ1Dc,2277
|
|
18
|
+
amulet/core/chunk/__init__.pyi,sha256=3CXjNyVx1FXuUeAZ0MdQgwPeFMY_63incYHG3IQxwqY,1946
|
|
19
|
+
amulet/core/chunk/chunk.hpp,sha256=r3s5nPd60XwTyulG8xA7VdPH72OwDFwD-32faKp75ds,3915
|
|
20
|
+
amulet/core/chunk/component/__init__.pyi,sha256=stjIjJy7yTVxicTbxsUh6H_57BvHRiNexqTWA0khlyQ,450
|
|
21
|
+
amulet/core/chunk/component/biome_3d_component.hpp,sha256=Dx-16Qg1LsGSvxDSN7PmBpDvaUnXMzKEYAFPshuQmvw,3138
|
|
22
|
+
amulet/core/chunk/component/block_component.hpp,sha256=JFk1O1IBWWX9-blvQN0Kv1xNUuWYWpMxkPB6jzIoG2w,3361
|
|
23
|
+
amulet/core/chunk/component/block_component.pyi,sha256=Yn19Tm9S-ekqXJGcwOMBe3fiAgvZDT7GkVvBHjhdaIY,839
|
|
24
|
+
amulet/core/chunk/component/block_entity_component.hpp,sha256=wCv7Im03GqPoTLmtt0bmvxrS12kJN_qjzqONuRZ2YmE,3918
|
|
25
|
+
amulet/core/chunk/component/section_array_map.hpp,sha256=V_WAG56rz3SAUWMMLgoPAhY3faH3t4Egg9_PsSERueE,3855
|
|
26
|
+
amulet/core/chunk/component/section_array_map.pyi,sha256=8Ws6Amv9WlDkJh-_WDY5ruT2IHaupnUo6jsnywbdtqs,2718
|
|
27
|
+
amulet/core/entity/__init__.pyi,sha256=YNHd5CO245N678jRMkIRryt8BmMqwVqIglEx0UZ77VQ,2573
|
|
28
|
+
amulet/core/entity/entity.hpp,sha256=02TsWsA2XNmULM92lx0Wby-exVur4Myncu_IY_a2KQ4,2911
|
|
29
|
+
amulet/core/palette/__init__.pyi,sha256=_QLcDg5WSp-Y67CAUoa-EmA6zptftMvJtX8FfeDZJM8,284
|
|
30
|
+
amulet/core/palette/biome_palette.hpp,sha256=V4OWp4TpLu0rXnyFM-UyP5rFzWhmtqP5MWbDjQC0nX8,2033
|
|
31
|
+
amulet/core/palette/biome_palette.pyi,sha256=vcQahmsRxVy0Y2J96Wk5is0t4FSUiRBZ6V5buSGwsSs,1652
|
|
32
|
+
amulet/core/palette/block_palette.hpp,sha256=e_LLR444vkbMO3KR5xhx0scIcgfd1HqEKyMiwqXqheY,2307
|
|
33
|
+
amulet/core/palette/block_palette.pyi,sha256=dkNqcDYFHVQ8hKzEe48pa4SNlfQbvwWMwxVVYr4s09g,1779
|
|
34
|
+
amulet/core/selection/__init__.pyi,sha256=STDthuVyAmuNrLp_uCvy-Nn54k8dzKZV1d0jM_KHu4g,238
|
|
35
|
+
amulet/core/selection/box.hpp,sha256=WfQiXqRMSbaaxnVhpfdP4VzDhSIx3mnnakoGrZKv2aQ,3031
|
|
36
|
+
amulet/core/selection/box.pyi,sha256=wwHCJAjZYmR_cKfOBWmmdggq5sHZO5R4bGuWp2GWvM0,6426
|
|
37
|
+
amulet/core/selection/group.hpp,sha256=xK07faXoiVePn9v7sJ_oZJfie3lqgzcOuGkdRe4BsUA,2292
|
|
38
|
+
amulet/core/selection/group.pyi,sha256=0dbn4ZCh7D2PFhzLbGuuS1Mr_WIo-sWtugxe4grWB8s,6401
|
|
39
|
+
amulet/core/version/__init__.pyi,sha256=0-2azYaixOPPVeXGGy_JKZTeFHy6IP6z-hgfZ3WaxWs,4104
|
|
40
|
+
amulet/core/version/version.hpp,sha256=yVc_uhBgmHQ0Evo73rXXoRwSQMHakUQxSYR3_fu2KH4,6506
|
|
41
|
+
amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/METADATA,sha256=n-dTrUXRsBMM-CTTGir6fSPZ_Ze84uHDFkBoAUjPHsI,5023
|
|
42
|
+
amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
|
|
43
|
+
amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/entry_points.txt,sha256=a64mqk_dgbzVyk-pz0WKpK6kNAhIGdVT9DO2VqDIAc8,68
|
|
44
|
+
amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/top_level.txt,sha256=3ZqHzNDiIb9kV8TwSeeXxK_9haSrsu631Qe4ndDo0rc,7
|
|
45
|
+
amulet_core-2.0.1.0.1297307203.19.43.34808.0a1.dist-info/RECORD,,
|
|
Binary file
|
amulet/__init__.py.cpp
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#include <pybind11/pybind11.h>
|
|
2
|
-
namespace py = pybind11;
|
|
3
|
-
|
|
4
|
-
void init_collections(py::module);
|
|
5
|
-
void init_utils(py::module);
|
|
6
|
-
void init_version(py::module);
|
|
7
|
-
void init_block(py::module);
|
|
8
|
-
void init_block_entity(py::module);
|
|
9
|
-
void init_biome(py::module);
|
|
10
|
-
void init_palette(py::module);
|
|
11
|
-
void init_chunk(py::module);
|
|
12
|
-
void init_chunk_components(py::module);
|
|
13
|
-
void init_level(py::module);
|
|
14
|
-
void init_block_mesh(py::module);
|
|
15
|
-
|
|
16
|
-
static bool init_run = false;
|
|
17
|
-
|
|
18
|
-
void init_amulet(py::module m){
|
|
19
|
-
if (init_run){ return; }
|
|
20
|
-
init_run = true;
|
|
21
|
-
|
|
22
|
-
// This is normally added after initilsation but we need it to pass to subpackages.
|
|
23
|
-
// This may cause issues with frozen installs.
|
|
24
|
-
m.attr("__path__") = py::module::import("importlib.util").attr("find_spec")("amulet").attr("submodule_search_locations");
|
|
25
|
-
|
|
26
|
-
py::module::import("amulet_nbt");
|
|
27
|
-
|
|
28
|
-
py::module::import("amulet._init").attr("init")(m);
|
|
29
|
-
|
|
30
|
-
// Submodules
|
|
31
|
-
init_collections(m);
|
|
32
|
-
init_utils(m);
|
|
33
|
-
init_version(m);
|
|
34
|
-
init_block(m);
|
|
35
|
-
init_block_entity(m);
|
|
36
|
-
init_biome(m);
|
|
37
|
-
init_palette(m);
|
|
38
|
-
init_chunk(m);
|
|
39
|
-
init_chunk_components(m);
|
|
40
|
-
init_level(m);
|
|
41
|
-
init_block_mesh(m);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
PYBIND11_MODULE(__init__, m) { init_amulet(m); }
|
|
45
|
-
PYBIND11_MODULE(amulet, m) { init_amulet(m); }
|
amulet/__init__.pyi
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from . import (
|
|
4
|
-
biome,
|
|
5
|
-
block,
|
|
6
|
-
block_entity,
|
|
7
|
-
chunk,
|
|
8
|
-
chunk_components,
|
|
9
|
-
collections,
|
|
10
|
-
level,
|
|
11
|
-
mesh,
|
|
12
|
-
palette,
|
|
13
|
-
utils,
|
|
14
|
-
version,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
__all__ = [
|
|
18
|
-
"biome",
|
|
19
|
-
"block",
|
|
20
|
-
"block_entity",
|
|
21
|
-
"chunk",
|
|
22
|
-
"chunk_components",
|
|
23
|
-
"collections",
|
|
24
|
-
"level",
|
|
25
|
-
"mesh",
|
|
26
|
-
"palette",
|
|
27
|
-
"utils",
|
|
28
|
-
"version",
|
|
29
|
-
]
|
|
30
|
-
__version__: str
|
amulet/_init.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def init(m: Any) -> None:
|
|
5
|
-
import os
|
|
6
|
-
import logging
|
|
7
|
-
import platformdirs
|
|
8
|
-
|
|
9
|
-
from ._version import get_versions
|
|
10
|
-
|
|
11
|
-
m.__version__ = get_versions()["version"]
|
|
12
|
-
|
|
13
|
-
# m.entity_support = False
|
|
14
|
-
|
|
15
|
-
# Initialise default paths. Applications should override these environment variables.
|
|
16
|
-
# os.environ.setdefault("DATA_DIR", platformdirs.user_data_dir("AmuletTeam", "AmuletTeam"))
|
|
17
|
-
# os.environ.setdefault("CONFIG_DIR", platformdirs.user_config_dir("AmuletTeam", "AmuletTeam"))
|
|
18
|
-
os.environ.setdefault(
|
|
19
|
-
"CACHE_DIR", platformdirs.user_cache_dir("AmuletTeam", "AmuletTeam")
|
|
20
|
-
)
|
|
21
|
-
os.environ.setdefault(
|
|
22
|
-
"LOG_DIR", platformdirs.user_log_dir("AmuletTeam", "AmuletTeam")
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
# init a default logger
|
|
26
|
-
logging.basicConfig(level=logging.INFO, format="%(levelname)s - %(message)s")
|
amulet/biome.cpp
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#include <map>
|
|
2
|
-
#include <variant>
|
|
3
|
-
#include <type_traits>
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <functional>
|
|
6
|
-
#include <stdexcept>
|
|
7
|
-
|
|
8
|
-
#include <amulet/biome.hpp>
|
|
9
|
-
#include <amulet_nbt/nbt_encoding/binary.hpp>
|
|
10
|
-
#include <amulet_nbt/nbt_encoding/string.hpp>
|
|
11
|
-
|
|
12
|
-
namespace Amulet {
|
|
13
|
-
void Biome::serialise(BinaryWriter& writer) const {
|
|
14
|
-
writer.writeNumeric<std::uint8_t>(1);
|
|
15
|
-
writer.writeSizeAndBytes(get_platform());
|
|
16
|
-
get_version()->serialise(writer);
|
|
17
|
-
writer.writeSizeAndBytes(namespace_);
|
|
18
|
-
writer.writeSizeAndBytes(base_name);
|
|
19
|
-
}
|
|
20
|
-
std::shared_ptr<Biome> Biome::deserialise(BinaryReader& reader){
|
|
21
|
-
auto version_number = reader.readNumeric<std::uint8_t>();
|
|
22
|
-
switch (version_number) {
|
|
23
|
-
case 1:
|
|
24
|
-
{
|
|
25
|
-
std::string platform = reader.readSizeAndBytes();
|
|
26
|
-
std::shared_ptr<VersionNumber> version = VersionNumber::deserialise(reader);
|
|
27
|
-
std::string namespace_ = reader.readSizeAndBytes();
|
|
28
|
-
std::string base_name = reader.readSizeAndBytes();
|
|
29
|
-
return std::make_shared<Biome>(platform, version, namespace_, base_name);
|
|
30
|
-
}
|
|
31
|
-
default:
|
|
32
|
-
throw std::invalid_argument("Unsupported version " + std::to_string(version_number));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
amulet/biome.hpp
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <string>
|
|
4
|
-
|
|
5
|
-
#include <amulet/version.hpp>
|
|
6
|
-
#include <amulet/io/binary_reader.hpp>
|
|
7
|
-
#include <amulet/io/binary_writer.hpp>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
namespace Amulet {
|
|
11
|
-
class Biome: public PlatformVersionContainer {
|
|
12
|
-
private:
|
|
13
|
-
std::string namespace_;
|
|
14
|
-
std::string base_name;
|
|
15
|
-
public:
|
|
16
|
-
const std::string& get_namespace() const { return namespace_; }
|
|
17
|
-
const std::string& get_base_name() const { return base_name; }
|
|
18
|
-
|
|
19
|
-
Biome(
|
|
20
|
-
const PlatformType& platform,
|
|
21
|
-
std::shared_ptr<VersionNumber> version,
|
|
22
|
-
const std::string& namespace_,
|
|
23
|
-
const std::string& base_name
|
|
24
|
-
):
|
|
25
|
-
PlatformVersionContainer(platform, version),
|
|
26
|
-
namespace_(namespace_),
|
|
27
|
-
base_name(base_name) {}
|
|
28
|
-
|
|
29
|
-
void serialise(BinaryWriter&) const;
|
|
30
|
-
static std::shared_ptr<Biome> deserialise(BinaryReader&);
|
|
31
|
-
|
|
32
|
-
auto operator<=>(const Biome& other) const {
|
|
33
|
-
auto cmp = PlatformVersionContainer::operator<=>(other);
|
|
34
|
-
if (cmp != 0) { return cmp; }
|
|
35
|
-
cmp = namespace_ <=> other.namespace_;
|
|
36
|
-
if (cmp != 0) { return cmp; }
|
|
37
|
-
return base_name <=> other.base_name;
|
|
38
|
-
}
|
|
39
|
-
bool operator==(const Biome& other) const {
|
|
40
|
-
return (*this <=> other) == 0;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}
|
amulet/biome.py.cpp
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
#include <span>
|
|
2
|
-
#include <memory>
|
|
3
|
-
|
|
4
|
-
#include <pybind11/pybind11.h>
|
|
5
|
-
#include <pybind11/stl.h>
|
|
6
|
-
#include <pybind11/operators.h>
|
|
7
|
-
#include <pybind11/typing.h>
|
|
8
|
-
|
|
9
|
-
#include <amulet/biome.hpp>
|
|
10
|
-
#include <amulet/collections/eq.py.hpp>
|
|
11
|
-
|
|
12
|
-
namespace py = pybind11;
|
|
13
|
-
|
|
14
|
-
void init_biome(py::module m_parent) {
|
|
15
|
-
auto m = m_parent.def_submodule("biome");
|
|
16
|
-
py::class_<Amulet::Biome, Amulet::PlatformVersionContainer, std::shared_ptr<Amulet::Biome>> Biome(m, "Biome",
|
|
17
|
-
"A class to manage the state of a biome.\n"
|
|
18
|
-
"\n"
|
|
19
|
-
"It is an immutable object that contains the platform, version, namespace and base name.\n"
|
|
20
|
-
"\n"
|
|
21
|
-
"Here's a few examples on how create a Biome object:\n"
|
|
22
|
-
"\n"
|
|
23
|
-
">>> # Create a plains biome for Java 1.20.2\n"
|
|
24
|
-
">>> plains = Biome(\"java\", VersionNumber(3578), \"minecraft\", \"plains\")\n"
|
|
25
|
-
">>> # The version number for Java is the Java data version\n"
|
|
26
|
-
"\n"
|
|
27
|
-
">>> # Create a plains biome for Bedrock \n"
|
|
28
|
-
">>> plains = Biome(\"bedrock\", VersionNumber(1, 21, 0, 3), \"minecraft\", \"plains\")\n"
|
|
29
|
-
">>> # The biome version number is unused in Bedrock but it is here for completeness."
|
|
30
|
-
);
|
|
31
|
-
Biome.def(
|
|
32
|
-
py::init<
|
|
33
|
-
const Amulet::PlatformType&,
|
|
34
|
-
std::shared_ptr<Amulet::VersionNumber>,
|
|
35
|
-
const std::string&,
|
|
36
|
-
const std::string&
|
|
37
|
-
>(),
|
|
38
|
-
py::arg("platform"),
|
|
39
|
-
py::arg("version"),
|
|
40
|
-
py::arg("namespace"),
|
|
41
|
-
py::arg("base_name")
|
|
42
|
-
);
|
|
43
|
-
Biome.def_property_readonly(
|
|
44
|
-
"namespaced_name",
|
|
45
|
-
[](const Amulet::Biome& self) {
|
|
46
|
-
return self.get_namespace() + ":" + self.get_base_name();
|
|
47
|
-
},
|
|
48
|
-
py::doc(
|
|
49
|
-
"The namespaced id of the :class:`Biome` object.\n"
|
|
50
|
-
"\n"
|
|
51
|
-
">>> biome: Biome\n"
|
|
52
|
-
">>> biome.namespaced_name\n"
|
|
53
|
-
"\n"
|
|
54
|
-
":return: The \"namespace:base_name\" of the biome"
|
|
55
|
-
)
|
|
56
|
-
);
|
|
57
|
-
Biome.def_property_readonly(
|
|
58
|
-
"namespace",
|
|
59
|
-
&Amulet::Biome::get_namespace,
|
|
60
|
-
py::doc(
|
|
61
|
-
"The namespace of the :class:`Biome` object.\n"
|
|
62
|
-
"\n"
|
|
63
|
-
">>> biome: Biome\n"
|
|
64
|
-
">>> water.namespace\n"
|
|
65
|
-
"\n"
|
|
66
|
-
":return: The namespace of the biome"
|
|
67
|
-
)
|
|
68
|
-
);
|
|
69
|
-
Biome.def_property_readonly(
|
|
70
|
-
"base_name",
|
|
71
|
-
&Amulet::Biome::get_base_name,
|
|
72
|
-
py::doc(
|
|
73
|
-
"The base name of the :class:`Biome` object.\n"
|
|
74
|
-
"\n"
|
|
75
|
-
">>> biome: Biome\n"
|
|
76
|
-
">>> biome.base_name\n"
|
|
77
|
-
"\n"
|
|
78
|
-
":return: The base name of the biome"
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
Biome.def(
|
|
82
|
-
"__repr__",
|
|
83
|
-
[](const Amulet::Biome& self){
|
|
84
|
-
return "Biome(" +
|
|
85
|
-
py::repr(py::cast(self.get_platform())).cast<std::string>() + ", " +
|
|
86
|
-
py::repr(py::cast(self.get_version())).cast<std::string>() + ", " +
|
|
87
|
-
py::repr(py::cast(self.get_namespace())).cast<std::string>() + ", " +
|
|
88
|
-
py::repr(py::cast(self.get_base_name())).cast<std::string>() +
|
|
89
|
-
")";
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
Biome.def(
|
|
93
|
-
"__hash__",
|
|
94
|
-
[](const Amulet::Biome& self) {
|
|
95
|
-
return py::hash(
|
|
96
|
-
py::make_tuple(
|
|
97
|
-
py::cast(self.get_platform()),
|
|
98
|
-
py::cast(self.get_version()),
|
|
99
|
-
py::cast(self.get_namespace()),
|
|
100
|
-
py::cast(self.get_base_name())
|
|
101
|
-
)
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
Biome.def(
|
|
106
|
-
py::pickle(
|
|
107
|
-
[](const Amulet::Biome& self) -> py::bytes {
|
|
108
|
-
return py::bytes(Amulet::serialise(self));
|
|
109
|
-
},
|
|
110
|
-
[](py::bytes state){
|
|
111
|
-
return Amulet::deserialise<Amulet::Biome>(state.cast<std::string>());
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
Eq(Biome);
|
|
117
|
-
Eq_default(Biome);
|
|
118
|
-
Biome.def(py::self > py::self);
|
|
119
|
-
Biome.def(py::self < py::self);
|
|
120
|
-
Biome.def(py::self >= py::self);
|
|
121
|
-
Biome.def(py::self <= py::self);
|
|
122
|
-
}
|