aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator/client/GUI
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2022-12-12 15:15:43 +0900
committerGitHub <noreply@github.com>2022-12-12 07:15:43 +0100
commit271b177799b1d9ba7d66c575caf4b7bccd6b9357 (patch)
tree8eef75e928feaa3d6cddb0949921c3ef121be791 /src/main/java/goodgenerator/client/GUI
parent889d0fc3c5a1235aaac6df9be02d496078cfe44f (diff)
downloadGT5-Unofficial-271b177799b1d9ba7d66c575caf4b7bccd6b9357.tar.gz
GT5-Unofficial-271b177799b1d9ba7d66c575caf4b7bccd6b9357.tar.bz2
GT5-Unofficial-271b177799b1d9ba7d66c575caf4b7bccd6b9357.zip
Rewrite GUIs with ModularUI (#110)
Diffstat (limited to 'src/main/java/goodgenerator/client/GUI')
-rw-r--r--src/main/java/goodgenerator/client/GUI/GG_UITextures.java16
-rw-r--r--src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java35
-rw-r--r--src/main/java/goodgenerator/client/GUI/NeutronActivatorGUIClient.java43
-rw-r--r--src/main/java/goodgenerator/client/GUI/NeutronSensorGUIClient.java121
-rw-r--r--src/main/java/goodgenerator/client/GUI/YOTTankGUIClient.java44
5 files changed, 16 insertions, 243 deletions
diff --git a/src/main/java/goodgenerator/client/GUI/GG_UITextures.java b/src/main/java/goodgenerator/client/GUI/GG_UITextures.java
new file mode 100644
index 0000000000..260dc22185
--- /dev/null
+++ b/src/main/java/goodgenerator/client/GUI/GG_UITextures.java
@@ -0,0 +1,16 @@
+package goodgenerator.client.GUI;
+
+import com.gtnewhorizons.modularui.api.drawable.UITexture;
+
+public class GG_UITextures {
+
+ private static final String MODID = "goodgenerator";
+
+ public static final UITexture PICTURE_NAQUADAH_REACTOR = UITexture.fullImage(MODID, "gui/picture/naquadah_reactor");
+ public static final UITexture PICTURE_NEUTRON_ACTIVATOR =
+ UITexture.fullImage(MODID, "gui/picture/neutron_activator");
+ public static final UITexture PICTURE_EXTREME_HEAT_EXCHANGER =
+ UITexture.fullImage(MODID, "gui/picture/extreme_heat_exchanger");
+ public static final UITexture PICTURE_COMPONENT_ASSLINE =
+ UITexture.fullImage(MODID, "gui/picture/component_assline");
+}
diff --git a/src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java b/src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java
deleted file mode 100644
index 51899b09cd..0000000000
--- a/src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package goodgenerator.client.GUI;
-
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
-import goodgenerator.common.container.YOTTankGUIContainer;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.util.StatCollector;
-
-public class LargeFusionComputerGUIClient extends GT_GUIContainer_MultiMachineEM {
-
- public LargeFusionComputerGUIClient(
- InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) {
- super(new YOTTankGUIContainer(aInventoryPlayer, aTileEntity), aName, aTextureFile, true, true, true);
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- super.drawGuiContainerForegroundLayer(par1, par2);
- if (this.mContainer.mDisplayErrorCode == 0) {
- fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.LargeFusion.0") + " "
- + GT_Utility.formatNumbers(this.mContainer.mStorage) + " EU",
- 7,
- 40,
- 16448255);
- fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.LargeFusion.1") + " "
- + GT_Utility.formatNumbers(this.mContainer.mEnergy) + " EU",
- 7,
- 48,
- 16448255);
- }
- }
-}
diff --git a/src/main/java/goodgenerator/client/GUI/NeutronActivatorGUIClient.java b/src/main/java/goodgenerator/client/GUI/NeutronActivatorGUIClient.java
deleted file mode 100644
index 1bd0b09f99..0000000000
--- a/src/main/java/goodgenerator/client/GUI/NeutronActivatorGUIClient.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package goodgenerator.client.GUI;
-
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import goodgenerator.common.container.NeutronActivatorGUIContainer;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.util.StatCollector;
-
-@SideOnly(Side.CLIENT)
-public class NeutronActivatorGUIClient extends GT_GUIContainer_MultiMachineEM {
-
- private final NeutronActivatorGUIContainer containerNeutronActivator;
-
- public NeutronActivatorGUIClient(
- InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) {
- super(new NeutronActivatorGUIContainer(aInventoryPlayer, aTileEntity), aName, aTextureFile, true, true, true);
- containerNeutronActivator = (NeutronActivatorGUIContainer) this.mContainer;
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- super.drawGuiContainerForegroundLayer(par1, par2);
- if (this.mContainer.mDisplayErrorCode == 0) {
- fontRendererObj.drawString(StatCollector.translateToLocal("gui.NeutronActivator.0"), 7, 40, 16448255);
- fontRendererObj.drawString(processNumber(containerNeutronActivator.getKineticE()) + "eV", 7, 48, 16448255);
- }
- }
-
- protected String processNumber(int num) {
- float num2;
- num2 = ((float) num) / 1000F;
- if (num2 <= 0) {
- return String.format("%d", num);
- }
- if (num2 < 1000.0) {
- return String.format("%.1fK", num2);
- }
- num2 /= 1000F;
- return String.format("%.1fM", num2);
- }
-}
diff --git a/src/main/java/goodgenerator/client/GUI/NeutronSensorGUIClient.java b/src/main/java/goodgenerator/client/GUI/NeutronSensorGUIClient.java
deleted file mode 100644
index b2ddd6b04a..0000000000
--- a/src/main/java/goodgenerator/client/GUI/NeutronSensorGUIClient.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package goodgenerator.client.GUI;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import goodgenerator.main.GoodGenerator;
-import goodgenerator.network.MessageSetNeutronSensorData;
-import goodgenerator.util.CharExchanger;
-import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import net.minecraft.client.gui.GuiTextField;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
-
-@SideOnly(Side.CLIENT)
-public class NeutronSensorGUIClient extends GT_GUIContainerMetaTile_Machine {
-
- protected final String mName;
-
- private GuiTextField TextBox;
- private String context;
-
- public NeutronSensorGUIClient(
- InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTexture, String text) {
- super(aInventoryPlayer, aTileEntity, aTexture);
- this.mName = "Neutron Sensor";
- this.mContainer.detectAndSendChanges();
- if (text == null) this.context = "";
- else this.context = text;
- }
-
- public void initGui() {
- super.initGui();
- this.TextBox = new GuiTextField(this.fontRendererObj, 8, 48, 100, 18);
- TextBox.setMaxStringLength(20);
- TextBox.setText(context);
- this.TextBox.setFocused(true);
- }
-
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- this.fontRendererObj.drawString(this.mName, 8, 4, 4210752);
- this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.NeutronSensor.0"), 8, 16, 0x000000);
- this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.NeutronSensor.1"), 8, 28, 0x000000);
- this.TextBox.drawTextBox();
- if (TextBox.getText() != null) {
- if (isValidSuffix(TextBox.getText())) {
- if (CharExchanger.isValidCompareExpress(rawProcessExp(TextBox.getText())))
- this.fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.NeutronSensor.2"), 120, 53, 0x077d02);
- else
- this.fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.NeutronSensor.3"), 120, 53, 0xff0000);
- } else
- this.fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.NeutronSensor.3"), 120, 53, 0xff0000);
- }
- this.mc
- .getTextureManager()
- .bindTexture(new ResourceLocation(GoodGenerator.MOD_ID + ":textures/gui/NeutronSensorGUI.png"));
- }
-
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
- super.drawGuiContainerBackgroundLayer(par1, par2, par3);
- int x = (this.width - this.xSize) / 2;
- int y = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
- }
-
- protected void keyTyped(char par1, int par2) {
- if (!this.TextBox.isFocused()) super.keyTyped(par1, par2);
- if (par2 == 1) this.mc.thePlayer.closeScreen();
- this.TextBox.textboxKeyTyped(par1, par2);
- }
-
- public void updateScreen() {
- super.updateScreen();
- this.TextBox.updateCursorCounter();
- }
-
- protected void mouseClicked(int x, int y, int btn) {
- super.mouseClicked(x, y, btn);
- this.TextBox.mouseClicked(x - this.getLeft(), y - this.getTop(), btn);
- }
-
- @Override
- public void onGuiClosed() {
- if (CharExchanger.isValidCompareExpress(rawProcessExp(TextBox.getText())))
- GoodGenerator.CHANNEL.sendToServer(
- new MessageSetNeutronSensorData(mContainer.mTileEntity, TextBox.getText()));
- super.onGuiClosed();
- }
-
- protected String rawProcessExp(String exp) {
- StringBuilder ret = new StringBuilder();
- for (char c : exp.toCharArray()) {
- if (exp.length() - ret.length() == 3) {
- if (Character.isDigit(c)) ret.append(c);
- break;
- }
- ret.append(c);
- }
- return ret.toString();
- }
-
- protected boolean isValidSuffix(String exp) {
- int index;
- index = exp.length() - 1;
- if (index < 0) return false;
- if (exp.charAt(index) != 'V' && exp.charAt(index) != 'v') return false;
- index = exp.length() - 2;
- if (index < 0) return false;
- if (exp.charAt(index) != 'E' && exp.charAt(index) != 'e') return false;
- index = exp.length() - 3;
- if (index < 0) return false;
- return exp.charAt(index) == 'M'
- || exp.charAt(index) == 'm'
- || exp.charAt(index) == 'K'
- || exp.charAt(index) == 'k'
- || Character.isDigit(exp.charAt(index));
- }
-}
diff --git a/src/main/java/goodgenerator/client/GUI/YOTTankGUIClient.java b/src/main/java/goodgenerator/client/GUI/YOTTankGUIClient.java
deleted file mode 100644
index e4a93fb6e2..0000000000
--- a/src/main/java/goodgenerator/client/GUI/YOTTankGUIClient.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package goodgenerator.client.GUI;
-
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
-import goodgenerator.common.container.YOTTankGUIContainer;
-import goodgenerator.util.CharExchanger;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.util.StatCollector;
-
-public class YOTTankGUIClient extends GT_GUIContainer_MultiMachineEM {
-
- private final YOTTankGUIContainer containerYOTTank;
-
- public YOTTankGUIClient(
- InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) {
- super(new YOTTankGUIContainer(aInventoryPlayer, aTileEntity), aName, aTextureFile, true, true, true);
- containerYOTTank = (YOTTankGUIContainer) this.mContainer;
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- super.drawGuiContainerForegroundLayer(par1, par2);
- if (this.mContainer.mDisplayErrorCode == 0) {
- fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.YOTTank.0") + " "
- + CharExchanger.formatNumber(containerYOTTank.getCap()) + " L",
- 7,
- 40,
- 16448255);
- fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.YOTTank.1") + " "
- + CharExchanger.formatNumber(containerYOTTank.getFluidName()),
- 7,
- 48,
- 16448255);
- fontRendererObj.drawString(
- StatCollector.translateToLocal("gui.YOTTank.2") + " "
- + CharExchanger.formatNumber(containerYOTTank.getStorage()) + " L",
- 7,
- 56,
- 16448255);
- }
- }
-}