diff options
| author | miozune <miozune@gmail.com> | 2022-12-02 19:50:23 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-02 11:50:23 +0100 |
| commit | fd6750ad7c16c749db5ce30b63fb8518e62b3cb7 (patch) | |
| tree | 149178b9beceef86a7634be8a39c571f9d2529e4 /src | |
| parent | cbd693f6a29a3c1b2d056cd23f47b610d96c2b34 (diff) | |
| download | GT5-Unofficial-fd6750ad7c16c749db5ce30b63fb8518e62b3cb7.tar.gz GT5-Unofficial-fd6750ad7c16c749db5ce30b63fb8518e62b3cb7.tar.bz2 GT5-Unofficial-fd6750ad7c16c749db5ce30b63fb8518e62b3cb7.zip | |
Rewrite GUIs with ModularUI (#239)
* port most of the radio hatch to modularuii
* be done with this radio hatch. fuck colors
* radio hatch right bar color woooo
* spotless hell
* final color fix ffs
* a bit of tweak
* NEI
* Windmill
* LESU
* cleanup
* Water Pump, Destructopack, cleanup
* Circuit Programmer, Radiation Shutter
* Use new MUI method for setOnScrollNumbers
Co-authored-by: BlueWeabo <76872108+BlueWeabo@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Former-commit-id: a717aa0117091559dd00bc0a10e54db2025979fc
Diffstat (limited to 'src')
72 files changed, 727 insertions, 1892 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/ITileWithGUI.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/ITileWithGUI.java deleted file mode 100644 index 38b762fa9a..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/ITileWithGUI.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.API; - -import com.github.bartimaeusnek.bartworks.MainMod; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; - -public interface ITileWithGUI { - - /** - * @return the ID of the GUI, see @link com.github.bartimaeusnek.bartworks.GuiHandler - */ - int getGUIID(); - - /** - * gets called from BW_TileEntityContainer(or _Multiple) when right clicked. - * - * @param tileEntity this tile entity - * @param player the player right clicking it - * @return true always. - */ - default boolean openGUI(TileEntity tileEntity, EntityPlayer player) { - if (!tileEntity.getWorldObj().isRemote) - player.openGui( - MainMod.MOD_ID, - getGUIID(), - tileEntity.getWorldObj(), - tileEntity.xCoord, - tileEntity.yCoord, - tileEntity.zCoord); - return true; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/modularUI/BW_UITextures.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/modularUI/BW_UITextures.java new file mode 100644 index 0000000000..86d9d2c0b8 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/modularUI/BW_UITextures.java @@ -0,0 +1,56 @@ +package com.github.bartimaeusnek.bartworks.API.modularUI; + +import static com.github.bartimaeusnek.bartworks.MainMod.MOD_ID; + +import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +public class BW_UITextures { + + public static final AdaptableUITexture BACKGROUND_BROWN = + AdaptableUITexture.of(MOD_ID, "GUI/background/brown", 176, 166, 3); + public static final UITexture BACKGROUND_CIRCUIT_PROGRAMMER = + UITexture.fullImage(MOD_ID, "GUI/background/circuit_programmer"); + + public static final AdaptableUITexture SLOT_BROWN = AdaptableUITexture.of(MOD_ID, "GUI/slot/brown", 18, 18, 1); + + public static final UITexture OVERLAY_SLOT_DISH = UITexture.fullImage(MOD_ID, "GUI/overlay_slot/dish"); + public static final UITexture OVERLAY_SLOT_DNA_FLASK = UITexture.fullImage(MOD_ID, "GUI/overlay_slot/dna_flask"); + public static final UITexture OVERLAY_SLOT_MODULE = UITexture.fullImage(MOD_ID, "GUI/overlay_slot/module"); + public static final UITexture OVERLAY_SLOT_ROD = UITexture.fullImage(MOD_ID, "GUI/overlay_slot/rod"); + public static final UITexture OVERLAY_SLOT_CROSS = UITexture.fullImage(MOD_ID, "GUI/overlay_slot/cross"); + + public static final UITexture PROGRESSBAR_SIEVERT = UITexture.fullImage(MOD_ID, "GUI/progressbar/sievert"); + public static final UITexture PROGRESSBAR_STORED_EU_116 = + UITexture.fullImage(MOD_ID, "GUI/progressbar/stored_eu_116"); + public static final UITexture PROGRESSBAR_FUEL = UITexture.fullImage(MOD_ID, "GUI/progressbar/fuel"); + + public static final UITexture PICTURE_BW_LOGO_47X21 = UITexture.fullImage(MOD_ID, "GUI/picture/bw_logo_47x21"); + public static final UITexture PICTURE_SIEVERT_CONTAINER = + UITexture.fullImage(MOD_ID, "GUI/picture/sievert_container"); + public static final UITexture PICTURE_DECAY_TIME_CONTAINER = + UITexture.fullImage(MOD_ID, "GUI/picture/decay_time_container"); + public static final UITexture PICTURE_DECAY_TIME_INSIDE = + UITexture.fullImage(MOD_ID, "GUI/picture/decay_time_inside"); + public static final UITexture PICTURE_RADIATION = UITexture.fullImage(MOD_ID, "GUI/picture/radiation"); + public static final UITexture PICTURE_WINDMILL_EMPTY = UITexture.fullImage(MOD_ID, "GUI/picture/windmill_empty"); + public static final UITexture[] PICTURE_WINDMILL_ROTATING = IntStream.range(0, 4) + .mapToObj(i -> + UITexture.partly(MOD_ID, "GUI/picture/windmill_rotating", 32, 128, 0, i * 32, 32, (i + 1) * 32)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture PICTURE_STORED_EU_FRAME = UITexture.fullImage(MOD_ID, "GUI/picture/stored_eu_frame"); + public static final UITexture PICTURE_RADIATION_SHUTTER_FRAME = + UITexture.fullImage(MOD_ID, "GUI/picture/radiation_shutter_frame"); + public static final AdaptableUITexture PICTURE_RADIATION_SHUTTER_INSIDE = + AdaptableUITexture.of(MOD_ID, "GUI/picture/radiation_shutter_inside", 51, 48, 1); + + public static final AdaptableUITexture TAB_TITLE_BROWN = + AdaptableUITexture.of(MOD_ID, "GUI/tab/title_brown", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_DARK_BROWN = + AdaptableUITexture.of(MOD_ID, "GUI/tab/title_dark_brown", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_ANGULAR_BROWN = + AdaptableUITexture.of(MOD_ID, "GUI/tab/title_angular_brown", 28, 28, 4); +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java index d074e32c53..28dbaf5250 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java @@ -23,17 +23,7 @@ package com.github.bartimaeusnek.bartworks; import com.github.bartimaeusnek.bartworks.API.SideReference; -import com.github.bartimaeusnek.bartworks.client.gui.BW_GUIContainer_HeatedWaterPump; -import com.github.bartimaeusnek.bartworks.client.gui.BW_GUIContainer_RadLevel; -import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_CircuitProgrammer; -import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_Destructopack; -import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_TileEntity_HeatedWaterPump; -import com.github.bartimaeusnek.bartworks.server.container.BW_Container_HeatedWaterPump; -import com.github.bartimaeusnek.bartworks.server.container.BW_Container_RadioHatch; -import com.github.bartimaeusnek.bartworks.server.container.GT_Container_CircuitProgrammer; -import com.github.bartimaeusnek.bartworks.server.container.GT_Container_Item_Destructopack; import cpw.mods.fml.common.network.IGuiHandler; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -41,43 +31,12 @@ public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - switch (ID) { - case 0: - return new GT_Container_Item_Destructopack(player.inventory); - case 1: - return new GT_Container_CircuitProgrammer(player.inventory); - case 2: { - if (world.getTileEntity(x, y, z) instanceof IGregTechTileEntity) { - IGregTechTileEntity te = (IGregTechTileEntity) world.getTileEntity(x, y, z); - return new BW_Container_RadioHatch(player.inventory, te.getMetaTileEntity()); - } - } - case 3: - return new BW_Container_HeatedWaterPump( - (BW_TileEntity_HeatedWaterPump) world.getTileEntity(x, y, z), player); - } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (SideReference.Side.Client) { - switch (ID) { - case 0: - return new GT_GUIContainer_Destructopack(player.inventory); - case 1: - return new GT_GUIContainer_CircuitProgrammer(player.inventory); - case 2: { - if (world.getTileEntity(x, y, z) instanceof IGregTechTileEntity) { - IGregTechTileEntity te = (IGregTechTileEntity) world.getTileEntity(x, y, z); - return new BW_GUIContainer_RadLevel( - new BW_Container_RadioHatch(player.inventory, te.getMetaTileEntity())); - } - } - case 3: - return new BW_GUIContainer_HeatedWaterPump(new BW_Container_HeatedWaterPump( - (BW_TileEntity_HeatedWaterPump) world.getTileEntity(x, y, z), player)); - } } else return getServerGuiElement(ID, player, world, x, y, z); return null; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java deleted file mode 100644 index d92ed0012f..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.client.gui; - -import com.github.bartimaeusnek.bartworks.MainMod; -import com.github.bartimaeusnek.bartworks.server.container.BW_Container_HeatedWaterPump; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -public class BW_GUIContainer_HeatedWaterPump extends GuiContainer { - private static final ResourceLocation furnaceGuiTextures = - new ResourceLocation(MainMod.MOD_ID + ":textures/GUI/GUIheatedPump.png"); - final BW_Container_HeatedWaterPump container; - - public BW_GUIContainer_HeatedWaterPump(Container p_i1072_1_) { - super(p_i1072_1_); - this.container = (BW_Container_HeatedWaterPump) p_i1072_1_; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(BW_GUIContainer_HeatedWaterPump.furnaceGuiTextures); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - // this.drawString(this.fontRendererObj, "Fuel:" + container.fuel + " Water:" + container.water, k, l, - // 0xffffff); - - if (this.container.fuel > 0) { - this.mc.getTextureManager().bindTexture(BW_GUIContainer_HeatedWaterPump.furnaceGuiTextures); - int ik = Math.max(this.container.maxfuel, 200); - int i1 = ((this.container.fuel * 13) / ik); - this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 13 - i1, 14, i1 + 1); - } - - // if (this.container.water > 0){ - // this.mc.getTextureManager().bindTexture( new ResourceLocation("textures/blocks/water_still.png")); - // this.drawTexturedModalRect(k+85,l+32,32,32,18,18); - // } - - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java deleted file mode 100644 index 6d234b69dd..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.client.gui; - -import com.github.bartimaeusnek.bartworks.MainMod; -import com.github.bartimaeusnek.bartworks.server.container.BW_Container_RadioHatch; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class BW_GUIContainer_RadLevel extends GuiContainer { - final BW_Container_RadioHatch container; - - public BW_GUIContainer_RadLevel(Container p_i1072_1_) { - super(p_i1072_1_); - this.container = (BW_Container_RadioHatch) p_i1072_1_; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { - GL11.glColor3f(1, 1, 1); - this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUI_RSC.png")); - this.drawTexturedModalRect(this.guiLeft - 79, this.guiTop, 0, 0, 256, 165); - } - - @Override - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - int y = 51 + (this.container.coverage / 2 - 3); - int x = -63; - if (this.container.coverage != 100 && this.container.coverage != 0) - Gui.drawRect(x, y, x + 51, y + 1, 0xFF60D82E); - Gui.drawRect(x, 48, x + 51, y, 0xFF8B8B8B); - this.fontRendererObj.drawString(Byte.toString(this.container.coverage), 88 - 79, 50, 16448255); - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/c |
