diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-07 02:03:46 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-07 02:03:46 +1000 |
commit | 676a51a4c93713b3498508e13fae0869045f6f49 (patch) | |
tree | ac08d69405c23baadbcc37e9103153f6c06b1324 /src/Java/gtPlusPlus/xmod/gregtech/api | |
parent | 8c6406887cbe6b2d27cead77c6605639d73012ef (diff) | |
download | GT5-Unofficial-676a51a4c93713b3498508e13fae0869045f6f49.tar.gz GT5-Unofficial-676a51a4c93713b3498508e13fae0869045f6f49.tar.bz2 GT5-Unofficial-676a51a4c93713b3498508e13fae0869045f6f49.zip |
+ Added the Bronze and Advanced Work benches from GT4, still hell buggy but a WIP.
// Temporarily added Workbench registration to the Tiered Tanks Loader.
% Added some logging to the Plate Generation.
$ Fixed getTexture() in BaseMetaTileEntityEx.java to now support all branches of Gregtech.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
5 files changed, 386 insertions, 1 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 6f492ef2b9..de0a72f484 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -122,7 +122,10 @@ public enum GregtechItemList implements GregtechItemContainer { Fluid_Cell_1L, Fluid_Cell_16L, Fluid_Cell_36L, Fluid_Cell_144L, //Multitank - Industrial_MultiTank, Industrial_MultiTankDense, Casing_MultitankExterior; + Industrial_MultiTank, Industrial_MultiTankDense, Casing_MultitankExterior, + + //Gt4 Workbenches + GT4_Workbench_Bronze, GT4_Workbench_Advanced; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java new file mode 100644 index 0000000000..bb7982afe3 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java @@ -0,0 +1,161 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class CONTAINER_AdvancedWorkbench +extends GT_ContainerMetaTile_Machine +{ + public CONTAINER_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) + { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) + { + addSlotToContainer(new Slot(this.mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 15, 62, 62)); + + addSlotToContainer(new Slot(this.mTileEntity, 16, 82, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 17, 100, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 18, 118, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 19, 136, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(this.mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(this.mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(this.mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(this.mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(this.mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(this.mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(this.mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 34, 154, 64)); + + addSlotToContainer(new Slot(this.mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 32, 136, 46, false, false, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) + { + if ((aSlotIndex < 21) || (aSlotIndex > 35)) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + if ((this.mTileEntity == null) || (this.mTileEntity.getMetaTileEntity() == null)) { + return null; + } + try + { + ItemStack tStack = ((Slot)this.inventorySlots.get(aSlotIndex)).getStack(); + if ((tStack != null) && (tStack.stackSize <= 0) && (!GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack()))) { + return null; + } + if (aSlotIndex == 32) + { + if ((aMouseclick == 0) && (aShifthold == 1)) + { + ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } + else + { + if (aSlotIndex == 33) + { + ItemStack tCraftedStack = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) + { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i = (byte)(i + 1)) { + for (byte j = 0; (j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); j = (byte)(j + 1)) + { + ItemStack tStack2; + if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) { + return aPlayer.inventory.getItemStack(); + } + aPlayer.inventory.mainInventory[i] = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i]); + } + } + } + else + { + if (aMouseclick == 0) + { + if (((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) { + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + for (int i = 0; (i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); i++) + { + ItemStack tStack2; + if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) { + return aPlayer.inventory.getItemStack(); + } + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + return null; + } + if (aSlotIndex == 34) + { + ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } + if (aSlotIndex == 35) + { + ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } + } + catch (Throwable e) + { + e.printStackTrace(GT_Log.err); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public int getSlotCount() + { + return 33; + } + + @Override + public int getShiftClickSlotCount() + { + return 21; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java new file mode 100644 index 0000000000..d093101044 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java @@ -0,0 +1,161 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class CONTAINER_BronzeWorkbench +extends GT_ContainerMetaTile_Machine +{ + public CONTAINER_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) + { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) + { + addSlotToContainer(new Slot(this.mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(this.mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 15, 62, 62)); + + addSlotToContainer(new Slot(this.mTileEntity, 16, 82, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 17, 100, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 18, 118, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 19, 136, 8)); + addSlotToContainer(new Slot(this.mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(this.mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(this.mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(this.mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(this.mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(this.mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(this.mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(this.mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 34, 154, 64)); + + addSlotToContainer(new Slot(this.mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 32, 136, 46, false, false, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) + { + if ((aSlotIndex < 21) || (aSlotIndex > 35)) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + if ((this.mTileEntity == null) || (this.mTileEntity.getMetaTileEntity() == null)) { + return null; + } + try + { + ItemStack tStack = ((Slot)this.inventorySlots.get(aSlotIndex)).getStack(); + if ((tStack != null) && (tStack.stackSize <= 0) && (!GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack()))) { + return null; + } + if (aSlotIndex == 32) + { + if ((aMouseclick == 0) && (aShifthold == 1)) + { + ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } + else + { + if (aSlotIndex == 33) + { + ItemStack tCraftedStack = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) + { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i = (byte)(i + 1)) { + for (byte j = 0; (j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); j = (byte)(j + 1)) + { + ItemStack tStack2; + if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) { + return aPlayer.inventory.getItemStack(); + } + aPlayer.inventory.mainInventory[i] = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i]); + } + } + } + else + { + if (aMouseclick == 0) + { + if (((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) { + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + for (int i = 0; (i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); i++) + { + ItemStack tStack2; + if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) { + return aPlayer.inventory.getItemStack(); + } + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + return null; + } + if (aSlotIndex == 34) + { + ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } + if (aSlotIndex == 35) + { + ((GT_MetaTileEntity_AdvancedCraftingTable)this.mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } + } + catch (Throwable e) + { + e.printStackTrace(GT_Log.err); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public int getSlotCount() + { + return 33; + } + + @Override + public int getShiftClickSlotCount() + { + return 21; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java new file mode 100644 index 0000000000..7da9238bd5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java @@ -0,0 +1,30 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_AdvancedWorkbench +extends GT_GUIContainerMetaTile_Machine +{ + public GUI_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) + { + super(new CONTAINER_AdvancedWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "AdvancedCraftingTable.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + //this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); + } + + @Override + 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; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java new file mode 100644 index 0000000000..597edba503 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java @@ -0,0 +1,30 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_BronzeWorkbench +extends GT_GUIContainerMetaTile_Machine +{ + public GUI_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) + { + super(new CONTAINER_BronzeWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "BronzeCraftingTable.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + //this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); + } + + @Override + 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; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} |