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:
Richard Freimer authored and GitHub committed 2019-05-11 14:13:24 -04:00
1 parent 91ef2a5c3d
commit 0d4b50908f
909 files changed
+6234 -15623

No files matched your search

@@ -89,8 +89,8 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
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 >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) {
drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176 + 28, 0, 14, 14);
} else {
@@ -127,23 +127,20 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
String title = currentType.localize() + " " + LangUtils.localize("gui.config");
fontRenderer.drawString(title, (xSize / 2) - (fontRenderer.getStringWidth(title) / 2), 5, 0x404040);
if (configurable.getConfig().canEject(currentType)) {
fontRenderer.drawString(
LangUtils.localize("gui.eject") + ": " + (configurable.getConfig().isEjecting(currentType) ? "On"
: "Off"), 53, 17, 0x00CD00);
fontRenderer.drawString(LangUtils.localize("gui.eject") + ": " + (configurable.getConfig().isEjecting(currentType) ? "On" : "Off"), 53, 17, 0x00CD00);
} else {
fontRenderer.drawString(LangUtils.localize("gui.noEject"), 53, 17, 0x00CD00);
}
fontRenderer.drawString(LangUtils.localize("gui.slots"), 77, 81, 0x787878);
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
int xAxis = mouseX - (width - xSize) / 2;
int yAxis = mouseY - (height - ySize) / 2;
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 (xAxis >= x && xAxis <= x + 14 && yAxis >= y && yAxis <= y + 14) {
drawHoveringText(data.color + data.localize() + " (" + data.color.getColoredName() + ")", xAxis,
yAxis);
drawHoveringText(data.color + data.localize() + " (" + data.color.getColoredName() + ")", xAxis, yAxis);
}
}
}
@@ -165,8 +162,8 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
@Override
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
super.mouseClicked(mouseX, mouseY, button);
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
int xAxis = mouseX - (width - xSize) / 2;
int yAxis = mouseY - (height - ySize) / 2;
TileEntity tile = (TileEntity) configurable;
if (button == 0) {
if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) {
@@ -176,8 +173,7 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
}
if (xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20) {
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
Mekanism.packetHandler.sendToServer(
new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0, currentType));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0, currentType));
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) {
@@ -188,9 +184,7 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
int y = slotPosMap.get(i).yPos;
if (xAxis >= x && xAxis <= x + 14 && yAxis >= y && yAxis <= y + 14) {
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
Mekanism.packetHandler.sendToServer(
new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i,
currentType));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i, currentType));
}
}
}