Skip to content

Commit 3e3dbde

Browse files
committed
girdershi pt.3
1 parent 45abfc3 commit 3e3dbde

3 files changed

Lines changed: 27 additions & 72 deletions

File tree

src/main/java/com/kipti/bnb/content/girder_strut/GirderStrutModelBuilder.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import net.neoforged.neoforge.client.model.BakedModelWrapper;
1313
import net.neoforged.neoforge.client.model.data.ModelData;
1414
import net.neoforged.neoforge.client.model.data.ModelProperty;
15+
import net.neoforged.neoforge.common.util.TriState;
1516
import org.jetbrains.annotations.NotNull;
1617

1718
import java.util.ArrayList;
@@ -57,6 +58,21 @@ public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource r
5758
return base;
5859
}
5960

61+
@Override
62+
public TriState useAmbientOcclusion(BlockState state, ModelData data, RenderType renderType) {
63+
return TriState.FALSE;
64+
}
65+
66+
@Override
67+
public boolean useAmbientOcclusion() {
68+
return false;
69+
}
70+
71+
@Override
72+
public boolean usesBlockLight() {
73+
return false;
74+
}
75+
6076
static final class GirderStrutModelData {
6177
private final List<GirderConnection> connections;
6278

@@ -91,7 +107,7 @@ static GirderStrutModelData collect(BlockAndTintGetter level, BlockPos pos, Bloc
91107
continue;
92108
}
93109
Vec3 halfVector = span.scale(0.5);
94-
double renderLength = halfVector.length();
110+
double renderLength = halfVector.length() + 0.5f;
95111
if (renderLength <= 1.0e-4) {
96112
continue;
97113
}

src/main/java/com/kipti/bnb/content/girder_strut/GirderStrutModelManipulator.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static List<BakedQuad> bakeConnection(GirderStrutModelBuilder.GirderConnection c
5555
poseStack.translate(connection.start().x, connection.start().y, connection.start().z);
5656
poseStack.mulPose(new Quaternionf().rotationY(yRot));
5757
poseStack.mulPose(new Quaternionf().rotationX(-xRot));
58-
poseStack.translate(-0.5f, -0.5f, 0.0f);
58+
poseStack.translate(-0.5f, -0.5f, -0.5f);
5959

6060

6161
PoseStack.Pose last = poseStack.last();
@@ -244,9 +244,16 @@ MeshQuad clipZ(float maxZ) {
244244
return this;
245245
}
246246
if (maxZ <= minZ + EPSILON) {
247-
return null;
247+
float translation = maxZ - maxOriginalZ;
248+
Vertex[] shifted = new Vertex[vertices.length];
249+
for (int i = 0; i < vertices.length; i++) {
250+
Vertex vertex = vertices[i];
251+
Vector3f pos = new Vector3f(vertex.position()).add(0f, 0f, translation);
252+
shifted[i] = new Vertex(pos, new Vector3f(vertex.normal()), vertex.u(), vertex.v(), vertex.color(), vertex.light());
253+
}
254+
// Move the fully sliced quad back to the cut plane so the end face is preserved.
255+
return new MeshQuad(shifted, sprite, nominalFace, tintIndex, shade);
248256
}
249-
250257
List<Vertex> clipped = new ArrayList<>();
251258

252259
for (int i = 0; i < vertices.length; i++) {

src/main/resources/assets/bits_n_bobs/models/block/girder_strut/normal_girder_strut_attachment.json

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,5 @@
66
"particle": "create:block/industrial_iron_block"
77
},
88
"elements": [
9-
{
10-
"from": [
11-
0,
12-
0,
13-
0
14-
],
15-
"to": [
16-
16,
17-
5,
18-
16
19-
],
20-
"faces": {
21-
"north": {
22-
"uv": [
23-
0,
24-
0,
25-
16,
26-
5
27-
],
28-
"texture": "#0"
29-
},
30-
"east": {
31-
"uv": [
32-
0,
33-
0,
34-
16,
35-
5
36-
],
37-
"texture": "#0"
38-
},
39-
"south": {
40-
"uv": [
41-
0,
42-
0,
43-
16,
44-
5
45-
],
46-
"texture": "#0"
47-
},
48-
"west": {
49-
"uv": [
50-
0,
51-
0,
52-
16,
53-
5
54-
],
55-
"texture": "#0"
56-
},
57-
"up": {
58-
"uv": [
59-
16,
60-
16,
61-
0,
62-
0
63-
],
64-
"texture": "#0"
65-
},
66-
"down": {
67-
"uv": [
68-
16,
69-
0,
70-
0,
71-
16
72-
],
73-
"texture": "#0"
74-
}
75-
}
76-
}
779
]
7810
}

0 commit comments

Comments
 (0)