Skip to content

Commit

Permalink
Ignore undersized quads
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Sep 3, 2023
1 parent 08d92eb commit 64ef95c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public void quad(MatrixStack.Entry matrices, BakedQuad bakedQuad, float r, float
throw new IllegalStateException();
}

if (bakedQuad.getVertexData().length < 32) {
return; // we do not accept quads with less than 4 properly sized vertices
}

VertexBufferWriter writer = VertexBufferWriter.of(this);

ModelQuadView quad = (ModelQuadView) bakedQuad;
Expand All @@ -56,6 +60,10 @@ public void quad(MatrixStack.Entry matrices, BakedQuad bakedQuad, float[] bright
throw new IllegalStateException();
}

if (bakedQuad.getVertexData().length < 32) {
return; // we do not accept quads with less than 4 properly sized vertices
}

VertexBufferWriter writer = VertexBufferWriter.of(this);

ModelQuadView quad = (ModelQuadView) bakedQuad;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ private void renderFast(MatrixStack.Entry entry, VertexConsumer vertexConsumer,
private static void renderQuads(MatrixStack.Entry matrices, VertexBufferWriter writer, int defaultColor, List<BakedQuad> quads, int light, int overlay) {
for (int i = 0; i < quads.size(); i++) {
BakedQuad bakedQuad = quads.get(i);

if (bakedQuad.getVertexData().length < 32) {
continue; // ignore bad quads
}

BakedQuadView quad = (BakedQuadView) bakedQuad;

int color = quad.hasColor() ? defaultColor : 0xFFFFFFFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ private void renderModelFast(BakedModel model, ItemStack itemStack, int light, i
private void renderBakedItemQuads(MatrixStack.Entry matrices, VertexBufferWriter writer, List<BakedQuad> quads, ItemStack itemStack, ItemColorProvider colorProvider, int light, int overlay) {
for (int i = 0; i < quads.size(); i++) {
BakedQuad bakedQuad = quads.get(i);

if (bakedQuad.getVertexData().length < 32) {
continue; // ignore bad quads
}

BakedQuadView quad = (BakedQuadView) bakedQuad;

int color = 0xFFFFFFFF;
Expand Down

0 comments on commit 64ef95c

Please sign in to comment.