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

@@ -6,10 +6,10 @@ import java.util.Arrays;
import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.TileNetworkList;
import mekanism.client.gui.element.GuiScrollList;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.api.TileNetworkList;
import mekanism.common.inventory.container.ContainerSecurityDesk;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.security.ISecurityTile.SecurityMode;
@@ -91,10 +91,10 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
updateButtons();
trustedField.mouseClicked(mouseX, mouseY, button);
if (button == 0) {
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
if (tileEntity.frequency != null && tileEntity.ownerUUID != null && tileEntity.clientOwner
.equals(mc.player.getName())) {
int xAxis = mouseX - (width - xSize) / 2;
int yAxis = mouseY - (height - ySize) / 2;
//TODO: replace compare with uuid instead of clientOwner and player name
if (tileEntity.frequency != null && tileEntity.ownerUUID != null && tileEntity.clientOwner.equals(mc.player.getName())) {
if (xAxis >= 123 && xAxis <= 134 && yAxis >= 68 && yAxis <= 79) {
addTrusted(trustedField.getText());
trustedField.setText("");
@@ -167,14 +167,9 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String ownerText =
tileEntity.clientOwner != null ? (LangUtils.localize("gui.owner") + ": " + tileEntity.clientOwner)
: EnumColor.RED + LangUtils.localize("gui.noOwner");
fontRenderer
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
4, 0x404040);
fontRenderer
.drawString(ownerText, (xSize - 7) - fontRenderer.getStringWidth(ownerText), (ySize - 96) + 2, 0x404040);
String ownerText = tileEntity.clientOwner != null ? (LangUtils.localize("gui.owner") + ": " + tileEntity.clientOwner) : EnumColor.RED + LangUtils.localize("gui.noOwner");
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
fontRenderer.drawString(ownerText, xSize - 7 - fontRenderer.getStringWidth(ownerText), (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
String trusted = LangUtils.localize("gui.trustedPlayers");
fontRenderer.drawString(trusted, 74 - (fontRenderer.getStringWidth(trusted) / 2), 57, 0x787878);
@@ -184,11 +179,10 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
}
fontRenderer.drawString(security, 13, 103, 0x404040);
renderScaledText(LangUtils.localize("gui.add") + ":", 13, 70, 0x404040, 20);
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 (tileEntity.frequency != null && xAxis >= 146 && xAxis <= 162 && yAxis >= 59 && yAxis <= 75) {
displayTooltip(LangUtils.localize("gui.securityOverride") + ": " + LangUtils
.transOnOff(tileEntity.frequency.override), xAxis, yAxis);
displayTooltip(LangUtils.localize("gui.securityOverride") + ": " + LangUtils.transOnOff(tileEntity.frequency.override), xAxis, yAxis);
}
if (xAxis >= 13 && xAxis <= 53 && yAxis >= 113 && yAxis <= 129) {
displayTooltip(LangUtils.localize("gui.publicMode"), xAxis, yAxis);
@@ -209,12 +203,11 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
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);
if (tileEntity.frequency != null && tileEntity.clientOwner != null && mc.player.getName()
.equals(tileEntity.clientOwner)) {
drawTexturedModalRect(guiWidth + 145, guiHeight + 78, xSize + (tileEntity.frequency.override ? 0 : 6), 22,
6, 6);
int xAxis = mouseX - (width - xSize) / 2;
int yAxis = mouseY - (height - ySize) / 2;
//TODO: replace compare with uuid instead of clientOwner and player name
if (tileEntity.frequency != null && tileEntity.clientOwner != null && mc.player.getName().equals(tileEntity.clientOwner)) {
drawTexturedModalRect(guiWidth + 145, guiHeight + 78, xSize + (tileEntity.frequency.override ? 0 : 6), 22, 6, 6);
if (xAxis >= 146 && xAxis <= 162 && yAxis >= 59 && yAxis <= 75) {
drawTexturedModalRect(guiWidth + 146, guiHeight + 59, xSize + 12, 0, 16, 16);
} else {