amulet-core 2.0a8__cp312-cp312-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a0__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of amulet-core might be problematic. Click here for more details.
- amulet/core/__init__.py +36 -0
- amulet/core/__pyinstaller/hook-amulet.core.py +4 -0
- amulet/core/_amulet_core.cp312-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.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.0a8.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__.cp312-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.0a0.dist-info}/top_level.txt +0 -0
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,63 +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
|
-
|
|
12
|
-
# from amulet.resource_pack.bedrock import (
|
|
13
|
-
# BedrockResourcePack,
|
|
14
|
-
# BedrockResourcePackManager,
|
|
15
|
-
# )
|
|
16
|
-
from .unknown_resource_pack import UnknownResourcePack
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def load_resource_pack(resource_pack_path: str) -> BaseResourcePack:
|
|
20
|
-
if JavaResourcePack.is_valid(resource_pack_path):
|
|
21
|
-
return JavaResourcePack(resource_pack_path)
|
|
22
|
-
# elif BedrockResourcePack.is_valid(resource_pack_path):
|
|
23
|
-
# return BedrockResourcePack(resource_pack_path)
|
|
24
|
-
else:
|
|
25
|
-
return UnknownResourcePack(resource_pack_path)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def load_resource_pack_manager(
|
|
29
|
-
resource_packs: Iterable[Union[str, BaseResourcePack]], load: bool = True
|
|
30
|
-
) -> BaseResourcePackManager:
|
|
31
|
-
resource_packs_out: list[BaseResourcePack] = []
|
|
32
|
-
for resource_pack in resource_packs:
|
|
33
|
-
if isinstance(resource_pack, str):
|
|
34
|
-
resource_pack = load_resource_pack(resource_pack)
|
|
35
|
-
if (
|
|
36
|
-
not isinstance(resource_pack, UnknownResourcePack)
|
|
37
|
-
and resource_pack.valid_pack
|
|
38
|
-
):
|
|
39
|
-
if resource_packs_out:
|
|
40
|
-
if isinstance(resource_pack, resource_packs_out[0].__class__):
|
|
41
|
-
resource_packs_out.append(resource_pack)
|
|
42
|
-
else:
|
|
43
|
-
resource_packs_out.append(resource_pack)
|
|
44
|
-
|
|
45
|
-
resource_packs = resource_packs_out
|
|
46
|
-
if resource_packs:
|
|
47
|
-
if isinstance(resource_packs[0], JavaResourcePack):
|
|
48
|
-
return JavaResourcePackManager(
|
|
49
|
-
[pack for pack in resource_packs if isinstance(pack, JavaResourcePack)],
|
|
50
|
-
load,
|
|
51
|
-
)
|
|
52
|
-
# elif isinstance(resource_packs[0], BedrockResourcePack):
|
|
53
|
-
# return BedrockResourcePackManager(
|
|
54
|
-
# [
|
|
55
|
-
# pack
|
|
56
|
-
# for pack in resource_packs
|
|
57
|
-
# if isinstance(pack, BedrockResourcePack)
|
|
58
|
-
# ],
|
|
59
|
-
# load,
|
|
60
|
-
# )
|
|
61
|
-
|
|
62
|
-
raise NotImplementedError
|
|
63
|
-
# 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
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
from typing import Optional, Iterator, TypeVar, Generic
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
from amulet.block import Block, BlockStack
|
|
5
|
-
from amulet.mesh.block import BlockMesh, merge_block_meshes, get_missing_block
|
|
6
|
-
from amulet.resource_pack.abc.resource_pack import BaseResourcePack
|
|
7
|
-
from amulet.img import missing_no_icon_path
|
|
8
|
-
|
|
9
|
-
PackT = TypeVar("PackT", bound=BaseResourcePack)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class BaseResourcePackManager(Generic[PackT]):
|
|
13
|
-
"""The base class that all resource pack managers must inherit from. Defines the base api."""
|
|
14
|
-
|
|
15
|
-
def __init__(self) -> None:
|
|
16
|
-
self._packs: list[PackT] = []
|
|
17
|
-
self._missing_block: Optional[BlockMesh] = None
|
|
18
|
-
self._texture_is_transparent: dict[str, tuple[float, bool]] = {}
|
|
19
|
-
self._cached_models: dict[BlockStack, BlockMesh] = {}
|
|
20
|
-
|
|
21
|
-
@property
|
|
22
|
-
def pack_paths(self) -> list[str]:
|
|
23
|
-
return [pack.root_dir for pack in self._packs]
|
|
24
|
-
|
|
25
|
-
def _unload(self) -> None:
|
|
26
|
-
"""Clear all loaded resources."""
|
|
27
|
-
self._texture_is_transparent.clear()
|
|
28
|
-
self._cached_models.clear()
|
|
29
|
-
|
|
30
|
-
def _load_transparency_cache(self, path: str) -> None:
|
|
31
|
-
try:
|
|
32
|
-
with open(path) as f:
|
|
33
|
-
self._texture_is_transparent = json.load(f)
|
|
34
|
-
except:
|
|
35
|
-
pass
|
|
36
|
-
|
|
37
|
-
def _load_iter(self) -> Iterator[float]:
|
|
38
|
-
"""Load resources."""
|
|
39
|
-
raise NotImplementedError
|
|
40
|
-
|
|
41
|
-
def reload(self) -> Iterator[float]:
|
|
42
|
-
"""Unload and reload resources"""
|
|
43
|
-
self._unload()
|
|
44
|
-
yield from self._load_iter()
|
|
45
|
-
|
|
46
|
-
@property
|
|
47
|
-
def missing_no(self) -> str:
|
|
48
|
-
"""The path to the missing_no image"""
|
|
49
|
-
return missing_no_icon_path
|
|
50
|
-
|
|
51
|
-
@property
|
|
52
|
-
def missing_block(self) -> BlockMesh:
|
|
53
|
-
if self._missing_block is None:
|
|
54
|
-
self._missing_block = get_missing_block(self)
|
|
55
|
-
return self._missing_block
|
|
56
|
-
|
|
57
|
-
@property
|
|
58
|
-
def textures(self) -> tuple[str, ...]:
|
|
59
|
-
"""Returns a tuple of all the texture paths in the resource pack."""
|
|
60
|
-
raise NotImplementedError
|
|
61
|
-
|
|
62
|
-
def get_texture_path(self, namespace: Optional[str], relative_path: str) -> str:
|
|
63
|
-
"""Get the absolute texture path from the namespace and relative path pair"""
|
|
64
|
-
raise NotImplementedError
|
|
65
|
-
|
|
66
|
-
def get_block_model(self, block_stack: BlockStack) -> BlockMesh:
|
|
67
|
-
"""Get a model for a block state.
|
|
68
|
-
The block should already be in the resource pack format"""
|
|
69
|
-
if block_stack not in self._cached_models:
|
|
70
|
-
if len(block_stack) == 1:
|
|
71
|
-
self._cached_models[block_stack] = self._get_model(
|
|
72
|
-
block_stack.base_block
|
|
73
|
-
)
|
|
74
|
-
else:
|
|
75
|
-
self._cached_models[block_stack] = merge_block_meshes(
|
|
76
|
-
(self._get_model(block_stack.base_block),)
|
|
77
|
-
+ tuple(
|
|
78
|
-
self._get_model(block_) for block_ in block_stack.extra_blocks
|
|
79
|
-
)
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
return self._cached_models[block_stack]
|
|
83
|
-
|
|
84
|
-
def _get_model(self, block: Block) -> BlockMesh:
|
|
85
|
-
raise NotImplementedError
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import shutil
|
|
3
|
-
import zipfile
|
|
4
|
-
import json
|
|
5
|
-
from urllib.request import urlopen, Request
|
|
6
|
-
import io
|
|
7
|
-
from typing import Generator, TypeVar, Any, Optional
|
|
8
|
-
import logging
|
|
9
|
-
|
|
10
|
-
from amulet.resource_pack import JavaResourcePack
|
|
11
|
-
|
|
12
|
-
T = TypeVar("T")
|
|
13
|
-
|
|
14
|
-
log = logging.getLogger(__name__)
|
|
15
|
-
|
|
16
|
-
launcher_manifest: Optional[dict] = None
|
|
17
|
-
INCLUDE_SNAPSHOT = False
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def get_launcher_manifest() -> dict:
|
|
21
|
-
global launcher_manifest
|
|
22
|
-
if launcher_manifest is None:
|
|
23
|
-
log.info("Downloading java launcher manifest file.")
|
|
24
|
-
with urlopen(
|
|
25
|
-
"https://launchermeta.mojang.com/mc/game/version_manifest.json", timeout=20
|
|
26
|
-
) as manifest:
|
|
27
|
-
launcher_manifest = json.load(manifest)
|
|
28
|
-
log.info("Finished downloading java launcher manifest file.")
|
|
29
|
-
return launcher_manifest
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def generator_unpacker(gen: Generator[Any, Any, T]) -> T:
|
|
33
|
-
try:
|
|
34
|
-
while True:
|
|
35
|
-
next(gen)
|
|
36
|
-
except StopIteration as e:
|
|
37
|
-
return e.value # type: ignore
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def get_latest() -> JavaResourcePack:
|
|
41
|
-
return generator_unpacker(get_latest_iter())
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def get_latest_iter() -> Generator[float, None, JavaResourcePack]:
|
|
45
|
-
"""Download the latest resource pack if required.
|
|
46
|
-
|
|
47
|
-
:return: The loaded Java resource pack.
|
|
48
|
-
:raises:
|
|
49
|
-
Exception: If the
|
|
50
|
-
"""
|
|
51
|
-
vanilla_rp_path = os.path.join(
|
|
52
|
-
os.environ["CACHE_DIR"], "resource_packs", "java", "vanilla"
|
|
53
|
-
)
|
|
54
|
-
try:
|
|
55
|
-
if INCLUDE_SNAPSHOT:
|
|
56
|
-
new_version = get_launcher_manifest()["latest"]["snapshot"]
|
|
57
|
-
else:
|
|
58
|
-
new_version = get_launcher_manifest()["latest"]["release"]
|
|
59
|
-
except Exception as e:
|
|
60
|
-
if os.path.isdir(vanilla_rp_path):
|
|
61
|
-
log.error(
|
|
62
|
-
"Could not download the launcher manifest. The resource pack seems to be present so using that."
|
|
63
|
-
)
|
|
64
|
-
else:
|
|
65
|
-
raise e
|
|
66
|
-
else:
|
|
67
|
-
has_new_pack = False
|
|
68
|
-
if os.path.isfile(os.path.join(vanilla_rp_path, "version")):
|
|
69
|
-
with open(os.path.join(vanilla_rp_path, "version")) as f:
|
|
70
|
-
old_version = f.read()
|
|
71
|
-
has_new_pack = old_version == new_version
|
|
72
|
-
|
|
73
|
-
if not has_new_pack:
|
|
74
|
-
yield from _remove_and_download_iter(vanilla_rp_path, new_version)
|
|
75
|
-
return JavaResourcePack(vanilla_rp_path)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_java_vanilla_fix: Optional[JavaResourcePack] = None
|
|
79
|
-
_java_vanilla_latest: Optional[JavaResourcePack] = None
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def get_java_vanilla_fix() -> JavaResourcePack:
|
|
83
|
-
global _java_vanilla_fix
|
|
84
|
-
if _java_vanilla_fix is None:
|
|
85
|
-
_java_vanilla_fix = JavaResourcePack(
|
|
86
|
-
os.path.join(os.path.dirname(__file__), "java_vanilla_fix")
|
|
87
|
-
)
|
|
88
|
-
return _java_vanilla_fix
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def get_java_vanilla_latest() -> JavaResourcePack:
|
|
92
|
-
global _java_vanilla_latest
|
|
93
|
-
if _java_vanilla_latest is None:
|
|
94
|
-
_java_vanilla_latest = get_latest()
|
|
95
|
-
return _java_vanilla_latest
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def get_java_vanilla_latest_iter() -> Generator[float, None, JavaResourcePack]:
|
|
99
|
-
global _java_vanilla_latest
|
|
100
|
-
if _java_vanilla_latest is None:
|
|
101
|
-
_java_vanilla_latest = yield from get_latest_iter()
|
|
102
|
-
return _java_vanilla_latest
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def _remove_and_download(path: str, version: str) -> None:
|
|
106
|
-
for _ in _remove_and_download_iter(path, version):
|
|
107
|
-
pass
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def _remove_and_download_iter(path: str, version: str) -> Generator[float, None, None]:
|
|
111
|
-
# try downloading the new resources to a temporary location
|
|
112
|
-
temp_path = os.path.join(os.path.dirname(path), "_temp_")
|
|
113
|
-
# clear the temporary location
|
|
114
|
-
if os.path.isfile(temp_path):
|
|
115
|
-
os.remove(temp_path)
|
|
116
|
-
elif os.path.isdir(temp_path):
|
|
117
|
-
shutil.rmtree(temp_path, ignore_errors=True)
|
|
118
|
-
|
|
119
|
-
yield from download_resources_iter(temp_path, version)
|
|
120
|
-
if os.path.isdir(path):
|
|
121
|
-
shutil.rmtree(path, ignore_errors=True)
|
|
122
|
-
|
|
123
|
-
shutil.move(temp_path, path)
|
|
124
|
-
|
|
125
|
-
with open(os.path.join(path, "version"), "w") as f:
|
|
126
|
-
f.write(version)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def download_with_retry(
|
|
130
|
-
url: str, chunk_size: int = 4096, attempts: int = 5
|
|
131
|
-
) -> Generator[float, None, bytes]:
|
|
132
|
-
content_length_found = 0
|
|
133
|
-
content = []
|
|
134
|
-
|
|
135
|
-
for _ in range(attempts):
|
|
136
|
-
request = Request(url, headers={"Range": f"bytes={content_length_found}-"})
|
|
137
|
-
with urlopen(request, timeout=20) as response:
|
|
138
|
-
content_length = int(response.headers["content-length"].strip())
|
|
139
|
-
while content_length_found < content_length:
|
|
140
|
-
chunk = response.read(chunk_size)
|
|
141
|
-
if not chunk:
|
|
142
|
-
break
|
|
143
|
-
content.append(chunk)
|
|
144
|
-
content_length_found += len(chunk)
|
|
145
|
-
yield min(1.0, content_length_found / content_length)
|
|
146
|
-
if content_length == content_length_found:
|
|
147
|
-
break
|
|
148
|
-
else:
|
|
149
|
-
raise RuntimeError(f"Failed to download")
|
|
150
|
-
return b"".join(content)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def download_resources(path: str, version: str) -> None:
|
|
154
|
-
generator_unpacker(download_resources_iter(path, version))
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def download_resources_iter(
|
|
158
|
-
path: str, version: str, chunk_size: int = 4096
|
|
159
|
-
) -> Generator[float, None, None]:
|
|
160
|
-
log.info(f"Downloading Java resource pack for version {version}")
|
|
161
|
-
version_url = next(
|
|
162
|
-
(v["url"] for v in get_launcher_manifest()["versions"] if v["id"] == version),
|
|
163
|
-
None,
|
|
164
|
-
)
|
|
165
|
-
if version_url is None:
|
|
166
|
-
raise Exception(f"Could not find Java resource pack for version {version}.")
|
|
167
|
-
|
|
168
|
-
try:
|
|
169
|
-
with urlopen(version_url, timeout=20) as vm:
|
|
170
|
-
version_manifest = json.load(vm)
|
|
171
|
-
version_client_url = version_manifest["downloads"]["client"]["url"]
|
|
172
|
-
|
|
173
|
-
downloader = download_with_retry(version_client_url)
|
|
174
|
-
try:
|
|
175
|
-
while True:
|
|
176
|
-
yield next(downloader) / 2
|
|
177
|
-
except StopIteration as e:
|
|
178
|
-
data = e.value
|
|
179
|
-
|
|
180
|
-
client = zipfile.ZipFile(io.BytesIO(data))
|
|
181
|
-
paths: list[str] = [
|
|
182
|
-
fpath for fpath in client.namelist() if fpath.startswith("assets/")
|
|
183
|
-
]
|
|
184
|
-
path_count = len(paths)
|
|
185
|
-
for path_index, fpath in enumerate(paths):
|
|
186
|
-
if not path_index % 30:
|
|
187
|
-
yield path_index / (path_count * 2) + 0.5
|
|
188
|
-
if fpath.endswith("/"):
|
|
189
|
-
continue
|
|
190
|
-
os.makedirs(
|
|
191
|
-
os.path.dirname(os.path.abspath(os.path.join(path, fpath))),
|
|
192
|
-
exist_ok=True,
|
|
193
|
-
)
|
|
194
|
-
client.extract(fpath, path)
|
|
195
|
-
if "pack.mcmeta" in client.namelist():
|
|
196
|
-
client.extract("pack.mcmeta", path)
|
|
197
|
-
else:
|
|
198
|
-
# TODO: work out proper version support for this
|
|
199
|
-
with open(os.path.join(path, "pack.mcmeta"), "w") as f:
|
|
200
|
-
f.write(
|
|
201
|
-
'{"pack": {"description": "The default data for Minecraft","pack_format": 7}}'
|
|
202
|
-
)
|
|
203
|
-
if "pack.png" in client.namelist():
|
|
204
|
-
client.extract("pack.png", path)
|
|
205
|
-
|
|
206
|
-
except Exception as e:
|
|
207
|
-
log.error(
|
|
208
|
-
f"Failed to download and extract the Java resource pack for version {version}.",
|
|
209
|
-
exc_info=True,
|
|
210
|
-
)
|
|
211
|
-
raise e
|
|
212
|
-
log.info(f"Finished downloading Java resource pack for version {version}")
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png
DELETED
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
from amulet.resource_pack.abc import BaseResourcePack
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class JavaResourcePack(BaseResourcePack):
|
|
8
|
-
"""A class to hold the bare bones information about the resource pack.
|
|
9
|
-
Holds the pack format, description and if the pack is valid.
|
|
10
|
-
This information can be used in a viewer to display the packs to the user."""
|
|
11
|
-
|
|
12
|
-
def __init__(self, resource_pack_path: str):
|
|
13
|
-
super().__init__(resource_pack_path)
|
|
14
|
-
meta_path = os.path.join(resource_pack_path, "pack.mcmeta")
|
|
15
|
-
self._pack_format = 0
|
|
16
|
-
if os.path.isfile(meta_path):
|
|
17
|
-
try:
|
|
18
|
-
with open(meta_path) as f:
|
|
19
|
-
pack_mcmeta = json.load(f)
|
|
20
|
-
except json.JSONDecodeError:
|
|
21
|
-
pass
|
|
22
|
-
else:
|
|
23
|
-
if "pack" in pack_mcmeta:
|
|
24
|
-
if "description" in pack_mcmeta["pack"]:
|
|
25
|
-
self._pack_description = str(pack_mcmeta["pack"]["description"])
|
|
26
|
-
if "pack_format" in pack_mcmeta["pack"]:
|
|
27
|
-
self._pack_format = pack_mcmeta["pack"]["pack_format"]
|
|
28
|
-
self._valid_pack = True
|
|
29
|
-
|
|
30
|
-
pack_icon_path = os.path.join(resource_pack_path, "pack.png")
|
|
31
|
-
if os.path.isfile(pack_icon_path):
|
|
32
|
-
self._pack_icon = pack_icon_path
|
|
33
|
-
|
|
34
|
-
@staticmethod
|
|
35
|
-
def is_valid(pack_path: str) -> bool:
|
|
36
|
-
return os.path.isfile(os.path.join(pack_path, "pack.mcmeta"))
|
|
37
|
-
|
|
38
|
-
def __repr__(self) -> str:
|
|
39
|
-
return f"JavaResourcePack({self._root_dir})"
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
def pack_format(self) -> int:
|
|
43
|
-
"""int - pack format number"""
|
|
44
|
-
return self._pack_format
|