Skip to content

Commit a6d65f3

Browse files
committed
Add pale moss carpet.
1 parent 6b00290 commit a6d65f3

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed

chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import se.llbit.chunky.entity.SkullEntity;
99
import se.llbit.chunky.model.minecraft.FlowerPotModel;
1010
import se.llbit.chunky.model.minecraft.FlowerPotModel.Kind;
11+
import se.llbit.chunky.model.minecraft.PaleMossCarpetModel;
1112
import se.llbit.chunky.resources.ShulkerTexture;
1213
import se.llbit.chunky.resources.Texture;
1314
import se.llbit.nbt.ListTag;
@@ -1146,6 +1147,12 @@ private static void addBlocks(Texture texture, String... names) {
11461147
addBlock("pale_oak_wall_sign", (name, tag) -> wallSign(tag, "pale_oak"));
11471148
addBlock("pale_oak_hanging_sign", (name, tag) -> hangingSign(tag, "pale_oak"));
11481149
addBlock("pale_oak_wall_hanging_sign", (name, tag) -> wallHangingSign(tag, "pale_oak"));
1150+
addBlock("pale_moss_carpet", (name, tag) -> new PaleMossCarpet(name,
1151+
tag.get("Properties").get("bottom").stringValue("false").equals("true"),
1152+
tag.get("Properties").get("north").stringValue("none"),
1153+
tag.get("Properties").get("east").stringValue("none"),
1154+
tag.get("Properties").get("south").stringValue("none"),
1155+
tag.get("Properties").get("west").stringValue("none")));
11491156
}
11501157

11511158
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package se.llbit.chunky.block.minecraft;
2+
3+
import se.llbit.chunky.block.AbstractModelBlock;
4+
import se.llbit.chunky.model.minecraft.PaleMossCarpetModel;
5+
import se.llbit.chunky.resources.Texture;
6+
7+
public class PaleMossCarpet extends AbstractModelBlock {
8+
private final String description;
9+
10+
public PaleMossCarpet(String name, boolean bottom, String north, String east, String south, String west) {
11+
super(name, Texture.paleMossCarpet);
12+
this.model = new PaleMossCarpetModel(bottom, north, east, south, west);
13+
this.description = String.format("bottom=%s, north=%s, east=%s, south=%s, west=%s", bottom, north, east, south, west);
14+
}
15+
16+
@Override
17+
public String description() {
18+
return description;
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package se.llbit.chunky.model.minecraft;
2+
3+
import se.llbit.chunky.model.Model;
4+
import se.llbit.chunky.model.QuadModel;
5+
import se.llbit.chunky.resources.Texture;
6+
import se.llbit.math.Quad;
7+
import se.llbit.math.Vector3;
8+
import se.llbit.math.Vector4;
9+
10+
import java.util.ArrayList;
11+
import java.util.Arrays;
12+
import java.util.List;
13+
14+
public class PaleMossCarpetModel extends QuadModel {
15+
private static final Quad[] carpet = new Quad[]{
16+
new Quad(
17+
new Vector3(0 / 16.0, 1 / 16.0, 16 / 16.0),
18+
new Vector3(16 / 16.0, 1 / 16.0, 16 / 16.0),
19+
new Vector3(0 / 16.0, 1 / 16.0, 0 / 16.0),
20+
new Vector4(0 / 16.0, 16 / 16.0, 0 / 16.0, 16 / 16.0)
21+
),
22+
new Quad(
23+
new Vector3(0 / 16.0, 0 / 16.0, 0 / 16.0),
24+
new Vector3(16 / 16.0, 0 / 16.0, 0 / 16.0),
25+
new Vector3(0 / 16.0, 0 / 16.0, 16 / 16.0),
26+
new Vector4(0 / 16.0, 16 / 16.0, 0 / 16.0, 16 / 16.0)
27+
),
28+
new Quad(
29+
new Vector3(0 / 16.0, 1 / 16.0, 16 / 16.0),
30+
new Vector3(0 / 16.0, 1 / 16.0, 0 / 16.0),
31+
new Vector3(0 / 16.0, 0 / 16.0, 16 / 16.0),
32+
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
33+
),
34+
new Quad(
35+
new Vector3(16 / 16.0, 1 / 16.0, 0 / 16.0),
36+
new Vector3(16 / 16.0, 1 / 16.0, 16 / 16.0),
37+
new Vector3(16 / 16.0, 0 / 16.0, 0 / 16.0),
38+
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
39+
),
40+
new Quad(
41+
new Vector3(0 / 16.0, 1 / 16.0, 0 / 16.0),
42+
new Vector3(16 / 16.0, 1 / 16.0, 0 / 16.0),
43+
new Vector3(0 / 16.0, 0 / 16.0, 0 / 16.0),
44+
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
45+
),
46+
new Quad(
47+
new Vector3(16 / 16.0, 1 / 16.0, 16 / 16.0),
48+
new Vector3(0 / 16.0, 1 / 16.0, 16 / 16.0),
49+
new Vector3(16 / 16.0, 0 / 16.0, 16 / 16.0),
50+
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
51+
)
52+
};
53+
54+
private static final Quad[] carpetSide = new Quad[]{
55+
new Quad(
56+
new Vector3(0 / 16.0, 16 / 16.0, 0.1 / 16.0),
57+
new Vector3(16 / 16.0, 16 / 16.0, 0.1 / 16.0),
58+
new Vector3(0 / 16.0, 0 / 16.0, 0.1 / 16.0),
59+
new Vector4(0 / 16.0, 16 / 16.0, 16 / 16.0, 0 / 16.0),
60+
true
61+
)
62+
};
63+
64+
private final Quad[] quads;
65+
private final Texture[] textures;
66+
67+
public PaleMossCarpetModel(boolean bottom, String north, String east, String south, String west) {
68+
List<Quad> quads = new ArrayList<>();
69+
List<Texture> textures = new ArrayList<>();
70+
71+
boolean noSides = !bottom && north.equals("none") && east.equals("none") && south.equals("none") && west.equals("none");
72+
73+
// bottom
74+
if (bottom || noSides) {
75+
quads.addAll(Arrays.asList(carpet));
76+
for (Quad quad : quads) {
77+
textures.add(Texture.paleMossCarpet);
78+
}
79+
}
80+
81+
// north side
82+
if (!north.equals("none") || noSides) {
83+
quads.addAll(Arrays.asList(carpetSide));
84+
textures.add(north.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
85+
}
86+
87+
// east side
88+
if (!east.equals("none") || noSides) {
89+
quads.addAll(Arrays.asList(Model.rotateY(carpetSide)));
90+
textures.add(east.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
91+
}
92+
93+
// east side
94+
if (!south.equals("none") || noSides) {
95+
quads.addAll(Arrays.asList(Model.rotateY(carpetSide, Math.toRadians(180))));
96+
textures.add(south.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
97+
}
98+
99+
// east side
100+
if (!west.equals("none") || noSides) {
101+
quads.addAll(Arrays.asList(Model.rotateNegY(carpetSide)));
102+
textures.add(west.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
103+
}
104+
105+
this.quads = quads.toArray(new Quad[0]);
106+
this.textures = textures.toArray(new Texture[0]);
107+
}
108+
109+
@Override
110+
public Quad[] getQuads() {
111+
return quads;
112+
}
113+
114+
@Override
115+
public Texture[] getTextures() {
116+
return textures;
117+
}
118+
}

chunky/src/java/se/llbit/chunky/resources/Texture.java

+6
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,12 @@ public class Texture {
15421542
public static final Texture paleOakSignPost = new Texture();
15431543
@TexturePath("assets/minecraft/textures/entity/signs/hanging/pale_oak")
15441544
public static final Texture paleOakHangingSign = new Texture();
1545+
@TexturePath("assets/minecraft/textures/block/pale_moss_carpet")
1546+
public static final Texture paleMossCarpet = new Texture();
1547+
@TexturePath("assets/minecraft/textures/block/pale_moss_carpet_side_small")
1548+
public static final Texture paleMossCarpetSideSmall = new Texture();
1549+
@TexturePath("assets/minecraft/textures/block/pale_moss_carpet_side_tall")
1550+
public static final Texture paleMossCarpetSideTall = new Texture();
15451551

15461552
/** Banner base texture. */
15471553
public static final Texture bannerBase = new Texture();

0 commit comments

Comments
 (0)