Induction matrix optimization (#5462)

* Initial work improving performance of Induction Matrix

* Have the MatrixData handle more things internally

* Internalize more logic in MatrixData

* Cleanup readability of two methods

* Initial work at queueing energy addition/removal to the matrix. Allows for only reading/writing to the cells once per tick instead of potentially multiple times.

* Streamline the energy queuing, add some comments about it, and fix some backwards logic

* Improvements to bounds by allowing passing the simulation variable
Makes the code cleaner to read

* Better handling if something passes a negative value to add/remove

* Cleanup UpdateProtocol loopThrough method

* Minor cleanup/spacing of UpdateProtocol. Also save queued matrix energy when structure gets destroyed.

* Minor cleanup/spacing of various update protocols to improve readability

* Minorly improve readability of TileEntityMultiblock

* Remove some TODO's as it already properly handles removing/adding cells

* Fix creative energy cube output limit

* Fix having added extra parenthesis in merge

* Add basic comparator support for Induction Port

* Cleanup the variables slightly
This commit is contained in:
Richard Freimer authored and GitHub committed 2019-05-20 10:03:10 -04:00
1 parent c8d2fbbac8
commit 2809912037
17 files changed
+730 -721

No files matched your search

@@ -24,8 +24,8 @@ public class GuiInductionMatrix extends GuiMekanismTile<TileEntityInductionCasin
ResourceLocation resource = getGuiLocation();
addGuiElement(new GuiMatrixTab(this, tileEntity, MatrixTab.STAT, 6, resource));
addGuiElement(new GuiEnergyInfo(() -> Arrays.asList(LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t",
LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t"), this, resource));
LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.getLastInput()) + "/t",
LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.getLastOutput()) + "/t"), this, resource));
}
@Override
@@ -33,9 +33,9 @@ public class GuiInductionMatrix extends GuiMekanismTile<TileEntityInductionCasin
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
fontRenderer.drawString(LangUtils.localize("gui.input") + ":", 53, 26, 0x00CD00);
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t", 53, 35, 0x00CD00);
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.getLastInput()) + "/t", 53, 35, 0x00CD00);
fontRenderer.drawString(LangUtils.localize("gui.output") + ":", 53, 44, 0x00CD00);
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t", 53, 53, 0x00CD00);
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.getLastOutput()) + "/t", 53, 53, 0x00CD00);
int xAxis = mouseX - (width - xSize) / 2;
int yAxis = mouseY - (height - ySize) / 2;
if (xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72) {
@@ -76,7 +76,6 @@ public class GuiInductionMatrix extends GuiMekanismTile<TileEntityInductionCasin
renderRemaining = scale;
scale = 0;
}
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, MekanismRenderer.energyIcon, 16, renderRemaining);
start += 16;