diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-08-26 15:45:26 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-08-26 15:45:26 +1000 |
commit | d8068556c49aee29368be0955228e4b937f761de (patch) | |
tree | 22f5b3bc3f58411e63a4cc010496ece0927b0b5a /src/Java/gtPlusPlus/xmod/gregtech/api | |
parent | 5fc4bb0b2c75e156fc1ab896b6a4fbd0dd7ec747 (diff) | |
download | GT5-Unofficial-d8068556c49aee29368be0955228e4b937f761de.tar.gz GT5-Unofficial-d8068556c49aee29368be0955228e4b937f761de.tar.bz2 GT5-Unofficial-d8068556c49aee29368be0955228e4b937f761de.zip |
+ Added new GUIs for more multiblocks.
% Rewrote the way multiblocks in GT++ handle GUIs, to allow for more flexibility.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
3 files changed, 117 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java index ff75ff3ca8..a3f48ffd30 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java @@ -4,7 +4,7 @@ import net.minecraft.entity.player.InventoryPlayer; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - +import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_MassFabricator; /** @@ -24,11 +24,10 @@ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } -} -/*@Override + @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); + addSlotToContainer(new SlotNoInput(mTileEntity, 1, 152, 5)); } @Override @@ -40,4 +39,4 @@ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { public int getShiftClickSlotCount() { return 0; } -}*/ +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Multi_Basic_Slotted.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Multi_Basic_Slotted.java new file mode 100644 index 0000000000..9d38295d4e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Multi_Basic_Slotted.java @@ -0,0 +1,96 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_Container_MultiMachine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class GUI_Multi_Basic_Slotted extends GT_GUIContainerMetaTile_Machine { + String mName = ""; + + public GUI_Multi_Basic_Slotted(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile) { + super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + this.mName = aName; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); + if (this.mContainer != null) { + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0) { + this.fontRendererObj.drawString(this.trans("132", "Pipe is loose."), 10, 16, 16448255); + } + + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0) { + this.fontRendererObj.drawString(this.trans("133", "Screws are missing."), 10, 24, 16448255); + } + + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0) { + this.fontRendererObj.drawString(this.trans("134", "Something is stuck."), 10, 32, 16448255); + } + + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0) { + this.fontRendererObj.drawString(this.trans("135", "Platings are dented."), 10, 40, 16448255); + } + + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0) { + this.fontRendererObj.drawString(this.trans("136", "Circuitry burned out."), 10, 48, 16448255); + } + + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0) { + this.fontRendererObj.drawString(this.trans("137", "That doesn\'t belong there."), 10, 56, 16448255); + } + + if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString(this.trans("138", "Incomplete Structure."), 10, 64, 16448255); + } + + if (((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { + if (((GT_Container_MultiMachine) this.mContainer).mActive == 0) { + this.fontRendererObj.drawString(this.trans("139", "Hit with Soft Hammer"), 10, 16, 16448255); + this.fontRendererObj.drawString(this.trans("140", "to (re-)start the Machine"), 10, 24, 16448255); + this.fontRendererObj.drawString(this.trans("141", "if it doesn\'t start."), 10, 32, 16448255); + } else { + this.fontRendererObj.drawString(this.trans("142", "Running perfectly."), 10, 16, 16448255); + } + + ItemStack tItem; + if (this.mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DrillerBase) { + tItem = this.mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); + if (tItem == null + || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { + this.fontRendererObj.drawString(this.trans("143", "Missing Mining Pipe"), 10, + ((GT_Container_MultiMachine) this.mContainer).mActive == 0 ? 40 : 24, 16448255); + } + } else if (this.mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { + tItem = this.mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); + if (tItem == null || tItem.getItem() != GT_MetaGenerated_Tool_01.INSTANCE + || tItem.getItemDamage() < 170 || tItem.getItemDamage() > 177) { + this.fontRendererObj.drawString(this.trans("144", "Missing Turbine Rotor"), 10, + ((GT_Container_MultiMachine) this.mContainer).mActive == 0 ? 40 : 24, 16448255); + } + } + } + } + + } + + public String trans(String aKey, String aEnglish) { + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + } + + 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); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index d046ff48f8..7a26e695ab 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -39,6 +39,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.gui.GUI_Multi_Basic_Slotted; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import net.minecraft.entity.player.EntityPlayer; @@ -89,14 +90,28 @@ GT_MetaTileEntity_MultiBlockBase { return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); } } + + public abstract String getCustomGUIResourceName(); + + public boolean requiresVanillaGtGUI() { + return false; + } @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + String aCustomGUI = getCustomGUIResourceName(); + aCustomGUI = aCustomGUI != null ? aCustomGUI : "MultiblockDisplay"; + aCustomGUI = aCustomGUI + ".png"; if (hasSlotInGUI()) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + if (!requiresVanillaGtGUI()) { + return new GUI_Multi_Basic_Slotted(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); + } + else { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); + } } else { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); } } |