amulet-core 2.0a7__cp312-cp312-win_amd64.whl → 2.0a8__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/__init__.cp312-win_amd64.pyd +0 -0
- amulet/__init__.py.cpp +2 -0
- amulet/__init__.pyi +2 -0
- amulet/_version.py +3 -3
- amulet/chunk.hpp +2 -1
- amulet/level/abc/_chunk_handle.py +45 -22
- amulet/mesh/block/__init__.pyi +301 -0
- amulet/mesh/block/_cube.py +198 -0
- amulet/mesh/block/{missing_block.py → _missing_block.py} +2 -2
- amulet/mesh/block/block_mesh.cpp +107 -0
- amulet/mesh/block/block_mesh.hpp +207 -0
- amulet/resource_pack/__init__.py +16 -15
- amulet/resource_pack/abc/resource_pack_manager.py +3 -5
- amulet/resource_pack/java/resource_pack_manager.py +185 -173
- amulet/utils/cast.py +10 -0
- amulet/utils/shareable_lock.py +2 -2
- {amulet_core-2.0a7.dist-info → amulet_core-2.0a8.dist-info}/METADATA +2 -2
- {amulet_core-2.0a7.dist-info → amulet_core-2.0a8.dist-info}/RECORD +21 -75
- {amulet_core-2.0a7.dist-info → amulet_core-2.0a8.dist-info}/WHEEL +1 -1
- amulet/mesh/block/__init__.py +0 -1
- amulet/mesh/block/block_mesh.py +0 -369
- amulet/mesh/block/cube.py +0 -149
- amulet/resource_pack/bedrock/__init__.py +0 -2
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/pack_icon.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_carried.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_side_carried.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/water.png +0 -0
- amulet/resource_pack/bedrock/blockshapes/__init__.py +0 -31
- amulet/resource_pack/bedrock/blockshapes/air.py +0 -35
- amulet/resource_pack/bedrock/blockshapes/base_blockshape.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/bubble_column.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/cake.py +0 -46
- amulet/resource_pack/bedrock/blockshapes/chest.py +0 -54
- amulet/resource_pack/bedrock/blockshapes/comparator.py +0 -51
- amulet/resource_pack/bedrock/blockshapes/cross_texture.py +0 -186
- amulet/resource_pack/bedrock/blockshapes/cross_texture0.py +0 -17
- amulet/resource_pack/bedrock/blockshapes/cross_texture_green.py +0 -16
- amulet/resource_pack/bedrock/blockshapes/cube.py +0 -38
- amulet/resource_pack/bedrock/blockshapes/default.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door.py +0 -38
- amulet/resource_pack/bedrock/blockshapes/door1.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door2.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door3.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door4.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door5.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door6.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/double_plant.py +0 -40
- amulet/resource_pack/bedrock/blockshapes/enchanting_table.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/farmland.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/fence.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/flat.py +0 -55
- amulet/resource_pack/bedrock/blockshapes/flat_wall.py +0 -55
- amulet/resource_pack/bedrock/blockshapes/furnace.py +0 -44
- amulet/resource_pack/bedrock/blockshapes/furnace_lit.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/green_cube.py +0 -39
- amulet/resource_pack/bedrock/blockshapes/ladder.py +0 -36
- amulet/resource_pack/bedrock/blockshapes/lilypad.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/partial_block.py +0 -57
- amulet/resource_pack/bedrock/blockshapes/piston.py +0 -44
- amulet/resource_pack/bedrock/blockshapes/piston_arm.py +0 -72
- amulet/resource_pack/bedrock/blockshapes/portal_frame.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/pressure_plate.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/pumpkin.py +0 -36
- amulet/resource_pack/bedrock/blockshapes/pumpkin_carved.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/pumpkin_lit.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/red_dust.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/repeater.py +0 -53
- amulet/resource_pack/bedrock/blockshapes/slab.py +0 -33
- amulet/resource_pack/bedrock/blockshapes/slab_double.py +0 -15
- amulet/resource_pack/bedrock/blockshapes/tree.py +0 -41
- amulet/resource_pack/bedrock/blockshapes/turtle_egg.py +0 -15
- amulet/resource_pack/bedrock/blockshapes/vine.py +0 -52
- amulet/resource_pack/bedrock/blockshapes/wall.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/water.py +0 -38
- amulet/resource_pack/bedrock/download_resources.py +0 -147
- amulet/resource_pack/bedrock/resource_pack.py +0 -40
- amulet/resource_pack/bedrock/resource_pack_manager.py +0 -361
- amulet/resource_pack/bedrock/sort_blockshapes.py +0 -15
- {amulet_core-2.0a7.dist-info → amulet_core-2.0a8.dist-info}/entry_points.txt +0 -0
- {amulet_core-2.0a7.dist-info → amulet_core-2.0a8.dist-info}/top_level.txt +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
from amulet.block import Block
|
|
3
|
-
from amulet.mesh.block import BlockMesh
|
|
4
|
-
from amulet.resource_pack.bedrock.blockshapes.partial_block import (
|
|
5
|
-
PartialBlock,
|
|
6
|
-
)
|
|
7
|
-
import amulet_nbt
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class PistonArm(PartialBlock):
|
|
11
|
-
def is_valid(self, block: Block) -> bool:
|
|
12
|
-
return isinstance(block.properties.get("facing_direction"), amulet_nbt.TAG_Int)
|
|
13
|
-
|
|
14
|
-
@property
|
|
15
|
-
def blockshape(self) -> str:
|
|
16
|
-
return "piston_arm"
|
|
17
|
-
|
|
18
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
19
|
-
return 0
|
|
20
|
-
|
|
21
|
-
@property
|
|
22
|
-
def rotation_map(self) -> dict[int, tuple[int, int]]:
|
|
23
|
-
return {0: (2, 0), 1: (0, 0), 2: (1, 2), 3: (1, 0), 4: (1, 1), 5: (1, 3)}
|
|
24
|
-
|
|
25
|
-
def get_block_model(
|
|
26
|
-
self,
|
|
27
|
-
block: Block,
|
|
28
|
-
down: str,
|
|
29
|
-
up: str,
|
|
30
|
-
north: str,
|
|
31
|
-
east: str,
|
|
32
|
-
south: str,
|
|
33
|
-
west: str,
|
|
34
|
-
transparency: tuple[bool, bool, bool, bool, bool, bool],
|
|
35
|
-
*args: Any,
|
|
36
|
-
**kwargs: Any
|
|
37
|
-
) -> BlockMesh:
|
|
38
|
-
rotation = self.rotation_map.get(
|
|
39
|
-
block.properties["facing_direction"].py_data, (0, 0)
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
return BlockMesh.merge(
|
|
43
|
-
[
|
|
44
|
-
super().get_block_model(
|
|
45
|
-
block,
|
|
46
|
-
down,
|
|
47
|
-
up,
|
|
48
|
-
north,
|
|
49
|
-
north,
|
|
50
|
-
north,
|
|
51
|
-
north,
|
|
52
|
-
transparency,
|
|
53
|
-
bounds=((0, 1), (12 / 16, 1), (0, 1)),
|
|
54
|
-
do_not_cull=(True, False, True, True, True, True),
|
|
55
|
-
),
|
|
56
|
-
super().get_block_model(
|
|
57
|
-
block,
|
|
58
|
-
west,
|
|
59
|
-
west,
|
|
60
|
-
west,
|
|
61
|
-
west,
|
|
62
|
-
west,
|
|
63
|
-
west,
|
|
64
|
-
(transparency[5],) * 6,
|
|
65
|
-
bounds=((6 / 16, 10 / 16), (0, 12 / 16), (6 / 16, 10 / 16)),
|
|
66
|
-
do_not_cull=(False, False, True, True, True, True),
|
|
67
|
-
),
|
|
68
|
-
]
|
|
69
|
-
).rotate(*rotation)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
BlockShape = PistonArm()
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.partial_block import (
|
|
3
|
-
PartialBlock,
|
|
4
|
-
)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class PortalFrame(PartialBlock):
|
|
8
|
-
@property
|
|
9
|
-
def blockshape(self) -> str:
|
|
10
|
-
return "portal_frame"
|
|
11
|
-
|
|
12
|
-
def bounds(
|
|
13
|
-
self, block: Block
|
|
14
|
-
) -> tuple[tuple[float, float], tuple[float, float], tuple[float, float]]:
|
|
15
|
-
return (0, 1), (0, 13 / 16), (0, 1)
|
|
16
|
-
|
|
17
|
-
@property
|
|
18
|
-
def do_not_cull(self) -> tuple[bool, bool, bool, bool, bool, bool]:
|
|
19
|
-
return False, True, False, False, False, False
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
BlockShape = PortalFrame()
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.partial_block import (
|
|
3
|
-
PartialBlock,
|
|
4
|
-
)
|
|
5
|
-
import amulet_nbt
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class PressurePlate(PartialBlock):
|
|
9
|
-
def is_valid(self, block: Block) -> bool:
|
|
10
|
-
return isinstance(block.properties.get("redstone_signal"), amulet_nbt.TAG_Int)
|
|
11
|
-
|
|
12
|
-
@property
|
|
13
|
-
def blockshape(self) -> str:
|
|
14
|
-
return "pressure_plate"
|
|
15
|
-
|
|
16
|
-
def bounds(
|
|
17
|
-
self, block: Block
|
|
18
|
-
) -> tuple[tuple[float, float], tuple[float, float], tuple[float, float]]:
|
|
19
|
-
if block.properties["redstone_signal"].py_data >= 1:
|
|
20
|
-
return (1 / 16, 15 / 16), (0, 1 / 32), (1 / 16, 15 / 16)
|
|
21
|
-
else:
|
|
22
|
-
return (1 / 16, 15 / 16), (0, 1 / 16), (1 / 16, 15 / 16)
|
|
23
|
-
|
|
24
|
-
@property
|
|
25
|
-
def do_not_cull(self) -> tuple[bool, bool, bool, bool, bool, bool]:
|
|
26
|
-
return False, True, True, True, True, True
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
BlockShape = PressurePlate()
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.cube import Cube
|
|
3
|
-
from amulet.mesh.block import BlockMesh
|
|
4
|
-
import amulet_nbt
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Pumpkin(Cube):
|
|
8
|
-
def is_valid(self, block: Block) -> bool:
|
|
9
|
-
return isinstance(block.properties.get("direction"), amulet_nbt.TAG_Int)
|
|
10
|
-
|
|
11
|
-
@property
|
|
12
|
-
def blockshape(self) -> str:
|
|
13
|
-
return "pumpkin"
|
|
14
|
-
|
|
15
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
16
|
-
return 2
|
|
17
|
-
|
|
18
|
-
def get_block_model(
|
|
19
|
-
self,
|
|
20
|
-
block: Block,
|
|
21
|
-
down: str,
|
|
22
|
-
up: str,
|
|
23
|
-
north: str,
|
|
24
|
-
east: str,
|
|
25
|
-
south: str,
|
|
26
|
-
west: str,
|
|
27
|
-
transparency: tuple[bool, bool, bool, bool, bool, bool],
|
|
28
|
-
) -> BlockMesh:
|
|
29
|
-
return (
|
|
30
|
-
super()
|
|
31
|
-
.get_block_model(block, down, up, north, east, south, west, transparency)
|
|
32
|
-
.rotate(0, block.properties["direction"].py_data)
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
BlockShape = Pumpkin()
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.pumpkin import Pumpkin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class PumpkinCarved(Pumpkin):
|
|
6
|
-
@property
|
|
7
|
-
def blockshape(self) -> str:
|
|
8
|
-
return "pumpkin_carved"
|
|
9
|
-
|
|
10
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
11
|
-
return 0
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BlockShape = PumpkinCarved()
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.pumpkin import Pumpkin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class PumpkinLit(Pumpkin):
|
|
6
|
-
@property
|
|
7
|
-
def blockshape(self) -> str:
|
|
8
|
-
return "pumpkin_lit"
|
|
9
|
-
|
|
10
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
11
|
-
return 1
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BlockShape = PumpkinLit()
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from amulet.resource_pack.bedrock.blockshapes.flat import Flat
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class RedDust(Flat):
|
|
5
|
-
@property
|
|
6
|
-
def blockshape(self) -> str:
|
|
7
|
-
return "red_dust"
|
|
8
|
-
|
|
9
|
-
@property
|
|
10
|
-
def tint(self) -> tuple[float, float, float]:
|
|
11
|
-
return 1, 0, 0
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BlockShape = RedDust()
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
from amulet.block import Block
|
|
3
|
-
from amulet.resource_pack.bedrock.blockshapes.partial_block import (
|
|
4
|
-
PartialBlock,
|
|
5
|
-
)
|
|
6
|
-
from amulet.mesh.block import BlockMesh
|
|
7
|
-
import amulet_nbt
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Repeater(PartialBlock):
|
|
11
|
-
def is_valid(self, block: Block) -> bool:
|
|
12
|
-
return isinstance(block.properties.get("direction"), amulet_nbt.TAG_Int)
|
|
13
|
-
|
|
14
|
-
@property
|
|
15
|
-
def blockshape(self) -> str:
|
|
16
|
-
return "repeater"
|
|
17
|
-
|
|
18
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
19
|
-
if block.base_name == "powered_repeater":
|
|
20
|
-
return 1
|
|
21
|
-
else:
|
|
22
|
-
return 0
|
|
23
|
-
|
|
24
|
-
def bounds(
|
|
25
|
-
self, block: Block
|
|
26
|
-
) -> tuple[tuple[float, float], tuple[float, float], tuple[float, float]]:
|
|
27
|
-
return (0, 1), (0, 2 / 16), (0, 1)
|
|
28
|
-
|
|
29
|
-
@property
|
|
30
|
-
def do_not_cull(self) -> tuple[bool, bool, bool, bool, bool, bool]:
|
|
31
|
-
return False, True, False, False, False, False
|
|
32
|
-
|
|
33
|
-
def get_block_model(
|
|
34
|
-
self,
|
|
35
|
-
block: Block,
|
|
36
|
-
down: str,
|
|
37
|
-
up: str,
|
|
38
|
-
north: str,
|
|
39
|
-
east: str,
|
|
40
|
-
south: str,
|
|
41
|
-
west: str,
|
|
42
|
-
transparency: tuple[bool, bool, bool, bool, bool, bool],
|
|
43
|
-
*args: Any,
|
|
44
|
-
**kwargs: Any
|
|
45
|
-
) -> BlockMesh:
|
|
46
|
-
return (
|
|
47
|
-
super()
|
|
48
|
-
.get_block_model(block, down, up, north, east, south, west, transparency)
|
|
49
|
-
.rotate(0, block.properties["direction"].py_data)
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
BlockShape = Repeater()
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.partial_block import (
|
|
3
|
-
PartialBlock,
|
|
4
|
-
)
|
|
5
|
-
import amulet_nbt
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Slab(PartialBlock):
|
|
9
|
-
def is_valid(self, block: Block) -> bool:
|
|
10
|
-
return isinstance(block.properties.get("top_slot_bit"), amulet_nbt.TAG_Byte)
|
|
11
|
-
|
|
12
|
-
@property
|
|
13
|
-
def blockshape(self) -> str:
|
|
14
|
-
return "slab"
|
|
15
|
-
|
|
16
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
17
|
-
"""The texture index to use within the list for the given Block"""
|
|
18
|
-
return aux_value % 8
|
|
19
|
-
|
|
20
|
-
def bounds(
|
|
21
|
-
self, block: Block
|
|
22
|
-
) -> tuple[tuple[float, float], tuple[float, float], tuple[float, float]]:
|
|
23
|
-
if block.properties["top_slot_bit"].py_data:
|
|
24
|
-
return (0, 1), (1 / 2, 1), (0, 1)
|
|
25
|
-
else:
|
|
26
|
-
return (0, 1), (0, 1 / 2), (0, 1)
|
|
27
|
-
|
|
28
|
-
@property
|
|
29
|
-
def do_not_cull(self) -> tuple[bool, bool, bool, bool, bool, bool]:
|
|
30
|
-
return False, True, False, False, False, False
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
BlockShape = Slab()
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.cube import Cube
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class SlabDouble(Cube):
|
|
6
|
-
@property
|
|
7
|
-
def blockshape(self) -> str:
|
|
8
|
-
return "slab_double"
|
|
9
|
-
|
|
10
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
11
|
-
"""The texture index to use within the list for the given Block"""
|
|
12
|
-
return aux_value % 8
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
BlockShape = SlabDouble()
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.mesh.block import BlockMesh
|
|
3
|
-
from amulet.resource_pack.bedrock.blockshapes.cube import Cube
|
|
4
|
-
import amulet_nbt
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Tree(Cube):
|
|
8
|
-
def is_valid(self, block: Block) -> bool:
|
|
9
|
-
return isinstance(block.properties.get("pillar_axis"), amulet_nbt.TAG_String)
|
|
10
|
-
|
|
11
|
-
@property
|
|
12
|
-
def blockshape(self) -> str:
|
|
13
|
-
return "tree"
|
|
14
|
-
|
|
15
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
16
|
-
return aux_value % 4
|
|
17
|
-
|
|
18
|
-
def get_block_model(
|
|
19
|
-
self,
|
|
20
|
-
block: Block,
|
|
21
|
-
down: str,
|
|
22
|
-
up: str,
|
|
23
|
-
north: str,
|
|
24
|
-
east: str,
|
|
25
|
-
south: str,
|
|
26
|
-
west: str,
|
|
27
|
-
transparency: tuple[bool, bool, bool, bool, bool, bool],
|
|
28
|
-
) -> BlockMesh:
|
|
29
|
-
axis: str = block.properties["pillar_axis"].py_data
|
|
30
|
-
|
|
31
|
-
model = super().get_block_model(
|
|
32
|
-
block, down, up, north, east, south, west, transparency
|
|
33
|
-
)
|
|
34
|
-
if axis == "x":
|
|
35
|
-
return model.rotate(1, 1)
|
|
36
|
-
elif axis == "z":
|
|
37
|
-
return model.rotate(1, 2)
|
|
38
|
-
return model
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
BlockShape = Tree()
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.cube import Cube
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class TurtleEgg(Cube):
|
|
6
|
-
@property
|
|
7
|
-
def blockshape(self) -> str:
|
|
8
|
-
return "turtle_egg"
|
|
9
|
-
|
|
10
|
-
def texture_index(self, block: Block, aux_value: int) -> int:
|
|
11
|
-
"""The texture index to use within the list for the given Block"""
|
|
12
|
-
return (aux_value // 4) % 3
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
BlockShape = TurtleEgg()
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.flat_wall import (
|
|
3
|
-
FlatWall,
|
|
4
|
-
)
|
|
5
|
-
from amulet.mesh.block import BlockMesh
|
|
6
|
-
import amulet_nbt
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Vine(FlatWall):
|
|
10
|
-
def is_valid(self, block: Block) -> bool:
|
|
11
|
-
return isinstance(
|
|
12
|
-
block.properties.get("vine_direction_bits"), amulet_nbt.TAG_Int
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
@property
|
|
16
|
-
def blockshape(self) -> str:
|
|
17
|
-
return "vine"
|
|
18
|
-
|
|
19
|
-
@property
|
|
20
|
-
def tint(self) -> tuple[float, float, float]:
|
|
21
|
-
return 0, 1, 0
|
|
22
|
-
|
|
23
|
-
def get_block_model(
|
|
24
|
-
self,
|
|
25
|
-
block: Block,
|
|
26
|
-
down: str,
|
|
27
|
-
up: str,
|
|
28
|
-
north: str,
|
|
29
|
-
east: str,
|
|
30
|
-
south: str,
|
|
31
|
-
west: str,
|
|
32
|
-
transparency: tuple[bool, bool, bool, bool, bool, bool],
|
|
33
|
-
modify_uv: bool = True,
|
|
34
|
-
) -> BlockMesh:
|
|
35
|
-
models = []
|
|
36
|
-
data: int = block.properties["vine_direction_bits"].py_data
|
|
37
|
-
if data:
|
|
38
|
-
model = super().get_block_model(
|
|
39
|
-
block, down, up, north, east, south, west, transparency
|
|
40
|
-
)
|
|
41
|
-
if data & 1:
|
|
42
|
-
models.append(model.rotate(0, 2))
|
|
43
|
-
if data & 2:
|
|
44
|
-
models.append(model.rotate(0, 3))
|
|
45
|
-
if data & 4:
|
|
46
|
-
models.append(model.rotate(0, 0))
|
|
47
|
-
if data & 8:
|
|
48
|
-
models.append(model.rotate(0, 1))
|
|
49
|
-
return BlockMesh.merge(models)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
BlockShape = Vine()
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.resource_pack.bedrock.blockshapes.partial_block import (
|
|
3
|
-
PartialBlock,
|
|
4
|
-
)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Wall(PartialBlock):
|
|
8
|
-
@property
|
|
9
|
-
def blockshape(self) -> str:
|
|
10
|
-
return "wall"
|
|
11
|
-
|
|
12
|
-
def bounds(
|
|
13
|
-
self, block: Block
|
|
14
|
-
) -> tuple[tuple[float, float], tuple[float, float], tuple[float, float]]:
|
|
15
|
-
return (4 / 16, 12 / 16), (0, 1), (4 / 16, 12 / 16)
|
|
16
|
-
|
|
17
|
-
@property
|
|
18
|
-
def do_not_cull(self) -> tuple[bool, bool, bool, bool, bool, bool]:
|
|
19
|
-
return False, False, True, True, True, True
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
BlockShape = Wall()
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from amulet.block import Block
|
|
2
|
-
from amulet.mesh.block.block_mesh import BlockMesh, Transparency
|
|
3
|
-
from amulet.mesh.block.cube import get_unit_cube
|
|
4
|
-
from amulet.resource_pack.bedrock.blockshapes.cube import Cube
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Water(Cube):
|
|
8
|
-
@property
|
|
9
|
-
def blockshape(self) -> str:
|
|
10
|
-
return "water"
|
|
11
|
-
|
|
12
|
-
def get_block_model(
|
|
13
|
-
self,
|
|
14
|
-
block: Block,
|
|
15
|
-
down: str,
|
|
16
|
-
up: str,
|
|
17
|
-
north: str,
|
|
18
|
-
east: str,
|
|
19
|
-
south: str,
|
|
20
|
-
west: str,
|
|
21
|
-
transparency: tuple[bool, bool, bool, bool, bool, bool],
|
|
22
|
-
) -> BlockMesh:
|
|
23
|
-
return get_unit_cube(
|
|
24
|
-
down,
|
|
25
|
-
down,
|
|
26
|
-
down,
|
|
27
|
-
down,
|
|
28
|
-
down,
|
|
29
|
-
down,
|
|
30
|
-
(
|
|
31
|
-
Transparency.FullTranslucent
|
|
32
|
-
if transparency[0]
|
|
33
|
-
else Transparency.FullOpaque
|
|
34
|
-
),
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
BlockShape = Water()
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
# import shutil
|
|
4
|
-
# import zipfile
|
|
5
|
-
# import json
|
|
6
|
-
# from urllib.request import urlopen
|
|
7
|
-
# import io
|
|
8
|
-
from typing import Generator, Optional, TypeVar, Any
|
|
9
|
-
import logging
|
|
10
|
-
|
|
11
|
-
from amulet.resource_pack import BedrockResourcePack
|
|
12
|
-
|
|
13
|
-
T = TypeVar("T")
|
|
14
|
-
|
|
15
|
-
log = logging.getLogger(__name__)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def generator_unpacker(gen: Generator[Any, Any, T]) -> T:
|
|
19
|
-
try:
|
|
20
|
-
while True:
|
|
21
|
-
next(gen)
|
|
22
|
-
except StopIteration as e:
|
|
23
|
-
return e.value # type: ignore
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def get_latest() -> BedrockResourcePack:
|
|
27
|
-
return generator_unpacker(get_latest_iter())
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def get_latest_iter() -> Generator[float, None, BedrockResourcePack]:
|
|
31
|
-
vanilla_rp_path = os.path.join(
|
|
32
|
-
os.environ["CACHE_DIR"], "resource_packs", "bedrock", "vanilla"
|
|
33
|
-
)
|
|
34
|
-
yield 0
|
|
35
|
-
# new_version = launcher_manifest["latest"]["release"]
|
|
36
|
-
# if new_version is None:
|
|
37
|
-
# if os.path.isdir(vanilla_rp_path):
|
|
38
|
-
# log.error(
|
|
39
|
-
# "Could not download the launcher manifest. The resource pack seems to be present so using that."
|
|
40
|
-
# )
|
|
41
|
-
# else:
|
|
42
|
-
# log.error(
|
|
43
|
-
# "Could not download the launcher manifest. The resource pack is not present, blocks may not be rendered correctly."
|
|
44
|
-
# )
|
|
45
|
-
# else:
|
|
46
|
-
# if os.path.isdir(vanilla_rp_path):
|
|
47
|
-
# if os.path.isfile(os.path.join(vanilla_rp_path, "version")):
|
|
48
|
-
# with open(os.path.join(vanilla_rp_path, "version")) as f:
|
|
49
|
-
# old_version = f.read()
|
|
50
|
-
# if old_version != new_version:
|
|
51
|
-
# yield from _remove_and_download_iter(vanilla_rp_path, new_version)
|
|
52
|
-
# else:
|
|
53
|
-
# yield from _remove_and_download_iter(vanilla_rp_path, new_version)
|
|
54
|
-
# else:
|
|
55
|
-
# yield from _remove_and_download_iter(vanilla_rp_path, new_version)
|
|
56
|
-
return BedrockResourcePack(vanilla_rp_path)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_bedrock_vanilla_fix: Optional[BedrockResourcePack] = None
|
|
60
|
-
_bedrock_vanilla_latest: Optional[BedrockResourcePack] = None
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def get_bedrock_vanilla_fix() -> BedrockResourcePack:
|
|
64
|
-
global _bedrock_vanilla_fix
|
|
65
|
-
if _bedrock_vanilla_fix is None:
|
|
66
|
-
_bedrock_vanilla_fix = BedrockResourcePack(
|
|
67
|
-
os.path.join(os.path.dirname(__file__), "bedrock_vanilla_fix")
|
|
68
|
-
)
|
|
69
|
-
return _bedrock_vanilla_fix
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def get_bedrock_vanilla_latest() -> BedrockResourcePack:
|
|
73
|
-
global _bedrock_vanilla_latest
|
|
74
|
-
if _bedrock_vanilla_latest is None:
|
|
75
|
-
_bedrock_vanilla_latest = get_latest()
|
|
76
|
-
return _bedrock_vanilla_latest
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def get_bedrock_vanilla_latest_iter() -> Generator[float, None, BedrockResourcePack]:
|
|
80
|
-
global _bedrock_vanilla_latest
|
|
81
|
-
if _bedrock_vanilla_latest is None:
|
|
82
|
-
_bedrock_vanilla_latest = yield from get_latest_iter()
|
|
83
|
-
return _bedrock_vanilla_latest
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# def _remove_and_download(path, version):
|
|
87
|
-
# for _ in _remove_and_download_iter(path, version):
|
|
88
|
-
# pass
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# def _remove_and_download_iter(path, version) -> Generator[float, None, None]:
|
|
92
|
-
# if os.path.isdir(path):
|
|
93
|
-
# shutil.rmtree(path, ignore_errors=True)
|
|
94
|
-
# exists = yield from download_resources_iter(path, version)
|
|
95
|
-
# if exists:
|
|
96
|
-
# with open(os.path.join(path, "version"), "w") as f:
|
|
97
|
-
# f.write(version)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
# def download_resources(path, version) -> bool:
|
|
101
|
-
# return generator_unpacker(download_resources_iter(path, version))
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
# def download_resources_iter(
|
|
105
|
-
# path, version, chunk_size=4096
|
|
106
|
-
# ) -> Generator[float, None, bool]:
|
|
107
|
-
# log.info(f"Downloading Bedrock resource pack for version {version}")
|
|
108
|
-
# version_url = next(
|
|
109
|
-
# (v["url"] for v in launcher_manifest["versions"] if v["id"] == version), None
|
|
110
|
-
# )
|
|
111
|
-
# if version_url is None:
|
|
112
|
-
# log.error(f"Could not find Bedrock resource pack for version {version}.")
|
|
113
|
-
# return False
|
|
114
|
-
#
|
|
115
|
-
# try:
|
|
116
|
-
# version_manifest = json.load(urlopen(version_url))
|
|
117
|
-
# version_client_url = version_manifest["downloads"]["client"]["url"]
|
|
118
|
-
#
|
|
119
|
-
# response = urlopen(version_client_url)
|
|
120
|
-
# data = []
|
|
121
|
-
# data_size = int(response.headers["content-length"].strip())
|
|
122
|
-
# index = 0
|
|
123
|
-
# chunk = b"hello"
|
|
124
|
-
# while chunk:
|
|
125
|
-
# chunk = response.read(chunk_size)
|
|
126
|
-
# data.append(chunk)
|
|
127
|
-
# index += 1
|
|
128
|
-
# yield min(1.0, (index * chunk_size) / (data_size * 2))
|
|
129
|
-
#
|
|
130
|
-
# client = zipfile.ZipFile(io.BytesIO(b"".join(data)))
|
|
131
|
-
# paths = [fpath for fpath in client.namelist() if fpath.startswith("assets/")]
|
|
132
|
-
# path_count = len(paths)
|
|
133
|
-
# for path_index, fpath in enumerate(paths):
|
|
134
|
-
# if not path_index % 30:
|
|
135
|
-
# yield path_index / (path_count * 2) + 0.5
|
|
136
|
-
# client.extract(fpath, path)
|
|
137
|
-
# client.extract("pack.mcmeta", path)
|
|
138
|
-
# client.extract("pack.png", path)
|
|
139
|
-
#
|
|
140
|
-
# except:
|
|
141
|
-
# log.error(
|
|
142
|
-
# f"Failed to download and extract the Bedrock resource pack for version {version}. Make sure you have a connection to the internet.",
|
|
143
|
-
# exc_info=True,
|
|
144
|
-
# )
|
|
145
|
-
# return False
|
|
146
|
-
# log.info(f"Finished downloading Bedrock resource pack for version {version}")
|
|
147
|
-
# return True
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
from amulet.resource_pack.abc import BaseResourcePack
|
|
5
|
-
from amulet.utils import comment_json
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class BedrockResourcePack(BaseResourcePack):
|
|
9
|
-
"""A class to hold the bare-bones information about the resource pack.
|
|
10
|
-
Holds the pack format, description and if the pack is valid.
|
|
11
|
-
This information can be used in a viewer to display the packs to the user."""
|
|
12
|
-
|
|
13
|
-
def __init__(self, resource_pack_path: str):
|
|
14
|
-
super().__init__(resource_pack_path)
|
|
15
|
-
meta_path = os.path.join(resource_pack_path, "manifest.json")
|
|
16
|
-
if os.path.isfile(meta_path):
|
|
17
|
-
try:
|
|
18
|
-
with open(meta_path) as f:
|
|
19
|
-
pack_mcmeta = comment_json.load(f)
|
|
20
|
-
except json.JSONDecodeError:
|
|
21
|
-
pass
|
|
22
|
-
else:
|
|
23
|
-
if isinstance(pack_mcmeta, dict):
|
|
24
|
-
header = pack_mcmeta.get("header", None)
|
|
25
|
-
if isinstance(header, dict):
|
|
26
|
-
description = header.get("description", None)
|
|
27
|
-
if isinstance(description, str):
|
|
28
|
-
self._pack_description = description
|
|
29
|
-
self._valid_pack = True
|
|
30
|
-
|
|
31
|
-
pack_icon_path = os.path.join(resource_pack_path, "pack_icon.png")
|
|
32
|
-
if os.path.isfile(pack_icon_path):
|
|
33
|
-
self._pack_icon = pack_icon_path
|
|
34
|
-
|
|
35
|
-
@staticmethod
|
|
36
|
-
def is_valid(pack_path: str) -> bool:
|
|
37
|
-
return os.path.isfile(os.path.join(pack_path, "manifest.json"))
|
|
38
|
-
|
|
39
|
-
def __repr__(self) -> str:
|
|
40
|
-
return f"BedrockResourcePack({self._root_dir})"
|