Skip to content

Commit 206c4b4

Browse files
committed
fixed missing bottom rings texture and z fighting.
1 parent ec2d636 commit 206c4b4

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

fabric/src/main/java/com/dtteam/dynamictrees/model/FallingTreeEntityModelFabric.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public List<TreeQuadData> generateTreeQuads(FallingTreeEntity entity) {
6969
float offset = (8 - Math.min(((BranchBlock) exState.getBlock()).getRadius(exState), BranchBlock.MAX_RADIUS)) / 16f;
7070
int coreRadius = ((BranchBlock) exState.getBlock()).getRadius(exState);
7171
treeQuads.addAll(toTreeQuadData(
72-
getBranchQuadsWithConnections(branchModel, exState, new Vec3(offsetPos.getX(), offsetPos.getY(), offsetPos.getZ()).scale(offset), random, connectionArray, coreRadius, cutDir),
72+
getBottomRingQuads(branchModel, new Vec3(offsetPos.getX(), offsetPos.getY(), offsetPos.getZ()).scale(offset), coreRadius, cutDir),
7373
exState));
7474
bottomRingsAdded = true;
7575
}
@@ -103,6 +103,29 @@ public List<TreeQuadData> generateTreeQuads(FallingTreeEntity entity) {
103103
return treeQuads;
104104
}
105105

106+
private List<BakedQuad> getBottomRingQuads(BakedModel model, Vec3 offset, int coreRadius, Direction cutDir) {
107+
List<BakedQuad> allQuads = new ArrayList<>();
108+
109+
if (model instanceof BasicBranchBlockBakedModel branchModel) {
110+
List<BakedQuad> ringQuads = branchModel.ringsQuads[coreRadius - 1];
111+
for (BakedQuad quad : ringQuads) {
112+
if (quad.getDirection() == cutDir) {
113+
allQuads.add(quad);
114+
}
115+
}
116+
}
117+
118+
if (offset.x() != 0 || offset.y() != 0 || offset.z() != 0) {
119+
List<BakedQuad> offsetQuads = new ArrayList<>();
120+
for (BakedQuad quad : allQuads) {
121+
offsetQuads.add(offsetQuad(quad, offset));
122+
}
123+
return offsetQuads;
124+
}
125+
126+
return allQuads;
127+
}
128+
106129
private List<BakedQuad> getBranchQuadsWithConnections(BakedModel model, BlockState state, Vec3 offset, RandomSource random, int[] connections, int coreRadius, Direction forceRingDir) {
107130
List<BakedQuad> allQuads = new ArrayList<>();
108131

0 commit comments

Comments
 (0)