amulet-core 2.0a8__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.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__.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.0a0.dist-info}/top_level.txt +0 -0
amulet/mesh/block/block_mesh.hpp
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <array>
|
|
3
|
-
#include <cmath>
|
|
4
|
-
#include <map>
|
|
5
|
-
#include <numbers>
|
|
6
|
-
#include <optional>
|
|
7
|
-
#include <stdexcept>
|
|
8
|
-
#include <string>
|
|
9
|
-
#include <vector>
|
|
10
|
-
#include <functional>
|
|
11
|
-
|
|
12
|
-
namespace Amulet {
|
|
13
|
-
|
|
14
|
-
class FloatVec2 {
|
|
15
|
-
public:
|
|
16
|
-
float x;
|
|
17
|
-
float y;
|
|
18
|
-
|
|
19
|
-
FloatVec2(float x, float y)
|
|
20
|
-
: x(x)
|
|
21
|
-
, y(y)
|
|
22
|
-
{
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class FloatVec3 {
|
|
27
|
-
public:
|
|
28
|
-
float x;
|
|
29
|
-
float y;
|
|
30
|
-
float z;
|
|
31
|
-
|
|
32
|
-
FloatVec3(float x, float y, float z)
|
|
33
|
-
: x(x)
|
|
34
|
-
, y(y)
|
|
35
|
-
, z(z)
|
|
36
|
-
{
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
class Vertex {
|
|
41
|
-
public:
|
|
42
|
-
// The world coordinate
|
|
43
|
-
FloatVec3 coord;
|
|
44
|
-
// The texture coordinate
|
|
45
|
-
FloatVec2 texture_coord;
|
|
46
|
-
// The tint colour
|
|
47
|
-
FloatVec3 tint;
|
|
48
|
-
|
|
49
|
-
Vertex(
|
|
50
|
-
const FloatVec3& coord,
|
|
51
|
-
const FloatVec2& texture_coord,
|
|
52
|
-
const FloatVec3& tint)
|
|
53
|
-
: coord(coord)
|
|
54
|
-
, texture_coord(texture_coord)
|
|
55
|
-
, tint(tint)
|
|
56
|
-
{
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
class Triangle {
|
|
61
|
-
public:
|
|
62
|
-
// The indicies of the vertexes in BlockMeshPart::verts.
|
|
63
|
-
size_t vert_index_a;
|
|
64
|
-
size_t vert_index_b;
|
|
65
|
-
size_t vert_index_c;
|
|
66
|
-
// The index of the texture in BlockMesh::textures.
|
|
67
|
-
size_t texture_index;
|
|
68
|
-
|
|
69
|
-
Triangle(
|
|
70
|
-
size_t vert_index_a,
|
|
71
|
-
size_t vert_index_b,
|
|
72
|
-
size_t vert_index_c,
|
|
73
|
-
size_t texture_index)
|
|
74
|
-
: vert_index_a(vert_index_a)
|
|
75
|
-
, vert_index_b(vert_index_b)
|
|
76
|
-
, vert_index_c(vert_index_c)
|
|
77
|
-
, texture_index(texture_index)
|
|
78
|
-
{
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
class BlockMeshPart {
|
|
83
|
-
public:
|
|
84
|
-
// The vertices in this mesh part.
|
|
85
|
-
std::vector<Vertex> verts;
|
|
86
|
-
// The triangles in this mesh part.
|
|
87
|
-
std::vector<Triangle> triangles;
|
|
88
|
-
|
|
89
|
-
BlockMeshPart(): verts(), triangles() {}
|
|
90
|
-
BlockMeshPart(
|
|
91
|
-
const std::vector<Vertex>& verts,
|
|
92
|
-
const std::vector<Triangle>& triangles)
|
|
93
|
-
: verts(verts)
|
|
94
|
-
, triangles(triangles)
|
|
95
|
-
{
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
enum class BlockMeshTransparency : std::uint8_t {
|
|
100
|
-
// The block is a full block with opaque textures
|
|
101
|
-
FullOpaque,
|
|
102
|
-
// The block is a full block with transparent / translucent textures
|
|
103
|
-
FullTranslucent,
|
|
104
|
-
// The block is not a full block
|
|
105
|
-
Partial
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
enum BlockMeshCullDirection {
|
|
109
|
-
BlockMeshCullNone,
|
|
110
|
-
BlockMeshCullUp,
|
|
111
|
-
BlockMeshCullDown,
|
|
112
|
-
BlockMeshCullNorth,
|
|
113
|
-
BlockMeshCullEast,
|
|
114
|
-
BlockMeshCullSouth,
|
|
115
|
-
BlockMeshCullWest
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
typedef std::map<
|
|
119
|
-
std::pair<std::int8_t, std::int8_t>,
|
|
120
|
-
std::array<BlockMeshCullDirection, 7>>
|
|
121
|
-
RotationCullMapType;
|
|
122
|
-
|
|
123
|
-
// For every combination of 90 degree rotations in y and x axis
|
|
124
|
-
// gives the rotated cull direction.
|
|
125
|
-
extern const RotationCullMapType RotationCullMap;
|
|
126
|
-
|
|
127
|
-
class BlockMesh {
|
|
128
|
-
public:
|
|
129
|
-
BlockMeshTransparency transparency;
|
|
130
|
-
std::vector<std::string> textures;
|
|
131
|
-
// The mesh parts. Index matches BlockMeshCullDirection.
|
|
132
|
-
std::array<std::optional<BlockMeshPart>, 7> parts;
|
|
133
|
-
|
|
134
|
-
BlockMesh()
|
|
135
|
-
: transparency()
|
|
136
|
-
, textures()
|
|
137
|
-
, parts()
|
|
138
|
-
{
|
|
139
|
-
}
|
|
140
|
-
BlockMesh(
|
|
141
|
-
BlockMeshTransparency transparency,
|
|
142
|
-
const std::vector<std::string>& textures,
|
|
143
|
-
const std::array<std::optional<BlockMeshPart>, 7>& parts)
|
|
144
|
-
: transparency(transparency)
|
|
145
|
-
, textures(textures)
|
|
146
|
-
, parts(parts)
|
|
147
|
-
{
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
BlockMesh rotate(std::int8_t rotx, std::int8_t roty) const
|
|
151
|
-
{
|
|
152
|
-
if (rotx || roty) {
|
|
153
|
-
auto rotation_key = std::make_pair(rotx, roty);
|
|
154
|
-
auto it = RotationCullMap.find(rotation_key);
|
|
155
|
-
if (it != RotationCullMap.end()) {
|
|
156
|
-
const auto& cull_map = it->second;
|
|
157
|
-
BlockMesh mesh;
|
|
158
|
-
mesh.transparency = transparency;
|
|
159
|
-
mesh.textures = textures;
|
|
160
|
-
|
|
161
|
-
// Compuate rotation values
|
|
162
|
-
float theta_x = std::numbers::pi * rotx / 2.0;
|
|
163
|
-
float theta_y = std::numbers::pi * roty / 2.0;
|
|
164
|
-
float sin_x = std::sin(theta_x);
|
|
165
|
-
float cos_x = std::cos(theta_x);
|
|
166
|
-
float sin_y = std::sin(theta_y);
|
|
167
|
-
float cos_y = std::cos(theta_y);
|
|
168
|
-
|
|
169
|
-
for (std::uint8_t cull_direction = 0; cull_direction < 7; cull_direction++) {
|
|
170
|
-
// Copy the part to the new cull direction.
|
|
171
|
-
auto new_cull_direction = cull_map[cull_direction];
|
|
172
|
-
auto& part = mesh.parts[new_cull_direction] = parts[cull_direction];
|
|
173
|
-
|
|
174
|
-
if (part) {
|
|
175
|
-
// Rotate the vertex coords.
|
|
176
|
-
for (auto& vertex : part->verts) {
|
|
177
|
-
auto& coord = vertex.coord;
|
|
178
|
-
float x = coord.x - 0.5;
|
|
179
|
-
float y = coord.y - 0.5;
|
|
180
|
-
float z = coord.z - 0.5;
|
|
181
|
-
|
|
182
|
-
// Rotate in X axis
|
|
183
|
-
float y_ = y * cos_x - z * sin_x;
|
|
184
|
-
z = y * sin_x + z * cos_x;
|
|
185
|
-
y = y_;
|
|
186
|
-
|
|
187
|
-
// Rotate in Y axis
|
|
188
|
-
float x_ = x * cos_y + z * sin_y;
|
|
189
|
-
z = -x * sin_y + z * cos_y;
|
|
190
|
-
x = x_;
|
|
191
|
-
|
|
192
|
-
coord.x = x + 0.5;
|
|
193
|
-
coord.y = y + 0.5;
|
|
194
|
-
coord.z = z + 0.5;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return mesh;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return *this;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
BlockMesh merge_block_meshes(std::vector<std::reference_wrapper<const BlockMesh>>);
|
|
206
|
-
|
|
207
|
-
}
|
amulet/mesh/util.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import numpy
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def rotate_3d(
|
|
5
|
-
verts: numpy.ndarray, x: float, y: float, z: float, dx: float, dy: float, dz: float
|
|
6
|
-
) -> numpy.ndarray:
|
|
7
|
-
sb, sh, sa = numpy.sin(numpy.radians([x, y, z]))
|
|
8
|
-
cb, ch, ca = numpy.cos(numpy.radians([x, y, z]))
|
|
9
|
-
trmtx = numpy.array(
|
|
10
|
-
[
|
|
11
|
-
[ch * ca, -ch * sa * cb + sh * sb, ch * sa * sb + sh * cb],
|
|
12
|
-
[sa, ca * cb, -ca * sb],
|
|
13
|
-
[-sh * ca, sh * sa * cb + ch * sb, -sh * sa * sb + ch * cb],
|
|
14
|
-
]
|
|
15
|
-
)
|
|
16
|
-
origin = numpy.array([dx, dy, dz])
|
|
17
|
-
return numpy.matmul(verts - origin, trmtx) + origin # type: ignore
|
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
|
-
}
|