mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +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
@@ -58,8 +58,8 @@ public class GuiTransporterConfig 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 + 14, 0, 14, 14);
|
||||
} else {
|
||||
@@ -76,7 +76,7 @@ public class GuiTransporterConfig extends GuiMekanismTile<TileEntityContainerBlo
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
EnumColor color = configurable.getEjector().getInputColor(EnumFacing.byIndex(i));
|
||||
if (configurable.getConfig().getOutput(TransmissionType.ITEM, EnumFacing.byIndex(i))
|
||||
!= TileComponentConfig.EMPTY) {
|
||||
!= TileComponentConfig.EMPTY) {
|
||||
if (color != null) {
|
||||
MekanismRenderer.color(color);
|
||||
}
|
||||
@@ -96,8 +96,7 @@ public class GuiTransporterConfig extends GuiMekanismTile<TileEntityContainerBlo
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String text = LangUtils.localize("gui.configuration.transporter");
|
||||
fontRenderer.drawString(text, (xSize / 2) - (fontRenderer.getStringWidth(text) / 2), 5, 0x404040);
|
||||
text = LangUtils.localize("gui.strictInput") + " (" + LangUtils
|
||||
.transOnOff(configurable.getEjector().hasStrictInput()) + ")";
|
||||
text = LangUtils.localize("gui.strictInput") + " (" + LangUtils.transOnOff(configurable.getEjector().hasStrictInput()) + ")";
|
||||
renderScaledText(text, 53, 17, 0x00CD00, 70);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.input"), 48, 81, 0x787878);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.output"), 114, 68, 0x787878);
|
||||
@@ -107,22 +106,20 @@ public class GuiTransporterConfig extends GuiMekanismTile<TileEntityContainerBlo
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
drawTexturedRectFromIcon(122, 49, MekanismRenderer.getColorIcon(configurable.getEjector().getOutputColor()),
|
||||
16, 16);
|
||||
drawTexturedRectFromIcon(122, 49, MekanismRenderer.getColorIcon(configurable.getEjector().getOutputColor()), 16, 16);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
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;
|
||||
EnumColor color = configurable.getEjector().getInputColor(EnumFacing.byIndex(i));
|
||||
if (configurable.getConfig().getOutput(TransmissionType.ITEM, EnumFacing.byIndex(i))
|
||||
!= TileComponentConfig.EMPTY) {
|
||||
!= TileComponentConfig.EMPTY) {
|
||||
if (xAxis >= x && xAxis <= x + 14 && yAxis >= y && yAxis <= y + 14) {
|
||||
drawHoveringText(color != null ? color.getColoredName() : LangUtils.localize("gui.none"), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(color != null ? color.getColoredName() : LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,8 +139,8 @@ public class GuiTransporterConfig 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) {
|
||||
@@ -153,8 +150,7 @@ public class GuiTransporterConfig extends GuiMekanismTile<TileEntityContainerBlo
|
||||
}
|
||||
if (xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new ConfigurationUpdateMessage(ConfigurationPacket.STRICT_INPUT, Coord4D.get(tile), 0, 0, null));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.STRICT_INPUT, Coord4D.get(tile), 0, 0, null));
|
||||
}
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) {
|
||||
@@ -162,17 +158,14 @@ public class GuiTransporterConfig extends GuiMekanismTile<TileEntityContainerBlo
|
||||
}
|
||||
if (xAxis >= 122 && xAxis <= 138 && yAxis >= 49 && yAxis <= 65) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new ConfigurationUpdateMessage(ConfigurationPacket.EJECT_COLOR, Coord4D.get(tile), button, 0, null));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT_COLOR, Coord4D.get(tile), button, 0, null));
|
||||
}
|
||||
for (int i = 0; i < slotPosMap.size(); i++) {
|
||||
int x = slotPosMap.get(i).xPos;
|
||||
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.INPUT_COLOR, Coord4D.get(tile), button, i,
|
||||
null));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.INPUT_COLOR, Coord4D.get(tile), button, i, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user