Skip to content

Commit 8db490d

Browse files
edayottryashtar
andcommitted
feat: adding bed special
Co-authored-by: tryashtar <tryashtar@gmail.com>
1 parent 84da8d1 commit 8db490d

File tree

2 files changed

+87
-4
lines changed

2 files changed

+87
-4
lines changed

examples/test_item_model/my_pipeline.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ def beet_default(ctx: Context):
115115
path_ctx=f"test:render/shield/{i}", render_size=512)
116116

117117

118-
# render.add_item_task(Item(id="minecraft:diamond", components={
119-
# "minecraft:item_model": "test:zombie"
120-
# }), path_ctx="test:render/zombie", render_size=512)
121-
# render.add_item_task(Item(id="minecraft:diamond"), path_ctx="test:render/diamond", render_size=512)
118+
render.add_item_task(Item(id="minecraft:diamond", components={
119+
"minecraft:item_model": "minecraft:red_bed"
120+
}), path_ctx="test:render/red_bed", render_size=512)
122121

123122

124123
render.add_model_task("test:item/conduit", path_ctx="test:render/conduit", render_size=512)

model_resolver/item_model/special.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,90 @@ class SpecialModelBed(SpecialModelBase):
5959
type: Literal["minecraft:bed", "bed"]
6060
texture: str
6161

62+
def get_model(self, getter: PackGetterV2, item: Item) -> dict[str, Any]:
63+
namespace, path = resolve_key(self.texture).split(":")
64+
model: dict[str, Any] = {
65+
"textures": {"0": f"{namespace}:entity/bed/{path}"},
66+
"elements": [
67+
{
68+
"from": [0, 0, 13],
69+
"to": [3, 3, 16],
70+
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]},
71+
"faces": {
72+
"north": {"uv": [14.75, 5.25, 15.5, 6], "texture": "#0"},
73+
"east": {"uv": [14, 5.25, 14.75, 6], "texture": "#0"},
74+
"south": {"uv": [13.25, 5.25, 14, 6], "texture": "#0"},
75+
"west": {"uv": [12.5, 5.25, 13.25, 6], "texture": "#0"},
76+
"up": {"uv": [13.25, 4.5, 14, 5.25], "rotation": 180, "texture": "#0"},
77+
"down": {"uv": [14.75, 4.5, 14, 5.25], "rotation": 180, "texture": "#0"}
78+
}
79+
},
80+
{
81+
"from": [0, 3, -16],
82+
"to": [16, 9, 0],
83+
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]},
84+
"faces": {
85+
"north": {"uv": [5.5, 5.5, 9.5, 7], "rotation": 180, "texture": "#0"},
86+
"east": {"uv": [0, 7, 1.5, 11], "rotation": 270, "texture": "#0"},
87+
"west": {"uv": [5.5, 7, 7, 11], "rotation": 90, "texture": "#0"},
88+
"up": {"uv": [1.5, 7, 5.5, 11], "rotation": 180, "texture": "#0"},
89+
"down": {"uv": [10.75, 10.75, 7, 7], "rotation": 180, "texture": "#0"}
90+
}
91+
},
92+
{
93+
"from": [0, 0, -16],
94+
"to": [3, 3, -13],
95+
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]},
96+
"faces": {
97+
"north": {"uv": [12.5, 3.75, 13.25, 4.5], "texture": "#0"},
98+
"east": {"uv": [14.75, 3.75, 15.5, 4.5], "texture": "#0"},
99+
"south": {"uv": [14, 3.75, 14.75, 4.5], "texture": "#0"},
100+
"west": {"uv": [13.25, 3.75, 14, 4.5], "texture": "#0"},
101+
"up": {"uv": [13.25, 3, 14, 3.75], "rotation": 90, "texture": "#0"},
102+
"down": {"uv": [14.75, 3, 14, 3.75], "rotation": 90, "texture": "#0"}
103+
}
104+
},
105+
{
106+
"from": [13, 0, -16],
107+
"to": [16, 3, -13],
108+
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]},
109+
"faces": {
110+
"north": {"uv": [13.25, 0.75, 14, 1.5], "texture": "#0"},
111+
"east": {"uv": [12.5, 0.75, 13.25, 1.5], "texture": "#0"},
112+
"south": {"uv": [14.75, 0.75, 15.5, 1.5], "texture": "#0"},
113+
"west": {"uv": [14, 0.75, 14.75, 1.5], "texture": "#0"},
114+
"up": {"uv": [13.25, 0, 14, 0.75], "texture": "#0"},
115+
"down": {"uv": [14.75, 0, 14, 0.75], "texture": "#0"}
116+
}
117+
},
118+
{
119+
"from": [0, 3, 0],
120+
"to": [16, 9, 16],
121+
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]},
122+
"faces": {
123+
"east": {"uv": [0, 1.5, 1.5, 5.5], "rotation": 270, "texture": "#0"},
124+
"south": {"uv": [1.5, 0, 5.5, 1.5], "rotation": 180, "texture": "#0"},
125+
"west": {"uv": [5.5, 1.5, 7, 5.5], "rotation": 90, "texture": "#0"},
126+
"up": {"uv": [1.5, 1.5, 5.5, 5.5], "rotation": 180, "texture": "#0"},
127+
"down": {"uv": [10.75, 5.25, 7, 1.5], "rotation": 180, "texture": "#0"}
128+
}
129+
},
130+
{
131+
"from": [13, 0, 13],
132+
"to": [16, 3, 16],
133+
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]},
134+
"faces": {
135+
"north": {"uv": [14, 2.25, 14.75, 3], "texture": "#0"},
136+
"east": {"uv": [13.25, 2.25, 14, 3], "texture": "#0"},
137+
"south": {"uv": [12.5, 2.25, 13.25, 3], "texture": "#0"},
138+
"west": {"uv": [14.75, 2.25, 15.5, 3], "texture": "#0"},
139+
"up": {"uv": [13.25, 1.5, 14, 2.25], "rotation": 270, "texture": "#0"},
140+
"down": {"uv": [14, 1.5, 14.75, 2.25], "rotation": 270, "texture": "#0"}
141+
}
142+
}
143+
],
144+
}
145+
return model
62146

63147

64148
class SpecialModelBaseLayer(SpecialModelBase):

0 commit comments

Comments
 (0)