Skip to content

Commit

Permalink
Don't crash on null meshes. Fix #151
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Apr 30, 2024
1 parent 6d7f630 commit cea073d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ private static void renderSkull(Direction direction, float f, float g, PoseStack
lastSkull = null;
return;
}
Mesh mesh = lastSkull.getHeadLayers();
if (mesh == null) {
accessor.showHat(true);
lastSkull = null;
return;
}
accessor.showHat(false);

poseStack.pushPose();
Expand All @@ -127,7 +133,6 @@ private static void renderSkull(Direction direction, float f, float g, PoseStack
poseStack.scale(-1.0F, -1.0F, 1.0F);
float voxelSize = SkinLayersModBase.config.skullVoxelSize;
poseStack.scale(voxelSize, voxelSize, voxelSize);
Mesh mesh = lastSkull.getHeadLayers();
mesh.setPosition(0, -0.25f, 0);
mesh.setRotation(0, f * 0.017453292F, 0);
// spotless:off
Expand Down

0 comments on commit cea073d

Please sign in to comment.