amulet-core 2.0a7__cp311-cp311-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a0__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.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/METADATA +25 -20
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/RECORD +45 -0
- {amulet_core-2.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/WHEEL +1 -1
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/entry_points.txt +2 -0
- amulet/__init__.cp311-win_amd64.pyd +0 -0
- amulet/__init__.py.cpp +0 -43
- amulet/__init__.pyi +0 -28
- 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 -99
- 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 -335
- 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__.py +0 -1
- amulet/mesh/block/block_mesh.py +0 -369
- amulet/mesh/block/cube.py +0 -149
- amulet/mesh/block/missing_block.py +0 -20
- 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 -62
- 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 -87
- amulet/resource_pack/bedrock/__init__.py +0 -2
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/pack_icon.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_carried.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_side_carried.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/water.png +0 -0
- amulet/resource_pack/bedrock/blockshapes/__init__.py +0 -31
- amulet/resource_pack/bedrock/blockshapes/air.py +0 -35
- amulet/resource_pack/bedrock/blockshapes/base_blockshape.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/bubble_column.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/cake.py +0 -46
- amulet/resource_pack/bedrock/blockshapes/chest.py +0 -54
- amulet/resource_pack/bedrock/blockshapes/comparator.py +0 -51
- amulet/resource_pack/bedrock/blockshapes/cross_texture.py +0 -186
- amulet/resource_pack/bedrock/blockshapes/cross_texture0.py +0 -17
- amulet/resource_pack/bedrock/blockshapes/cross_texture_green.py +0 -16
- amulet/resource_pack/bedrock/blockshapes/cube.py +0 -38
- amulet/resource_pack/bedrock/blockshapes/default.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door.py +0 -38
- amulet/resource_pack/bedrock/blockshapes/door1.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door2.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door3.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door4.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door5.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door6.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/double_plant.py +0 -40
- amulet/resource_pack/bedrock/blockshapes/enchanting_table.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/farmland.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/fence.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/flat.py +0 -55
- amulet/resource_pack/bedrock/blockshapes/flat_wall.py +0 -55
- amulet/resource_pack/bedrock/blockshapes/furnace.py +0 -44
- amulet/resource_pack/bedrock/blockshapes/furnace_lit.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/green_cube.py +0 -39
- amulet/resource_pack/bedrock/blockshapes/ladder.py +0 -36
- amulet/resource_pack/bedrock/blockshapes/lilypad.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/partial_block.py +0 -57
- amulet/resource_pack/bedrock/blockshapes/piston.py +0 -44
- amulet/resource_pack/bedrock/blockshapes/piston_arm.py +0 -72
- amulet/resource_pack/bedrock/blockshapes/portal_frame.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/pressure_plate.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/pumpkin.py +0 -36
- amulet/resource_pack/bedrock/blockshapes/pumpkin_carved.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/pumpkin_lit.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/red_dust.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/repeater.py +0 -53
- amulet/resource_pack/bedrock/blockshapes/slab.py +0 -33
- amulet/resource_pack/bedrock/blockshapes/slab_double.py +0 -15
- amulet/resource_pack/bedrock/blockshapes/tree.py +0 -41
- amulet/resource_pack/bedrock/blockshapes/turtle_egg.py +0 -15
- amulet/resource_pack/bedrock/blockshapes/vine.py +0 -52
- amulet/resource_pack/bedrock/blockshapes/wall.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/water.py +0 -38
- amulet/resource_pack/bedrock/download_resources.py +0 -147
- amulet/resource_pack/bedrock/resource_pack.py +0 -40
- amulet/resource_pack/bedrock/resource_pack_manager.py +0 -361
- amulet/resource_pack/bedrock/sort_blockshapes.py +0 -15
- 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 -551
- 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/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.0a7.dist-info/RECORD +0 -295
- amulet_core-2.0a7.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.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/top_level.txt +0 -0
amulet/palette/biome_palette.hpp
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <map>
|
|
4
|
-
#include <memory>
|
|
5
|
-
#include <stdexcept>
|
|
6
|
-
|
|
7
|
-
#include <amulet/version.hpp>
|
|
8
|
-
#include <amulet/biome.hpp>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
namespace Amulet {
|
|
12
|
-
|
|
13
|
-
struct PtrLess {
|
|
14
|
-
bool operator()(std::shared_ptr<Biome> lhs, std::shared_ptr<Biome> rhs) const {
|
|
15
|
-
return *lhs < *rhs;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
class BiomePalette : public VersionRangeContainer {
|
|
20
|
-
private:
|
|
21
|
-
std::vector<std::shared_ptr<Biome>> _index_to_biome;
|
|
22
|
-
std::map<
|
|
23
|
-
const std::shared_ptr<Biome>,
|
|
24
|
-
size_t,
|
|
25
|
-
PtrLess
|
|
26
|
-
> _biome_to_index;
|
|
27
|
-
public:
|
|
28
|
-
const std::vector<std::shared_ptr<Biome>>& get_biomes() const { return _index_to_biome; }
|
|
29
|
-
|
|
30
|
-
BiomePalette(std::shared_ptr<VersionRange> version_range) :
|
|
31
|
-
VersionRangeContainer(version_range),
|
|
32
|
-
_index_to_biome(),
|
|
33
|
-
_biome_to_index() {}
|
|
34
|
-
|
|
35
|
-
bool operator==(const BiomePalette& other) const {
|
|
36
|
-
if (size() != other.size()) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
for (size_t i = 0; i < size(); i++) {
|
|
40
|
-
if (*_index_to_biome[i] != *other._index_to_biome[i]) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
size_t size() const { return _index_to_biome.size(); }
|
|
48
|
-
|
|
49
|
-
std::shared_ptr<Biome> index_to_biome(size_t index) const {
|
|
50
|
-
return _index_to_biome[index];
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
size_t biome_to_index(std::shared_ptr<Biome> biome) {
|
|
54
|
-
auto it = _biome_to_index.find(biome);
|
|
55
|
-
if (it != _biome_to_index.end()) {
|
|
56
|
-
return it->second;
|
|
57
|
-
}
|
|
58
|
-
const auto& version_range = get_version_range();
|
|
59
|
-
if (!version_range->contains(biome->get_platform(), *biome->get_version())) {
|
|
60
|
-
throw std::invalid_argument(
|
|
61
|
-
"Biome(\"" +
|
|
62
|
-
biome->get_platform() +
|
|
63
|
-
"\", " +
|
|
64
|
-
biome->get_version()->toString() +
|
|
65
|
-
") is incompatible with VersionRange(\"" +
|
|
66
|
-
version_range->get_platform() +
|
|
67
|
-
"\", " +
|
|
68
|
-
version_range->get_min_version()->toString() +
|
|
69
|
-
", " +
|
|
70
|
-
version_range->get_max_version()->toString() +
|
|
71
|
-
")."
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
size_t index = _index_to_biome.size();
|
|
75
|
-
_index_to_biome.push_back(biome);
|
|
76
|
-
_biome_to_index[biome] = index;
|
|
77
|
-
return index;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
bool contains_biome(std::shared_ptr<Biome> biome) const {
|
|
81
|
-
return _biome_to_index.contains(biome);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
}
|
amulet/palette/block_palette.cpp
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#include "block_palette.hpp"
|
|
2
|
-
|
|
3
|
-
namespace Amulet {
|
|
4
|
-
void BlockPalette::serialise(BinaryWriter& writer) const {
|
|
5
|
-
writer.writeNumeric<std::uint8_t>(1);
|
|
6
|
-
get_version_range()->serialise(writer);
|
|
7
|
-
const auto& blocks = get_blocks();
|
|
8
|
-
writer.writeNumeric<std::uint64_t>(blocks.size());
|
|
9
|
-
for (const auto& block : blocks) {
|
|
10
|
-
block->serialise(writer);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
std::shared_ptr<BlockPalette> BlockPalette::deserialise(BinaryReader& reader) {
|
|
14
|
-
auto version = reader.readNumeric<std::uint8_t>();
|
|
15
|
-
switch (version) {
|
|
16
|
-
case 1:
|
|
17
|
-
{
|
|
18
|
-
auto version_range = VersionRange::deserialise(reader);
|
|
19
|
-
auto count = reader.readNumeric<std::uint64_t>();
|
|
20
|
-
auto palette = std::make_shared<BlockPalette>(version_range);
|
|
21
|
-
for (auto i = 0; i < count; i++) {
|
|
22
|
-
if (palette->size() != palette->block_stack_to_index(BlockStack::deserialise(reader))) {
|
|
23
|
-
throw std::runtime_error("Error deserialising BlockPalette");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return palette;
|
|
27
|
-
}
|
|
28
|
-
default:
|
|
29
|
-
throw std::invalid_argument("Unsupported BlockComponentData version " + std::to_string(version));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
amulet/palette/block_palette.hpp
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <map>
|
|
4
|
-
#include <memory>
|
|
5
|
-
#include <stdexcept>
|
|
6
|
-
|
|
7
|
-
#include <amulet/version.hpp>
|
|
8
|
-
#include <amulet/block.hpp>
|
|
9
|
-
|
|
10
|
-
#include <amulet/io/binary_reader.hpp>
|
|
11
|
-
#include <amulet/io/binary_writer.hpp>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
namespace Amulet {
|
|
15
|
-
|
|
16
|
-
struct PtrLess {
|
|
17
|
-
bool operator()(std::shared_ptr<BlockStack> lhs, std::shared_ptr<BlockStack> rhs) const {
|
|
18
|
-
return *lhs < *rhs;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
class BlockPalette : public VersionRangeContainer {
|
|
23
|
-
private:
|
|
24
|
-
std::vector<std::shared_ptr<BlockStack>> _index_to_block;
|
|
25
|
-
std::map<
|
|
26
|
-
const std::shared_ptr<BlockStack>,
|
|
27
|
-
size_t,
|
|
28
|
-
PtrLess
|
|
29
|
-
> _block_to_index;
|
|
30
|
-
public:
|
|
31
|
-
const std::vector<std::shared_ptr<BlockStack>>& get_blocks() const { return _index_to_block; }
|
|
32
|
-
|
|
33
|
-
BlockPalette(std::shared_ptr<VersionRange> version_range) :
|
|
34
|
-
VersionRangeContainer(version_range),
|
|
35
|
-
_index_to_block(),
|
|
36
|
-
_block_to_index() {}
|
|
37
|
-
|
|
38
|
-
void serialise(BinaryWriter&) const;
|
|
39
|
-
static std::shared_ptr<BlockPalette> deserialise(BinaryReader&);
|
|
40
|
-
|
|
41
|
-
bool operator==(const BlockPalette& other) const {
|
|
42
|
-
if (size() != other.size()) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
for (size_t i = 0; i < size(); i++) {
|
|
46
|
-
if (*_index_to_block[i] != *other._index_to_block[i]) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
size_t size() const { return _index_to_block.size(); }
|
|
54
|
-
|
|
55
|
-
std::shared_ptr<BlockStack> index_to_block_stack(size_t index) const {
|
|
56
|
-
return _index_to_block[index];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
size_t block_stack_to_index(std::shared_ptr<BlockStack> block) {
|
|
60
|
-
auto it = _block_to_index.find(block);
|
|
61
|
-
if (it != _block_to_index.end()) {
|
|
62
|
-
return it->second;
|
|
63
|
-
}
|
|
64
|
-
auto version_range = get_version_range();
|
|
65
|
-
for (const auto& block : block->get_blocks()) {
|
|
66
|
-
if (!version_range->contains(block->get_platform(), *block->get_version())) {
|
|
67
|
-
throw std::invalid_argument(
|
|
68
|
-
"BlockStack(\"" +
|
|
69
|
-
block->get_platform() +
|
|
70
|
-
"\", " +
|
|
71
|
-
block->get_version()->toString() +
|
|
72
|
-
") is incompatible with VersionRange(\"" +
|
|
73
|
-
version_range->get_platform() +
|
|
74
|
-
"\", " +
|
|
75
|
-
version_range->get_min_version()->toString() +
|
|
76
|
-
", " +
|
|
77
|
-
version_range->get_max_version()->toString() +
|
|
78
|
-
")."
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
size_t index = _index_to_block.size();
|
|
83
|
-
_index_to_block.push_back(block);
|
|
84
|
-
_block_to_index[block] = index;
|
|
85
|
-
return index;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
bool contains_block(std::shared_ptr<BlockStack> block) const {
|
|
89
|
-
return _block_to_index.contains(block);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
}
|
amulet/player.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from amulet.data_types import DimensionId
|
|
4
|
-
|
|
5
|
-
LOCAL_PLAYER = "~local_player"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Player:
|
|
9
|
-
def __init__(
|
|
10
|
-
self,
|
|
11
|
-
player_id: str,
|
|
12
|
-
dimension_id: DimensionId,
|
|
13
|
-
location: tuple[float, float, float],
|
|
14
|
-
rotation: tuple[float, float],
|
|
15
|
-
) -> None:
|
|
16
|
-
"""
|
|
17
|
-
Creates a new instance of :class:`Player` with the given UUID, location, and rotation
|
|
18
|
-
|
|
19
|
-
:param player_id: The ID of the player
|
|
20
|
-
:param location: The location of the player in world coordinates
|
|
21
|
-
:param rotation: The rotation of the player
|
|
22
|
-
:param dimension_id: The dimension the player is in
|
|
23
|
-
"""
|
|
24
|
-
super().__init__()
|
|
25
|
-
assert isinstance(player_id, str)
|
|
26
|
-
assert (
|
|
27
|
-
isinstance(location, tuple)
|
|
28
|
-
and len(location) == 3
|
|
29
|
-
and all(isinstance(f, float) for f in location)
|
|
30
|
-
)
|
|
31
|
-
assert (
|
|
32
|
-
isinstance(rotation, tuple)
|
|
33
|
-
and len(rotation) == 2
|
|
34
|
-
and all(isinstance(f, float) for f in rotation)
|
|
35
|
-
)
|
|
36
|
-
self._player_id = player_id
|
|
37
|
-
self._location = location
|
|
38
|
-
self._rotation = rotation
|
|
39
|
-
self._dimension_id = dimension_id
|
|
40
|
-
|
|
41
|
-
def __repr__(self) -> str:
|
|
42
|
-
return f"Player({self.player_id}, {self.dimension_id}, {self.location}, {self.rotation})"
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
def player_id(self) -> str:
|
|
46
|
-
"""The player's ID"""
|
|
47
|
-
return self._player_id
|
|
48
|
-
|
|
49
|
-
@property
|
|
50
|
-
def location(self) -> tuple[float, float, float]:
|
|
51
|
-
"""The current location of the player in the world"""
|
|
52
|
-
return self._location
|
|
53
|
-
|
|
54
|
-
@property
|
|
55
|
-
def rotation(self) -> tuple[float, float]:
|
|
56
|
-
"""The current rotation of the player in the world"""
|
|
57
|
-
return self._rotation
|
|
58
|
-
|
|
59
|
-
@property
|
|
60
|
-
def dimension_id(self) -> DimensionId:
|
|
61
|
-
"""The current dimension the player is in"""
|
|
62
|
-
return self._dimension_id
|
amulet/pybind11/collections.hpp
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <pybind11/pybind11.h>
|
|
3
|
-
|
|
4
|
-
namespace py = pybind11;
|
|
5
|
-
|
|
6
|
-
namespace Amulet {
|
|
7
|
-
namespace pybind11 {
|
|
8
|
-
namespace collections {
|
|
9
|
-
template <typename T>
|
|
10
|
-
class Iterator : public py::object {
|
|
11
|
-
PYBIND11_OBJECT_DEFAULT(Iterator, object, PyObject_Type)
|
|
12
|
-
using object::object;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
template <typename T>
|
|
16
|
-
class Sequence : public py::object {
|
|
17
|
-
PYBIND11_OBJECT_DEFAULT(Sequence, object, PyObject_Type)
|
|
18
|
-
using object::object;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
template <typename K, typename V>
|
|
22
|
-
class Mapping : public py::object {
|
|
23
|
-
PYBIND11_OBJECT_DEFAULT(Mapping, object, PyObject_Type)
|
|
24
|
-
using object::object;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
template <typename K, typename V>
|
|
28
|
-
class MutableMapping : public py::object {
|
|
29
|
-
PYBIND11_OBJECT_DEFAULT(MutableMapping, object, PyObject_Type)
|
|
30
|
-
using object::object;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
template <typename K>
|
|
34
|
-
class KeysView : public py::object {
|
|
35
|
-
PYBIND11_OBJECT_DEFAULT(KeysView, object, PyObject_Type)
|
|
36
|
-
using object::object;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
template <typename V>
|
|
40
|
-
class ValuesView : public py::object {
|
|
41
|
-
PYBIND11_OBJECT_DEFAULT(ValuesView, object, PyObject_Type)
|
|
42
|
-
using object::object;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
template <typename K, typename V>
|
|
46
|
-
class ItemsView : public py::object {
|
|
47
|
-
PYBIND11_OBJECT_DEFAULT(ItemsView, object, PyObject_Type)
|
|
48
|
-
using object::object;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
namespace pybind11 {
|
|
55
|
-
namespace detail {
|
|
56
|
-
template <typename T>
|
|
57
|
-
struct handle_type_name<Amulet::pybind11::collections::Iterator<T>> {
|
|
58
|
-
static constexpr auto name =
|
|
59
|
-
const_name("collections.abc.Iterator[") +
|
|
60
|
-
make_caster<T>::name +
|
|
61
|
-
const_name("]");
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
template <typename T>
|
|
65
|
-
struct handle_type_name<Amulet::pybind11::collections::Sequence<T>> {
|
|
66
|
-
static constexpr auto name =
|
|
67
|
-
const_name("collections.abc.Sequence[") +
|
|
68
|
-
make_caster<T>::name +
|
|
69
|
-
const_name("]");
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
template <typename K, typename V>
|
|
73
|
-
struct handle_type_name<Amulet::pybind11::collections::Mapping<K, V>> {
|
|
74
|
-
static constexpr auto name =
|
|
75
|
-
const_name("collections.abc.Mapping[") +
|
|
76
|
-
make_caster<K>::name +
|
|
77
|
-
const_name(", ") +
|
|
78
|
-
make_caster<V>::name +
|
|
79
|
-
const_name("]");
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
template <typename K, typename V>
|
|
83
|
-
struct handle_type_name<Amulet::pybind11::collections::MutableMapping<K, V>> {
|
|
84
|
-
static constexpr auto name =
|
|
85
|
-
const_name("collections.abc.MutableMapping[") +
|
|
86
|
-
make_caster<K>::name +
|
|
87
|
-
const_name(", ")
|
|
88
|
-
+ make_caster<V>::name +
|
|
89
|
-
const_name("]");
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
template <typename K>
|
|
93
|
-
struct handle_type_name<Amulet::pybind11::collections::KeysView<K>> {
|
|
94
|
-
static constexpr auto name =
|
|
95
|
-
const_name("collections.abc.KeysView[") +
|
|
96
|
-
make_caster<K>::name +
|
|
97
|
-
const_name("]");
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
template <typename V>
|
|
101
|
-
struct handle_type_name<Amulet::pybind11::collections::ValuesView<V>> {
|
|
102
|
-
static constexpr auto name =
|
|
103
|
-
const_name("collections.abc.ValuesView[") +
|
|
104
|
-
make_caster<V>::name +
|
|
105
|
-
const_name("]");
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
template <typename K, typename V>
|
|
109
|
-
struct handle_type_name<Amulet::pybind11::collections::ItemsView<K, V>> {
|
|
110
|
-
static constexpr auto name =
|
|
111
|
-
const_name("collections.abc.ItemsView[") +
|
|
112
|
-
make_caster<K>::name +
|
|
113
|
-
const_name(", ")
|
|
114
|
-
+ make_caster<V>::name +
|
|
115
|
-
const_name("]");
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
amulet/pybind11/numpy.hpp
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <pybind11/pybind11.h>
|
|
3
|
-
#include <pybind11/numpy.h>
|
|
4
|
-
|
|
5
|
-
namespace py = pybind11;
|
|
6
|
-
|
|
7
|
-
namespace Amulet {
|
|
8
|
-
namespace pybind11 {
|
|
9
|
-
namespace numpy {
|
|
10
|
-
template <typename T, int ExtraFlags = py::array::forcecast>
|
|
11
|
-
class array_t : public py::array_t<T, ExtraFlags> {
|
|
12
|
-
using py::array_t<T, ExtraFlags>::array_t;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
namespace pybind11 {
|
|
19
|
-
namespace detail {
|
|
20
|
-
template <typename T, int Flags>
|
|
21
|
-
struct handle_type_name<Amulet::pybind11::numpy::array_t<T, Flags>> {
|
|
22
|
-
static constexpr auto name
|
|
23
|
-
= const_name("numpy.typing.NDArray[") + npy_format_descriptor<T>::name + const_name("]");
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
amulet/pybind11/py_module.hpp
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <string>
|
|
4
|
-
#include <functional>
|
|
5
|
-
#include <filesystem>
|
|
6
|
-
#include <map>
|
|
7
|
-
#include <utility>
|
|
8
|
-
|
|
9
|
-
#include <pybind11/pybind11.h>
|
|
10
|
-
#include <amulet/pybind11/typing.hpp>
|
|
11
|
-
|
|
12
|
-
namespace py = pybind11;
|
|
13
|
-
|
|
14
|
-
namespace pybind11 {
|
|
15
|
-
inline void def_package_path(py::module m_parent, py::module m, std::string name) {
|
|
16
|
-
py::list paths;
|
|
17
|
-
py::list parent_paths = m_parent.attr("__path__").cast<py::list>();
|
|
18
|
-
for (auto py_path : parent_paths) {
|
|
19
|
-
if (py::isinstance<py::str>(py_path)) {
|
|
20
|
-
std::string path = py_path.cast<std::string>();
|
|
21
|
-
path.push_back(std::filesystem::path::preferred_separator);
|
|
22
|
-
path.append(name);
|
|
23
|
-
paths.append(py::cast(path));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
m.attr("__path__") = paths;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
inline module def_subpackage(py::module m_parent, std::string name) {
|
|
30
|
-
auto m = m_parent.def_submodule(name.c_str());
|
|
31
|
-
def_package_path(m_parent, m, name);
|
|
32
|
-
return m;
|
|
33
|
-
}
|
|
34
|
-
}
|
amulet/pybind11/type_hints.hpp
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <pybind11/pybind11.h>
|
|
3
|
-
#include <pybind11/detail/descr.h>
|
|
4
|
-
#include <vector>
|
|
5
|
-
|
|
6
|
-
namespace py = pybind11;
|
|
7
|
-
|
|
8
|
-
namespace Amulet {
|
|
9
|
-
namespace pybind11 {
|
|
10
|
-
namespace detail {
|
|
11
|
-
template<size_t N>
|
|
12
|
-
struct FixedString {
|
|
13
|
-
char buf[N + 1]{};
|
|
14
|
-
constexpr FixedString(char const* s) {
|
|
15
|
-
for (unsigned i = 0; i != N; ++i) buf[i] = s[i];
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
template<unsigned N>
|
|
19
|
-
FixedString(char const (&)[N])->FixedString<N - 1>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Type hint for a native python object.
|
|
23
|
-
namespace type_hints {
|
|
24
|
-
template <detail::FixedString T>
|
|
25
|
-
class PyObjectStr : public py::object {
|
|
26
|
-
PYBIND11_OBJECT_DEFAULT(PyObjectStr, object, PyObject_Type)
|
|
27
|
-
using object::object;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
template <typename cppT>
|
|
31
|
-
class PyObjectCpp : public py::object {
|
|
32
|
-
PYBIND11_OBJECT_DEFAULT(PyObjectCpp, object, PyObject_Type)
|
|
33
|
-
using object::object;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
namespace pybind11 {
|
|
40
|
-
namespace detail {
|
|
41
|
-
template <Amulet::pybind11::detail::FixedString T>
|
|
42
|
-
struct handle_type_name<Amulet::pybind11::type_hints::PyObjectStr<T>> {
|
|
43
|
-
static constexpr auto name = pybind11::detail::const_name(T.buf);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
template <typename cppT>
|
|
47
|
-
struct handle_type_name<Amulet::pybind11::type_hints::PyObjectCpp<cppT>> {
|
|
48
|
-
static constexpr auto name = make_caster<cppT>::name;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
amulet/pybind11/types.hpp
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <pybind11/pybind11.h>
|
|
3
|
-
|
|
4
|
-
namespace py = pybind11;
|
|
5
|
-
|
|
6
|
-
namespace Amulet {
|
|
7
|
-
namespace pybind11 {
|
|
8
|
-
namespace types {
|
|
9
|
-
class NotImplementedType : public py::object {
|
|
10
|
-
PYBIND11_OBJECT_DEFAULT(NotImplementedType, object, PyObject_Type)
|
|
11
|
-
using object::object;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
namespace pybind11 {
|
|
19
|
-
namespace detail {
|
|
20
|
-
template <>
|
|
21
|
-
struct handle_type_name<Amulet::pybind11::types::NotImplementedType> {
|
|
22
|
-
static constexpr auto name = const_name("types.NotImplementedType");
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
amulet/pybind11/typing.hpp
DELETED
amulet/resource_pack/__init__.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
from typing import Iterable, Union
|
|
2
|
-
|
|
3
|
-
from amulet.resource_pack.abc import (
|
|
4
|
-
BaseResourcePack,
|
|
5
|
-
BaseResourcePackManager,
|
|
6
|
-
)
|
|
7
|
-
from amulet.resource_pack.java import (
|
|
8
|
-
JavaResourcePack,
|
|
9
|
-
JavaResourcePackManager,
|
|
10
|
-
)
|
|
11
|
-
from amulet.resource_pack.bedrock import (
|
|
12
|
-
BedrockResourcePack,
|
|
13
|
-
BedrockResourcePackManager,
|
|
14
|
-
)
|
|
15
|
-
from .unknown_resource_pack import UnknownResourcePack
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def load_resource_pack(resource_pack_path: str) -> BaseResourcePack:
|
|
19
|
-
if JavaResourcePack.is_valid(resource_pack_path):
|
|
20
|
-
return JavaResourcePack(resource_pack_path)
|
|
21
|
-
elif BedrockResourcePack.is_valid(resource_pack_path):
|
|
22
|
-
return BedrockResourcePack(resource_pack_path)
|
|
23
|
-
else:
|
|
24
|
-
return UnknownResourcePack(resource_pack_path)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def load_resource_pack_manager(
|
|
28
|
-
resource_packs: Iterable[Union[str, BaseResourcePack]], load: bool = True
|
|
29
|
-
) -> BaseResourcePackManager:
|
|
30
|
-
resource_packs_out: list[BaseResourcePack] = []
|
|
31
|
-
for resource_pack in resource_packs:
|
|
32
|
-
if isinstance(resource_pack, str):
|
|
33
|
-
resource_pack = load_resource_pack(resource_pack)
|
|
34
|
-
if (
|
|
35
|
-
not isinstance(resource_pack, UnknownResourcePack)
|
|
36
|
-
and resource_pack.valid_pack
|
|
37
|
-
):
|
|
38
|
-
if resource_packs_out:
|
|
39
|
-
if isinstance(resource_pack, resource_packs_out[0].__class__):
|
|
40
|
-
resource_packs_out.append(resource_pack)
|
|
41
|
-
else:
|
|
42
|
-
resource_packs_out.append(resource_pack)
|
|
43
|
-
|
|
44
|
-
resource_packs = resource_packs_out
|
|
45
|
-
if resource_packs:
|
|
46
|
-
if isinstance(resource_packs[0], JavaResourcePack):
|
|
47
|
-
return JavaResourcePackManager(
|
|
48
|
-
[pack for pack in resource_packs if isinstance(pack, JavaResourcePack)],
|
|
49
|
-
load,
|
|
50
|
-
)
|
|
51
|
-
elif isinstance(resource_packs[0], BedrockResourcePack):
|
|
52
|
-
return BedrockResourcePackManager(
|
|
53
|
-
[
|
|
54
|
-
pack
|
|
55
|
-
for pack in resource_packs
|
|
56
|
-
if isinstance(pack, BedrockResourcePack)
|
|
57
|
-
],
|
|
58
|
-
load,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
raise NotImplementedError
|
|
62
|
-
# return UnknownResourcePackManager()
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from amulet.img import missing_pack_icon_path
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class BaseResourcePack:
|
|
5
|
-
"""The base class that all resource packs must inherit from. Defines the base api."""
|
|
6
|
-
|
|
7
|
-
def __init__(self, root_dir: str):
|
|
8
|
-
self._valid_pack = False
|
|
9
|
-
self._root_dir = root_dir
|
|
10
|
-
self._pack_description = ""
|
|
11
|
-
self._pack_icon = missing_pack_icon_path
|
|
12
|
-
|
|
13
|
-
def __repr__(self) -> str:
|
|
14
|
-
raise NotImplementedError
|
|
15
|
-
|
|
16
|
-
@staticmethod
|
|
17
|
-
def is_valid(pack_path: str) -> bool:
|
|
18
|
-
raise NotImplementedError
|
|
19
|
-
|
|
20
|
-
@property
|
|
21
|
-
def valid_pack(self) -> bool:
|
|
22
|
-
"""bool - does the pack meet the minimum requirements to be a resource pack"""
|
|
23
|
-
return self._valid_pack
|
|
24
|
-
|
|
25
|
-
@property
|
|
26
|
-
def root_dir(self) -> str:
|
|
27
|
-
"""str - the root directory of the pack"""
|
|
28
|
-
return self._root_dir
|
|
29
|
-
|
|
30
|
-
@property
|
|
31
|
-
def pack_description(self) -> str:
|
|
32
|
-
"""str - the description as described in the pack"""
|
|
33
|
-
return self._pack_description
|
|
34
|
-
|
|
35
|
-
@property
|
|
36
|
-
def pack_icon(self) -> str:
|
|
37
|
-
"""str - path to the pack icon"""
|
|
38
|
-
return self._pack_icon
|