1.21.8
This commit is contained in:
@@ -116,8 +116,8 @@ final class FenceGateAnimation {
|
|||||||
FenceGateSection section = classifyFenceGateQuad(quad, leftRightIsX);
|
FenceGateSection section = classifyFenceGateQuad(quad, leftRightIsX);
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case POSTS -> posts.add(dir, quad);
|
case POSTS -> posts.add(dir, quad);
|
||||||
case LEFT -> left.add(dir, quad);
|
case LEFT -> addDoubleSided(left, dir, quad);
|
||||||
case RIGHT -> right.add(dir, quad);
|
case RIGHT -> addDoubleSided(right, dir, quad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,6 +148,27 @@ final class FenceGateAnimation {
|
|||||||
|
|
||||||
private enum FenceGateSection { POSTS, LEFT, RIGHT }
|
private enum FenceGateSection { POSTS, LEFT, RIGHT }
|
||||||
|
|
||||||
|
private static void addDoubleSided(FenceGateCollector target, Direction dir, BakedQuad quad) {
|
||||||
|
target.add(dir, quad);
|
||||||
|
target.add(dir, reverseQuad(quad));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BakedQuad reverseQuad(BakedQuad quad) {
|
||||||
|
int[] data = quad.vertexData();
|
||||||
|
int stride = data.length / 4;
|
||||||
|
int[] flipped = new int[data.length];
|
||||||
|
|
||||||
|
for (int v = 0; v < 4; v++) {
|
||||||
|
int src = (3 - v) * stride;
|
||||||
|
int dst = v * stride;
|
||||||
|
System.arraycopy(data, src, flipped, dst, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
Direction face = quad.face();
|
||||||
|
Direction opposite = (face == null) ? null : face.getOpposite();
|
||||||
|
return new BakedQuad(flipped, quad.tintIndex(), opposite, quad.sprite(), quad.shade(), quad.lightEmission());
|
||||||
|
}
|
||||||
|
|
||||||
private static final class FenceGateModels {
|
private static final class FenceGateModels {
|
||||||
final BlockStateModel posts;
|
final BlockStateModel posts;
|
||||||
final BlockStateModel left;
|
final BlockStateModel left;
|
||||||
|
|||||||
Reference in New Issue
Block a user