Cache Tessellator#instance in local var (#321)

This commit is contained in:
Alexdoru authored and GitHub committed 2025-07-18 11:51:16 -07:00
1 parent ae7af4e712
commit 1e66772abc
5 files changed
+43 -37

No files matched your search

@@ -27,20 +27,21 @@ public final class RenderUtil {
if (icon == null) {
return;
}
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(nx, ny, nz);
final Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.setNormal(nx, ny, nz);
if (nz > 0.0F) {
Tessellator.instance.addVertexWithUV(xStart, yStart, z, icon.getMinU(), icon.getMinV());
Tessellator.instance.addVertexWithUV(xEnd, yStart, z, icon.getMaxU(), icon.getMinV());
Tessellator.instance.addVertexWithUV(xEnd, yEnd, z, icon.getMaxU(), icon.getMaxV());
Tessellator.instance.addVertexWithUV(xStart, yEnd, z, icon.getMinU(), icon.getMaxV());
tess.addVertexWithUV(xStart, yStart, z, icon.getMinU(), icon.getMinV());
tess.addVertexWithUV(xEnd, yStart, z, icon.getMaxU(), icon.getMinV());
tess.addVertexWithUV(xEnd, yEnd, z, icon.getMaxU(), icon.getMaxV());
tess.addVertexWithUV(xStart, yEnd, z, icon.getMinU(), icon.getMaxV());
} else {
Tessellator.instance.addVertexWithUV(xStart, yEnd, z, icon.getMinU(), icon.getMaxV());
Tessellator.instance.addVertexWithUV(xEnd, yEnd, z, icon.getMaxU(), icon.getMaxV());
Tessellator.instance.addVertexWithUV(xEnd, yStart, z, icon.getMaxU(), icon.getMinV());
Tessellator.instance.addVertexWithUV(xStart, yStart, z, icon.getMinU(), icon.getMinV());
tess.addVertexWithUV(xStart, yEnd, z, icon.getMinU(), icon.getMaxV());
tess.addVertexWithUV(xEnd, yEnd, z, icon.getMaxU(), icon.getMaxV());
tess.addVertexWithUV(xEnd, yStart, z, icon.getMaxU(), icon.getMinV());
tess.addVertexWithUV(xStart, yStart, z, icon.getMinU(), icon.getMinV());
}
Tessellator.instance.draw();
tess.draw();
}
public static void renderFluidIntoGui(Gui gui, int x, int y, int width, int height,