amulet-core 2.0.7a0__cp312-cp312-macosx_10_15_universal2.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.
- amulet/core/__init__.py +38 -0
- amulet/core/__init__.pyi +31 -0
- amulet/core/__pyinstaller/__init__.py +2 -0
- amulet/core/__pyinstaller/hook-amulet.core.py +4 -0
- amulet/core/_amulet_core.cpython-312-darwin.so +0 -0
- amulet/core/_amulet_core.pyi +7 -0
- amulet/core/_version.py +21 -0
- amulet/core/amulet_coreConfig.cmake +23 -0
- amulet/core/biome/__init__.pyi +75 -0
- amulet/core/biome/biome.hpp +53 -0
- amulet/core/block/__init__.pyi +273 -0
- amulet/core/block/block.hpp +156 -0
- amulet/core/block_entity/__init__.pyi +78 -0
- amulet/core/block_entity/block_entity.hpp +84 -0
- amulet/core/chunk/__init__.pyi +67 -0
- amulet/core/chunk/chunk.hpp +126 -0
- amulet/core/chunk/component/__init__.pyi +15 -0
- amulet/core/chunk/component/biome_3d_component.hpp +99 -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 +178 -0
- amulet/core/chunk/component/section_array_map.pyi +112 -0
- amulet/core/dll.hpp +21 -0
- amulet/core/entity/__init__.pyi +105 -0
- amulet/core/entity/entity.hpp +100 -0
- amulet/core/libamulet_core.dylib +0 -0
- amulet/core/palette/__init__.pyi +8 -0
- amulet/core/palette/biome_palette.hpp +65 -0
- amulet/core/palette/biome_palette.pyi +48 -0
- amulet/core/palette/block_palette.hpp +71 -0
- amulet/core/palette/block_palette.pyi +52 -0
- amulet/core/py.typed +0 -0
- amulet/core/selection/__init__.pyi +25 -0
- amulet/core/selection/box.hpp +97 -0
- amulet/core/selection/box.pyi +239 -0
- amulet/core/selection/box_group.hpp +89 -0
- amulet/core/selection/box_group.pyi +222 -0
- amulet/core/selection/cuboid.hpp +41 -0
- amulet/core/selection/cuboid.pyi +49 -0
- amulet/core/selection/ellipsoid.hpp +42 -0
- amulet/core/selection/ellipsoid.pyi +47 -0
- amulet/core/selection/shape.hpp +73 -0
- amulet/core/selection/shape.pyi +56 -0
- amulet/core/selection/shape_group.hpp +73 -0
- amulet/core/selection/shape_group.pyi +118 -0
- amulet/core/version/__init__.pyi +138 -0
- amulet/core/version/version.hpp +206 -0
- amulet_core-2.0.7a0.dist-info/METADATA +112 -0
- amulet_core-2.0.7a0.dist-info/RECORD +53 -0
- amulet_core-2.0.7a0.dist-info/WHEEL +5 -0
- amulet_core-2.0.7a0.dist-info/entry_points.txt +2 -0
- amulet_core-2.0.7a0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <map>
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <optional>
|
|
7
|
+
#include <tuple>
|
|
8
|
+
|
|
9
|
+
#include <amulet/core/block_entity/block_entity.hpp>
|
|
10
|
+
#include <amulet/core/dll.hpp>
|
|
11
|
+
#include <amulet/core/version/version.hpp>
|
|
12
|
+
|
|
13
|
+
namespace Amulet {
|
|
14
|
+
typedef std::tuple<std::uint16_t, std::int64_t, std::uint16_t> BlockEntityChunkCoord;
|
|
15
|
+
class BlockEntityStorage : public VersionRangeContainer {
|
|
16
|
+
private:
|
|
17
|
+
std::uint16_t _x_size;
|
|
18
|
+
std::uint16_t _z_size;
|
|
19
|
+
std::map<
|
|
20
|
+
BlockEntityChunkCoord,
|
|
21
|
+
std::shared_ptr<BlockEntity>>
|
|
22
|
+
_block_entities;
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
template <typename VersionRangeT>
|
|
26
|
+
BlockEntityStorage(
|
|
27
|
+
VersionRangeT&& version_range,
|
|
28
|
+
std::uint16_t x_size,
|
|
29
|
+
std::uint16_t z_size)
|
|
30
|
+
: VersionRangeContainer(std::forward<VersionRangeT>(version_range))
|
|
31
|
+
, _x_size(x_size)
|
|
32
|
+
, _z_size(z_size)
|
|
33
|
+
, _block_entities()
|
|
34
|
+
{
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
38
|
+
AMULET_CORE_EXPORT static BlockEntityStorage deserialise(BinaryReader&);
|
|
39
|
+
|
|
40
|
+
std::uint16_t get_x_size() const { return _x_size; }
|
|
41
|
+
std::uint16_t get_z_size() const { return _z_size; }
|
|
42
|
+
|
|
43
|
+
const std::map<BlockEntityChunkCoord, std::shared_ptr<BlockEntity>>&
|
|
44
|
+
get_block_entities() const
|
|
45
|
+
{
|
|
46
|
+
return _block_entities;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
size_t get_size() const { return _block_entities.size(); }
|
|
50
|
+
|
|
51
|
+
bool contains(
|
|
52
|
+
const BlockEntityChunkCoord& coord) const
|
|
53
|
+
{
|
|
54
|
+
return _block_entities.contains(coord);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
std::shared_ptr<BlockEntity> get(
|
|
58
|
+
const BlockEntityChunkCoord& coord) const
|
|
59
|
+
{
|
|
60
|
+
return _block_entities.at(coord);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
template <typename BlockEntityT>
|
|
64
|
+
void set(
|
|
65
|
+
const BlockEntityChunkCoord& coord,
|
|
66
|
+
BlockEntityT&& block_entity)
|
|
67
|
+
{
|
|
68
|
+
std::shared_ptr<BlockEntity> block_entity_ptr;
|
|
69
|
+
if constexpr (std::is_same_v<std::shared_ptr<BlockEntity>, std::decay_t<BlockEntityT>>) {
|
|
70
|
+
block_entity_ptr = std::forward<BlockEntityT>(block_entity);
|
|
71
|
+
} else {
|
|
72
|
+
block_entity_ptr = std::make_shared<BlockEntity>(block_entity);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (
|
|
76
|
+
std::get<0>(coord) < 0 || std::get<2>(coord) < 0 || _x_size <= std::get<0>(coord) || _z_size <= std::get<2>(coord)) {
|
|
77
|
+
throw std::invalid_argument(
|
|
78
|
+
"Coord must be 0 <= " + std::to_string(std::get<0>(coord)) + " < " + std::to_string(_x_size) + "and 0 <= " + std::to_string(std::get<1>(coord)) + " < " + std::to_string(_z_size));
|
|
79
|
+
}
|
|
80
|
+
if (!(
|
|
81
|
+
get_version_range().contains(
|
|
82
|
+
block_entity_ptr->get_platform(),
|
|
83
|
+
block_entity_ptr->get_version()))) {
|
|
84
|
+
throw std::invalid_argument(
|
|
85
|
+
"BlockEntity is incompatible with VersionRange.");
|
|
86
|
+
}
|
|
87
|
+
_block_entities.insert_or_assign(coord, std::move(block_entity_ptr));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void del(const BlockEntityChunkCoord& coord)
|
|
91
|
+
{
|
|
92
|
+
_block_entities.erase(coord);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
class BlockEntityComponent {
|
|
97
|
+
private:
|
|
98
|
+
std::optional<std::shared_ptr<BlockEntityStorage>> _value;
|
|
99
|
+
|
|
100
|
+
protected:
|
|
101
|
+
// Null constructor
|
|
102
|
+
BlockEntityComponent() = default;
|
|
103
|
+
// Default constructor
|
|
104
|
+
AMULET_CORE_EXPORT void init(
|
|
105
|
+
const VersionRange& version_range,
|
|
106
|
+
std::uint16_t x_size,
|
|
107
|
+
std::uint16_t z_size);
|
|
108
|
+
|
|
109
|
+
// Serialise the component data
|
|
110
|
+
AMULET_CORE_EXPORT std::optional<std::string> serialise() const;
|
|
111
|
+
// Deserialise the component
|
|
112
|
+
AMULET_CORE_EXPORT void deserialise(std::optional<std::string>);
|
|
113
|
+
|
|
114
|
+
public:
|
|
115
|
+
AMULET_CORE_EXPORT static const std::string ComponentID;
|
|
116
|
+
AMULET_CORE_EXPORT std::shared_ptr<BlockEntityStorage> get_block_entities();
|
|
117
|
+
AMULET_CORE_EXPORT void set_block_entities(std::shared_ptr<BlockEntityStorage> component);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <cstdlib>
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <span>
|
|
7
|
+
#include <stdexcept>
|
|
8
|
+
#include <tuple>
|
|
9
|
+
#include <type_traits>
|
|
10
|
+
#include <unordered_map>
|
|
11
|
+
#include <variant>
|
|
12
|
+
#include <vector>
|
|
13
|
+
|
|
14
|
+
#include <amulet/io/binary_reader.hpp>
|
|
15
|
+
#include <amulet/io/binary_writer.hpp>
|
|
16
|
+
|
|
17
|
+
#include <amulet/utils/view/map_view.hpp>
|
|
18
|
+
|
|
19
|
+
#include <amulet/core/dll.hpp>
|
|
20
|
+
|
|
21
|
+
namespace Amulet {
|
|
22
|
+
|
|
23
|
+
typedef std::tuple<std::uint16_t, std::uint16_t, std::uint16_t> SectionShape;
|
|
24
|
+
|
|
25
|
+
class IndexArray3D {
|
|
26
|
+
private:
|
|
27
|
+
SectionShape _shape;
|
|
28
|
+
size_t _size;
|
|
29
|
+
std::uint32_t* _buffer;
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
AMULET_CORE_EXPORT IndexArray3D(const SectionShape& shape);
|
|
33
|
+
AMULET_CORE_EXPORT IndexArray3D(const SectionShape& shape, std::uint32_t value);
|
|
34
|
+
|
|
35
|
+
AMULET_CORE_EXPORT IndexArray3D(const IndexArray3D& other);
|
|
36
|
+
AMULET_CORE_EXPORT IndexArray3D(IndexArray3D&& other) noexcept;
|
|
37
|
+
AMULET_CORE_EXPORT IndexArray3D& operator=(const IndexArray3D& other);
|
|
38
|
+
AMULET_CORE_EXPORT IndexArray3D& operator=(IndexArray3D&& other) noexcept;
|
|
39
|
+
|
|
40
|
+
AMULET_CORE_EXPORT ~IndexArray3D();
|
|
41
|
+
|
|
42
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
43
|
+
AMULET_CORE_EXPORT static IndexArray3D deserialise(BinaryReader&);
|
|
44
|
+
|
|
45
|
+
const SectionShape& get_shape() const { return _shape; }
|
|
46
|
+
size_t get_size() const { return _size; }
|
|
47
|
+
std::uint32_t* get_buffer() { return _buffer; }
|
|
48
|
+
const std::uint32_t* get_buffer() const { return _buffer; }
|
|
49
|
+
std::span<std::uint32_t> get_span() { return { _buffer, _size }; }
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class SectionArrayMap {
|
|
53
|
+
private:
|
|
54
|
+
SectionShape _array_shape;
|
|
55
|
+
std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>> _default_array;
|
|
56
|
+
std::unordered_map<std::int64_t, std::shared_ptr<IndexArray3D>> _arrays;
|
|
57
|
+
|
|
58
|
+
void validate_array_shape(const IndexArray3D& array)
|
|
59
|
+
{
|
|
60
|
+
if (_array_shape != array.get_shape()) {
|
|
61
|
+
throw std::invalid_argument("Array shape does not match stored shape.");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
void validate_array_shape(
|
|
66
|
+
const std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>>& array)
|
|
67
|
+
{
|
|
68
|
+
if (auto* arr = std::get_if<std::shared_ptr<IndexArray3D>>(&array)) {
|
|
69
|
+
return validate_array_shape(**arr);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
template <typename DefaultArrayT>
|
|
75
|
+
SectionArrayMap(
|
|
76
|
+
const SectionShape& array_shape,
|
|
77
|
+
DefaultArrayT&& default_array)
|
|
78
|
+
: _array_shape(array_shape)
|
|
79
|
+
, _default_array(std::forward<DefaultArrayT>(default_array))
|
|
80
|
+
, _arrays()
|
|
81
|
+
{
|
|
82
|
+
validate_array_shape(_default_array);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
86
|
+
AMULET_CORE_EXPORT static SectionArrayMap deserialise(BinaryReader&);
|
|
87
|
+
|
|
88
|
+
const SectionShape& get_array_shape() const { return _array_shape; }
|
|
89
|
+
|
|
90
|
+
std::variant<std::uint32_t, std::shared_ptr<const IndexArray3D>> get_default_array() const
|
|
91
|
+
{
|
|
92
|
+
return std::visit(
|
|
93
|
+
[](auto&& arg) -> std::variant<std::uint32_t, std::shared_ptr<const IndexArray3D>> {
|
|
94
|
+
return arg;
|
|
95
|
+
},
|
|
96
|
+
_default_array);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>> get_default_array()
|
|
100
|
+
{
|
|
101
|
+
return _default_array;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void set_default_array(std::uint32_t default_array)
|
|
105
|
+
{
|
|
106
|
+
_default_array = default_array;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void set_default_array(std::shared_ptr<IndexArray3D> default_array)
|
|
110
|
+
{
|
|
111
|
+
validate_array_shape(*default_array);
|
|
112
|
+
_default_array = std::move(default_array);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
void set_default_array(const IndexArray3D& default_array)
|
|
116
|
+
{
|
|
117
|
+
validate_array_shape(default_array);
|
|
118
|
+
_default_array = std::make_shared<IndexArray3D>(default_array);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const std::unordered_map<std::int64_t, std::shared_ptr<IndexArray3D>>& get_arrays()
|
|
122
|
+
{
|
|
123
|
+
return _arrays;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const MapView<std::unordered_map<std::int64_t, std::shared_ptr<IndexArray3D>>, std::shared_ptr<const IndexArray3D>> get_arrays() const
|
|
127
|
+
{
|
|
128
|
+
return _arrays;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
size_t get_size() const { return _arrays.size(); }
|
|
132
|
+
|
|
133
|
+
bool contains_section(std::int64_t cy) const
|
|
134
|
+
{
|
|
135
|
+
return _arrays.contains(cy);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
std::shared_ptr<IndexArray3D> get_section(std::int64_t cy)
|
|
139
|
+
{
|
|
140
|
+
return _arrays.at(cy);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
std::shared_ptr<const IndexArray3D> get_section(std::int64_t cy) const
|
|
144
|
+
{
|
|
145
|
+
return _arrays.at(cy);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
IndexArray3D& get_section_ref(std::int64_t cy)
|
|
149
|
+
{
|
|
150
|
+
return *_arrays.at(cy);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const IndexArray3D& get_section_ref(std::int64_t cy) const
|
|
154
|
+
{
|
|
155
|
+
return *_arrays.at(cy);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
void set_section(std::int64_t cy, std::shared_ptr<IndexArray3D> section)
|
|
159
|
+
{
|
|
160
|
+
validate_array_shape(*section);
|
|
161
|
+
_arrays.insert_or_assign(cy, std::move(section));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
void set_section(std::int64_t cy, const IndexArray3D& section)
|
|
165
|
+
{
|
|
166
|
+
validate_array_shape(section);
|
|
167
|
+
_arrays.insert_or_assign(cy, std::make_shared<IndexArray3D>(section));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
AMULET_CORE_EXPORT void populate_section(std::int64_t cy);
|
|
171
|
+
|
|
172
|
+
void del_section(std::int64_t cy)
|
|
173
|
+
{
|
|
174
|
+
_arrays.erase(cy);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
} // namespace Amulet
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import collections.abc
|
|
4
|
+
import types
|
|
5
|
+
import typing
|
|
6
|
+
|
|
7
|
+
import numpy
|
|
8
|
+
import numpy.typing
|
|
9
|
+
|
|
10
|
+
__all__: list[str] = ["IndexArray3D", "SectionArrayMap"]
|
|
11
|
+
|
|
12
|
+
class IndexArray3D:
|
|
13
|
+
"""
|
|
14
|
+
A 3D index array.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
@typing.overload
|
|
18
|
+
def __init__(
|
|
19
|
+
self, shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt]
|
|
20
|
+
) -> None: ...
|
|
21
|
+
@typing.overload
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
|
|
25
|
+
value: typing.SupportsInt,
|
|
26
|
+
) -> None: ...
|
|
27
|
+
@typing.overload
|
|
28
|
+
def __init__(self, other: IndexArray3D) -> None: ...
|
|
29
|
+
@typing.overload
|
|
30
|
+
def __init__(self, arg0: collections.abc.Buffer) -> None: ...
|
|
31
|
+
@property
|
|
32
|
+
def shape(self) -> tuple[int, int, int]: ...
|
|
33
|
+
@property
|
|
34
|
+
def size(self) -> int: ...
|
|
35
|
+
|
|
36
|
+
class SectionArrayMap:
|
|
37
|
+
"""
|
|
38
|
+
A container of sub-chunk arrays.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def __contains__(self, arg0: typing.SupportsInt) -> bool: ...
|
|
42
|
+
def __delitem__(self, arg0: typing.SupportsInt) -> None: ...
|
|
43
|
+
def __eq__(self, other: typing.Any) -> bool | types.NotImplementedType: ...
|
|
44
|
+
def __getitem__(
|
|
45
|
+
self, arg0: typing.SupportsInt
|
|
46
|
+
) -> numpy.typing.NDArray[numpy.uint32]: ...
|
|
47
|
+
def __hash__(self) -> int: ...
|
|
48
|
+
def __init__(
|
|
49
|
+
self,
|
|
50
|
+
array_shape: tuple[typing.SupportsInt, typing.SupportsInt, typing.SupportsInt],
|
|
51
|
+
default_array: typing.SupportsInt | IndexArray3D | collections.abc.Buffer,
|
|
52
|
+
) -> None: ...
|
|
53
|
+
def __iter__(self) -> collections.abc.Iterator[int]: ...
|
|
54
|
+
def __len__(self) -> int: ...
|
|
55
|
+
def __setitem__(
|
|
56
|
+
self, arg0: typing.SupportsInt, arg1: IndexArray3D | collections.abc.Buffer
|
|
57
|
+
) -> None: ...
|
|
58
|
+
@typing.overload
|
|
59
|
+
def get(
|
|
60
|
+
self, key: typing.SupportsInt
|
|
61
|
+
) -> numpy.typing.NDArray[numpy.uint32] | None: ...
|
|
62
|
+
@typing.overload
|
|
63
|
+
def get(
|
|
64
|
+
self, key: typing.SupportsInt, default: numpy.typing.NDArray[numpy.uint32]
|
|
65
|
+
) -> numpy.typing.NDArray[numpy.uint32]: ...
|
|
66
|
+
@typing.overload
|
|
67
|
+
def get[T](
|
|
68
|
+
self, key: typing.SupportsInt, default: T
|
|
69
|
+
) -> numpy.typing.NDArray[numpy.uint32] | T: ...
|
|
70
|
+
def items(
|
|
71
|
+
self,
|
|
72
|
+
) -> collections.abc.ItemsView[int, numpy.typing.NDArray[numpy.uint32]]: ...
|
|
73
|
+
def keys(self) -> collections.abc.KeysView[int]: ...
|
|
74
|
+
@typing.overload
|
|
75
|
+
def pop(self, key: typing.SupportsInt) -> numpy.typing.NDArray[numpy.uint32]: ...
|
|
76
|
+
@typing.overload
|
|
77
|
+
def pop(
|
|
78
|
+
self, key: typing.SupportsInt, default: numpy.typing.NDArray[numpy.uint32]
|
|
79
|
+
) -> numpy.typing.NDArray[numpy.uint32]: ...
|
|
80
|
+
@typing.overload
|
|
81
|
+
def pop[T](
|
|
82
|
+
self, key: typing.SupportsInt, default: T
|
|
83
|
+
) -> numpy.typing.NDArray[numpy.uint32] | T: ...
|
|
84
|
+
def popitem(self) -> tuple[int, numpy.typing.NDArray[numpy.uint32]]: ...
|
|
85
|
+
def populate(self, arg0: typing.SupportsInt) -> None: ...
|
|
86
|
+
@typing.overload
|
|
87
|
+
def setdefault(
|
|
88
|
+
self, key: typing.SupportsInt
|
|
89
|
+
) -> numpy.typing.NDArray[numpy.uint32]: ...
|
|
90
|
+
@typing.overload
|
|
91
|
+
def setdefault(
|
|
92
|
+
self, key: typing.SupportsInt, default: numpy.typing.NDArray[numpy.uint32]
|
|
93
|
+
) -> numpy.typing.NDArray[numpy.uint32]: ...
|
|
94
|
+
def update(
|
|
95
|
+
self,
|
|
96
|
+
other: (
|
|
97
|
+
collections.abc.Mapping[int, numpy.typing.NDArray[numpy.uint32]]
|
|
98
|
+
| collections.abc.Iterable[tuple[int, numpy.typing.NDArray[numpy.uint32]]]
|
|
99
|
+
) = (),
|
|
100
|
+
**kwargs: numpy.typing.NDArray[numpy.uint32],
|
|
101
|
+
) -> None: ...
|
|
102
|
+
def values(
|
|
103
|
+
self,
|
|
104
|
+
) -> collections.abc.ValuesView[numpy.typing.NDArray[numpy.uint32]]: ...
|
|
105
|
+
@property
|
|
106
|
+
def array_shape(self) -> tuple[int, int, int]: ...
|
|
107
|
+
@property
|
|
108
|
+
def default_array(self) -> int | numpy.ndarray: ...
|
|
109
|
+
@default_array.setter
|
|
110
|
+
def default_array(
|
|
111
|
+
self, arg1: typing.SupportsInt | IndexArray3D | collections.abc.Buffer
|
|
112
|
+
) -> None: ...
|
amulet/core/dll.hpp
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#ifndef AMULET_CORE_EXPORT
|
|
4
|
+
#if defined(WIN32) || defined(_WIN32)
|
|
5
|
+
#ifdef ExportAmuletCore
|
|
6
|
+
#define AMULET_CORE_EXPORT __declspec(dllexport)
|
|
7
|
+
#else
|
|
8
|
+
#define AMULET_CORE_EXPORT __declspec(dllimport)
|
|
9
|
+
#endif
|
|
10
|
+
#else
|
|
11
|
+
#define AMULET_CORE_EXPORT
|
|
12
|
+
#endif
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
#if !defined(AMULET_CORE_EXPORT_EXCEPTION)
|
|
16
|
+
#if defined(_LIBCPP_EXCEPTION)
|
|
17
|
+
#define AMULET_CORE_EXPORT_EXCEPTION __attribute__((visibility("default")))
|
|
18
|
+
#else
|
|
19
|
+
#define AMULET_CORE_EXPORT_EXCEPTION
|
|
20
|
+
#endif
|
|
21
|
+
#endif
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import types
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
import amulet.core.version
|
|
7
|
+
import amulet.nbt
|
|
8
|
+
|
|
9
|
+
__all__: list[str] = ["Entity"]
|
|
10
|
+
|
|
11
|
+
class Entity(amulet.core.version.PlatformVersionContainer):
|
|
12
|
+
"""
|
|
13
|
+
A class to contain all the data to define an Entity.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@typing.overload
|
|
17
|
+
def __eq__(self, other: Entity) -> bool: ...
|
|
18
|
+
@typing.overload
|
|
19
|
+
def __eq__(self, other: typing.Any) -> bool | types.NotImplementedType: ...
|
|
20
|
+
def __hash__(self) -> int: ...
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
platform: str,
|
|
24
|
+
version: amulet.core.version.VersionNumber,
|
|
25
|
+
namespace: str,
|
|
26
|
+
base_name: str,
|
|
27
|
+
x: typing.SupportsFloat,
|
|
28
|
+
y: typing.SupportsFloat,
|
|
29
|
+
z: typing.SupportsFloat,
|
|
30
|
+
nbt: amulet.nbt.NamedTag,
|
|
31
|
+
) -> None: ...
|
|
32
|
+
def __repr__(self) -> str: ...
|
|
33
|
+
@property
|
|
34
|
+
def base_name(self) -> str:
|
|
35
|
+
"""
|
|
36
|
+
The base name of the entity represented by the :class:`Entity` object.
|
|
37
|
+
|
|
38
|
+
>>> entity: Entity
|
|
39
|
+
>>> entity.base_name
|
|
40
|
+
|
|
41
|
+
:return: The base name of the entity
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
@base_name.setter
|
|
45
|
+
def base_name(self, arg1: str) -> None: ...
|
|
46
|
+
@property
|
|
47
|
+
def namespace(self) -> str:
|
|
48
|
+
"""
|
|
49
|
+
The namespace of the entity represented by the :class:`Entity` object.
|
|
50
|
+
|
|
51
|
+
>>> entity: Entity
|
|
52
|
+
>>> entity.namespace
|
|
53
|
+
|
|
54
|
+
:return: The namespace of the entity
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
@namespace.setter
|
|
58
|
+
def namespace(self, arg1: str) -> None: ...
|
|
59
|
+
@property
|
|
60
|
+
def namespaced_name(self) -> str:
|
|
61
|
+
"""
|
|
62
|
+
The namespace:base_name of the entity represented by the :class:`Entity` object.
|
|
63
|
+
|
|
64
|
+
>>> entity: Entity
|
|
65
|
+
>>> entity.namespaced_name
|
|
66
|
+
|
|
67
|
+
:return: The namespace:base_name of the entity
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def nbt(self) -> amulet.nbt.NamedTag:
|
|
72
|
+
"""
|
|
73
|
+
The nbt data for the entity.
|
|
74
|
+
>>> entity: Entity
|
|
75
|
+
>>> entity.nbt
|
|
76
|
+
|
|
77
|
+
:return: The NamedTag of the entity
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
@nbt.setter
|
|
81
|
+
def nbt(self, arg1: amulet.nbt.NamedTag) -> None: ...
|
|
82
|
+
@property
|
|
83
|
+
def x(self) -> float:
|
|
84
|
+
"""
|
|
85
|
+
The x coordinate of the entity.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
@x.setter
|
|
89
|
+
def x(self, arg1: typing.SupportsFloat) -> None: ...
|
|
90
|
+
@property
|
|
91
|
+
def y(self) -> float:
|
|
92
|
+
"""
|
|
93
|
+
The y coordinate of the entity.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
@y.setter
|
|
97
|
+
def y(self, arg1: typing.SupportsFloat) -> None: ...
|
|
98
|
+
@property
|
|
99
|
+
def z(self) -> float:
|
|
100
|
+
"""
|
|
101
|
+
The z coordinate of the entity.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
@z.setter
|
|
105
|
+
def z(self, arg1: typing.SupportsFloat) -> None: ...
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <map>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <variant>
|
|
6
|
+
|
|
7
|
+
#include <amulet/io/binary_reader.hpp>
|
|
8
|
+
#include <amulet/io/binary_writer.hpp>
|
|
9
|
+
|
|
10
|
+
#include <amulet/nbt/tag/eq.hpp>
|
|
11
|
+
#include <amulet/nbt/tag/named_tag.hpp>
|
|
12
|
+
|
|
13
|
+
#include <amulet/core/dll.hpp>
|
|
14
|
+
#include <amulet/core/version/version.hpp>
|
|
15
|
+
|
|
16
|
+
namespace Amulet {
|
|
17
|
+
|
|
18
|
+
class Entity : public PlatformVersionContainer {
|
|
19
|
+
private:
|
|
20
|
+
std::string _namespace;
|
|
21
|
+
std::string _base_name;
|
|
22
|
+
std::shared_ptr<Amulet::NBT::NamedTag> _nbt;
|
|
23
|
+
double _x;
|
|
24
|
+
double _y;
|
|
25
|
+
double _z;
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
const std::string& get_namespace() const { return _namespace; }
|
|
29
|
+
|
|
30
|
+
template <typename NamespaceT>
|
|
31
|
+
void set_namespace(NamespaceT&& namespace_) { _namespace = std::forward<NamespaceT>(namespace_); }
|
|
32
|
+
|
|
33
|
+
const std::string& get_base_name() const { return _base_name; }
|
|
34
|
+
|
|
35
|
+
template <typename BaseNameT>
|
|
36
|
+
void set_base_name(BaseNameT&& base_name) { _base_name = std::forward<BaseNameT>(base_name); }
|
|
37
|
+
|
|
38
|
+
std::shared_ptr<Amulet::NBT::NamedTag> get_nbt() const { return _nbt; }
|
|
39
|
+
|
|
40
|
+
template <typename NBTT>
|
|
41
|
+
void set_nbt(NBTT&& nbt)
|
|
42
|
+
{
|
|
43
|
+
if constexpr (std::is_same_v<std::shared_ptr<Amulet::NBT::NamedTag>, std::decay_t<NBTT>>) {
|
|
44
|
+
_nbt = std::forward<NBTT>(nbt);
|
|
45
|
+
} else {
|
|
46
|
+
_nbt = std::make_shared<Amulet::NBT::NamedTag>(std::forward<NBTT>(nbt));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
double get_x() const { return _x; }
|
|
51
|
+
|
|
52
|
+
double get_y() const { return _y; }
|
|
53
|
+
|
|
54
|
+
double get_z() const { return _z; }
|
|
55
|
+
|
|
56
|
+
void set_x(double x) { _x = x; }
|
|
57
|
+
|
|
58
|
+
void set_y(double y) { _y = y; }
|
|
59
|
+
|
|
60
|
+
void set_z(double z) { _z = z; }
|
|
61
|
+
|
|
62
|
+
template <
|
|
63
|
+
typename PlatformT,
|
|
64
|
+
typename VersionNumberT,
|
|
65
|
+
typename NamespaceT,
|
|
66
|
+
typename BaseNameT,
|
|
67
|
+
typename NBTT>
|
|
68
|
+
Entity(
|
|
69
|
+
PlatformT&& platform,
|
|
70
|
+
VersionNumberT&& version,
|
|
71
|
+
NamespaceT&& namespace_,
|
|
72
|
+
BaseNameT&& base_name,
|
|
73
|
+
double x,
|
|
74
|
+
double y,
|
|
75
|
+
double z,
|
|
76
|
+
NBTT&& nbt)
|
|
77
|
+
: PlatformVersionContainer(std::forward<PlatformT>(platform), std::forward<VersionNumberT>(version))
|
|
78
|
+
, _namespace(std::forward<NamespaceT>(namespace_))
|
|
79
|
+
, _base_name(std::forward<BaseNameT>(base_name))
|
|
80
|
+
, _nbt(
|
|
81
|
+
[&nbt]() {
|
|
82
|
+
if constexpr (std::is_same_v<std::shared_ptr<Amulet::NBT::NamedTag>, NBTT>) {
|
|
83
|
+
return std::forward<NBTT>(nbt);
|
|
84
|
+
} else {
|
|
85
|
+
return std::make_shared<Amulet::NBT::NamedTag>(std::forward<NBTT>(nbt));
|
|
86
|
+
}
|
|
87
|
+
}())
|
|
88
|
+
, _x(x)
|
|
89
|
+
, _y(y)
|
|
90
|
+
, _z(z)
|
|
91
|
+
{
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
AMULET_CORE_EXPORT void serialise(BinaryWriter&) const;
|
|
95
|
+
AMULET_CORE_EXPORT static Entity deserialise(BinaryReader&);
|
|
96
|
+
|
|
97
|
+
AMULET_CORE_EXPORT bool operator==(const Entity& other) const;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
} // namespace Amulet
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from amulet.core.palette.biome_palette import BiomePalette
|
|
4
|
+
from amulet.core.palette.block_palette import BlockPalette
|
|
5
|
+
|
|
6
|
+
from . import biome_palette, block_palette
|
|
7
|
+
|
|
8
|
+
__all__: list[str] = ["BiomePalette", "BlockPalette", "biome_palette", "block_palette"]
|