For color only things manually handle resetting color to reduce GC from advanced helper

This commit is contained in:
pupnewfster committed 2019-07-08 11:46:21 -04:00
1 parent fbd4336139
commit adf2741aef
19 files changed
+172 -150

No files matched your search

@@ -9,7 +9,7 @@ import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.gui.element.GuiConfigTypeTab;
import mekanism.client.render.MekanismRenderHelper;
import mekanism.client.render.GLSMHelper;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.SideData;
@@ -99,21 +99,23 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
} else {
drawTexturedModalRect(guiWidth + 156, guiHeight + 6, 176 + 14, 14, 14, 14);
}
MekanismRenderHelper renderHelper = new MekanismRenderHelper();
for (int i = 0; i < slotPosMap.size(); i++) {
int x = slotPosMap.get(i).xPos;
int y = slotPosMap.get(i).yPos;
SideData data = configurable.getConfig().getOutput(currentType, EnumFacing.byIndex(i));
if (data != TileComponentConfig.EMPTY) {
if (data.color != EnumColor.GREY) {
renderHelper.color(data.color);
boolean doColor = data.color != EnumColor.GREY;
if (doColor) {
GLSMHelper.INSTANCE.color(data.color);
}
if (xAxis >= x && xAxis <= x + 14 && yAxis >= y && yAxis <= y + 14) {
drawTexturedModalRect(guiWidth + x, guiHeight + y, 176, 0, 14, 14);
} else {
drawTexturedModalRect(guiWidth + x, guiHeight + y, 176, 14, 14, 14);
}
renderHelper.cleanup(); //As it is just color and no matrix we can reuse the same one rather than recreating it the next call around
if (doColor) {
GLSMHelper.INSTANCE.resetColor();
}
} else {
drawTexturedModalRect(guiWidth + x, guiHeight + y, 176, 28, 14, 14);
}