mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Formatting and code readability cleanup (#5467)
* First pass reformatting code to be more readable (common still not done) * Replace google common collect calls with Java calls where possible * Remove a bunch of unnecessary parenthesis leaving clarifying ones * Add some missing @Nonnull annotations * Fix checking wrong type * Remove unnecessary continue/return statements and simplify comparision check * Pass exception instead of directly printing stack trace * Work on cleaning up common, through config so far * Work on cleaning up common, through integration so far * Work on cleaning up common, through network so far * Work on cleaning up common, through tier so far * Remove empty constructors that get created by default anyways * Work on cleaning up common, through transmitters so far * Work on cleaning up common, through utils so far * Finish cleaning up spacing for common
This commit is contained in:
1 parent
91ef2a5c3d
commit
0d4b50908f
909 files changed
+6234
-15623
No files matched your search
@@ -3,7 +3,9 @@ package mekanism.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiRecipeType;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
@@ -15,13 +17,12 @@ import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.tier.FactoryTier;
|
||||
import mekanism.common.base.IFactory.MachineFuelType;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerFactory;
|
||||
import mekanism.common.item.ItemGaugeDropper;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tier.FactoryTier;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
@@ -52,32 +53,26 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.lastUsage);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
4, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 93) + 2, 0x404040);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69) {
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 8 && xAxis <= 168 && yAxis >= 78 && yAxis <= 83) {
|
||||
if (tileEntity.getRecipeType().getFuelType() == MachineFuelType.ADVANCED) {
|
||||
drawHoveringText(
|
||||
tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName()
|
||||
+ ": " + tileEntity.gasTank.getStored() : LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
GasStack gasStack = tileEntity.gasTank.getGas();
|
||||
drawHoveringText(gasStack != null ? gasStack.getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
} else if (tileEntity.getRecipeType() == RecipeType.INFUSING) {
|
||||
drawHoveringText(
|
||||
tileEntity.infuseStored.getType() != null ? tileEntity.infuseStored.getType().getLocalizedName() + ": "
|
||||
+ tileEntity.infuseStored.getAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
InfuseType type = tileEntity.infuseStored.getType();
|
||||
drawHoveringText(type != null ? type.getLocalizedName() + ": " + tileEntity.infuseStored.getAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
@@ -92,8 +87,8 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
int xOffset = tileEntity.tier == FactoryTier.BASIC ? 59 : (tileEntity.tier == FactoryTier.ADVANCED ? 39 : 33);
|
||||
int xDistance = tileEntity.tier == FactoryTier.BASIC ? 38 : (tileEntity.tier == FactoryTier.ADVANCED ? 26 : 19);
|
||||
int xOffset = tileEntity.tier == FactoryTier.BASIC ? 59 : tileEntity.tier == FactoryTier.ADVANCED ? 39 : 33;
|
||||
int xDistance = tileEntity.tier == FactoryTier.BASIC ? 38 : tileEntity.tier == FactoryTier.ADVANCED ? 26 : 19;
|
||||
|
||||
for (int i = 0; i < tileEntity.tier.processes; i++) {
|
||||
int xPos = xOffset + (i * xDistance);
|
||||
@@ -135,8 +130,8 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
protected void mouseClicked(int x, int y, int button) throws IOException {
|
||||
super.mouseClicked(x, y, button);
|
||||
if (button == 0 || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
int xAxis = x - (width - xSize) / 2;
|
||||
int yAxis = y - (height - ySize) / 2;
|
||||
if (xAxis > 8 && xAxis < 168 && yAxis > 78 && yAxis < 83) {
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper) {
|
||||
|
||||
Reference in new issue
Block a user