diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api')
38 files changed, 2816 insertions, 1620 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index a8ee2e24ad..7e81f1c514 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -105,6 +105,7 @@ public enum GregtechItemList implements GregtechItemContainer { //Computer Cube Gregtech_Computer_Cube, + Gregtech_Computer_Cube_Machine, //Casings for batteries Battery_Casing_Gem_1, Battery_Casing_Gem_2, @@ -301,7 +302,7 @@ public enum GregtechItemList implements GregtechItemContainer { //Tesla Tower - /*TelsaTower,*/ + TelsaTower, Casing_TeslaTower, @@ -334,7 +335,7 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Adv_DistillationTower, //Advanced Assembly Line - /*Machine_Adv_AssemblyLine,*/ + Machine_Adv_AssemblyLine, //Advanced Vacuum Freezer Industrial_Cryogenic_Freezer, @@ -363,13 +364,14 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Industrial_Arc_Furnace, //Solar Tower - /*Industrial_Solar_Tower,*/ + Industrial_Solar_Tower, Casing_SolarTower_Structural, Casing_SolarTower_SaltContainment, Casing_SolarTower_HeatContainment, //Larger Turbines - /*Large_Steam_Turbine, Large_HPSteam_Turbine, */ + Large_Steam_Turbine, Large_HPSteam_Turbine, + Large_Gas_Turbine, Large_Plasma_Turbine, Casing_Turbine_Shaft, Casing_Turbine_LP, Casing_Turbine_HP, Casing_Turbine_Gas, Casing_Turbine_Plasma, @@ -407,6 +409,16 @@ public enum GregtechItemList implements GregtechItemContainer { Controller_ElementalDuplicator, Casing_ElementalDuplicator, + // Forge Hammer + Controller_IndustrialForgeHammer, + Casing_IndustrialForgeHammer, + + // Molecular Transformer + Controller_MolecularTransformer, + Casing_Molecular_Transformer_1, + Casing_Molecular_Transformer_2, + Casing_Molecular_Transformer_3, + // Big Steam Macerator Controller_SteamMaceratorMulti, @@ -444,7 +456,7 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_Reservoir, //XL Turbine Rotor Hatch - /*Hatch_Turbine_Rotor,*/ + Hatch_Turbine_Rotor, //Standard Turbine Rotor Hatch Hatch_Input_TurbineHousing, @@ -500,12 +512,25 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_SuperBus_Output_MAX, - - //---------------------------------------------------------------------------- + /** + * Blocks + */ + + + ResonanceChamber_I, + ResonanceChamber_II, + ResonanceChamber_III, + ResonanceChamber_IV, + Modulator_I, + Modulator_II, + Modulator_III, + Modulator_IV, + + //---------------------------------------------------------------------------- /** @@ -528,10 +553,44 @@ public enum GregtechItemList implements GregtechItemContainer { //infinite Items Infinite_Item_Chest, + //GT4 Redstone + GT4_Redstone_Lamp, + GT4_Redstone_Button_Panel, + GT4_Redstone_Scale, + GT4_Redstone_Display, + GT4_Redstone_Circuit, //Gt4 Workbenches GT4_Workbench_Bronze, GT4_Workbench_Advanced, + + //GT4 automation + GT4_Electric_Auto_Workbench_LV, + GT4_Electric_Auto_Workbench_MV, + GT4_Electric_Auto_Workbench_HV, + GT4_Electric_Auto_Workbench_EV, + GT4_Electric_Auto_Workbench_IV, + GT4_Electric_Auto_Workbench_LuV, + GT4_Electric_Auto_Workbench_ZPM, + GT4_Electric_Auto_Workbench_UV, + GT4_Electric_Inventory_Manager_LV, + GT4_Electric_Inventory_Manager_MV, + GT4_Electric_Inventory_Manager_HV, + GT4_Electric_Inventory_Manager_EV, + GT4_Electric_Inventory_Manager_IV, + GT4_Electric_Inventory_Manager_LuV, + GT4_Electric_Inventory_Manager_ZPM, + GT4_Electric_Inventory_Manager_UV, + + //GT4 Crop Harvester + GT4_Crop_Harvester_LV, + GT4_Crop_Harvester_MV, + GT4_Crop_Harvester_HV, + GT4_Crop_Harvester_EV, + GT4_Crop_Harvester_IV, + GT4_Crop_Harvester_LuV, + GT4_Crop_Harvester_ZPM, + GT4_Crop_Harvester_UV, //Geothermal Engines @@ -573,7 +632,7 @@ public enum GregtechItemList implements GregtechItemContainer { SimpleDustWasher_UV, //Solar Tower Reflector - /*Solar_Tower_Reflector,*/ + Solar_Tower_Reflector, //Super Tier Chests Super_Chest_LV, Super_Chest_MV, Super_Chest_HV, Super_Chest_EV, Super_Chest_IV, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java new file mode 100644 index 0000000000..fe100955e0 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java @@ -0,0 +1,82 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.enums.ItemList; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine { + + public CONTAINER_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 0, 53, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 1, 71, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 2, 89, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 3, 107, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 4, 53, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 5, 71, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 6, 89, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 7, 107, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 8, 53, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 9, 71, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 10, 89, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 11, 107, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 12, 53, 62)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 13, 71, 62)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 14, 89, 62)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 15, 107, 62)); + addSlotToContainer(new SlotIntegratedCircuit(mTileEntity, 16, 19, 35)); + + } + + @Override + public int getSlotCount() { + return 17; + } + + @Override + public int getShiftClickSlotCount() { + return 0; + } + + @Override + public void putStackInSlot(int par1, ItemStack par2ItemStack) { + /*Logger.INFO("Slot: "+par1); + if (par1 < 16 && ItemList.Tool_DataOrb.isStackEqual(par2ItemStack)) { + super.putStackInSlot(par1, par2ItemStack); + } + if (par1 == 16 && ItemUtils.isControlCircuit(par2ItemStack)) { + super.putStackInSlot(par1, par2ItemStack); + }*/ + super.putStackInSlot(par1, par2ItemStack); + } + + @Override + public boolean canDragIntoSlot(Slot par1Slot) { + return super.canDragIntoSlot(par1Slot); + } + + public class GT_Slot_DataOrb extends Slot { + public GT_Slot_DataOrb(IInventory par1iInventory, int par2, int par3, int par4) { + super(par1iInventory, par2, par3, par4); + } + + @Override + public boolean isItemValid(ItemStack aStack) { + return ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); + } + } + + + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java index 937513751b..94cfa5236d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java @@ -1,34 +1,44 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.core.slots.SlotNoInput; - +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.*; public class CONTAINER_PowerSubStation extends GT_Container_MultiMachine { - + + public long mStoredEU; + public int mStoredEU1; + public int mStoredEU2; + public long mMaxStoredEU; + public int mMaxStoredEU1; + public int mMaxStoredEU2; + public long mAverageEuAdded; + public int mAverageEuAdded1; + public int mAverageEuAdded2; + public long mAverageEuConsumed; + public int mAverageEuConsumed1; + public int mAverageEuConsumed2; + public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } - public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { + public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } public void addSlots(final InventoryPlayer aInventoryPlayer) { this.addSlotToContainer(new Slot((IInventory) this.mTileEntity, 1, 155, 5)); this.addSlotToContainer(new SlotNoInput((IInventory) this.mTileEntity, 2, 155, 23)); - - for (int i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot((IInventory) aInventoryPlayer, i, 8 + i * 18, 167)); - } - + + for (int i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot((IInventory) aInventoryPlayer, i, 8 + i * 18, 167)); } + } public int getSlotCount() { @@ -38,4 +48,78 @@ public class CONTAINER_PowerSubStation extends GT_Container_MultiMachine { public int getShiftClickSlotCount() { return 1; } -}
\ No newline at end of file + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + + mStoredEU = mTileEntity.getStoredEU(); + mMaxStoredEU = mTileEntity.getEUCapacity(); + GregtechMetaTileEntity_PowerSubStationController aPSS = (GregtechMetaTileEntity_PowerSubStationController) mTileEntity.getMetaTileEntity(); + mAverageEuAdded = aPSS.getAverageEuAdded(); + mAverageEuConsumed = aPSS.getAverageEuConsumed(); + int[] aStored = MathUtils.splitLongIntoTwoIntegers(mStoredEU); + int[] aMaxStorage = MathUtils.splitLongIntoTwoIntegers(mMaxStoredEU); + int[] aAvgIn = MathUtils.splitLongIntoTwoIntegers(mAverageEuAdded); + int[] aAvgOut = MathUtils.splitLongIntoTwoIntegers(mAverageEuConsumed); + mStoredEU1 = aStored[0]; + mStoredEU2 = aStored[1]; + mMaxStoredEU1 = aMaxStorage[0]; + mMaxStoredEU2 = aMaxStorage[1]; + mAverageEuAdded1 = aAvgIn[0]; + mAverageEuAdded2 = aAvgIn[1]; + mAverageEuConsumed1 = aAvgOut[0]; + mAverageEuConsumed2 = aAvgOut[1]; + + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + if (mTimer % 20 == 0) { + var1.sendProgressBarUpdate(this, 21, mStoredEU1); + var1.sendProgressBarUpdate(this, 22, mStoredEU2); + var1.sendProgressBarUpdate(this, 23, mMaxStoredEU1); + var1.sendProgressBarUpdate(this, 24, mMaxStoredEU2); + var1.sendProgressBarUpdate(this, 25, mAverageEuAdded1); + var1.sendProgressBarUpdate(this, 26, mAverageEuAdded2); + var1.sendProgressBarUpdate(this, 27, mAverageEuConsumed1); + var1.sendProgressBarUpdate(this, 28, mAverageEuConsumed2); + } + } + + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 21 : + mStoredEU1 = par2; + break; + case 22 : + mStoredEU2 = par2; + mStoredEU = MathUtils.combineTwoIntegersToLong(mStoredEU1, mStoredEU2); + break; + case 23 : + mMaxStoredEU1 = par2; + break; + case 24 : + mMaxStoredEU2 = par2; + mMaxStoredEU = MathUtils.combineTwoIntegersToLong(mMaxStoredEU1, mMaxStoredEU2); + break; + case 25 : + mAverageEuAdded1 = par2; + break; + case 26 : + mAverageEuAdded2 = par2; + mAverageEuAdded = MathUtils.combineTwoIntegersToLong(mAverageEuAdded1, mAverageEuAdded2); + break; + case 27 : + mAverageEuConsumed1 = par2; + break; + case 28 : + mAverageEuConsumed2 = par2; + mAverageEuConsumed = MathUtils.combineTwoIntegersToLong(mAverageEuConsumed1, mAverageEuConsumed2); + break; + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java new file mode 100644 index 0000000000..77cb0d71a2 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java @@ -0,0 +1,41 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; + +public class GUI_DataHatch extends GT_GUIContainerMetaTile_Machine { + + private final String mName; + + public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { + super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "HatchDataOrb.png"); + mName = aName; + } + + public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "HatchDataOrb.png"); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(mName, 8, 4, 4210752); + /*String[] aName = mName.trim().split("\\s+"); + int aY = 4; + for (String s : aName) { + fontRendererObj.drawString(s, 120, (aY += 12), 4210752); + }*/ + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java index c78e7789b8..61cf59f6c9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java @@ -112,18 +112,32 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { mInfo.add(StatCollector.translateToLocal("GTPP.machines.output")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aOutputTier]); } + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ EnumChatFormatting.GREEN + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime/20) + EnumChatFormatting.RESET +" s / "+ EnumChatFormatting.YELLOW + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime/20) + EnumChatFormatting.RESET +" s"); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+ - EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" "+EU+" / "+ - EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" "+EU+""); + + + + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" EU")); if (aRecipeEU != 0 && aRecipeDuration > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+ - EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " "+EU+"/t"); + if (aRecipeEU > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " EU/t/parallel")); + } + else { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + " EU/t/parallel")); + } mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration")+": "+ EnumChatFormatting.RED + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks"); if (aRecipeSpecial > 0) { @@ -132,18 +146,16 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { } } - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+ - EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " "+EU+"/t"+EnumChatFormatting.RESET); - - mInfo.add(StatCollector.translateToLocal(StatCollector.translateToLocal("GTPP.machines.tier")+": "+ - EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET)); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ + EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET)); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ EnumChatFormatting.YELLOW+Float.toString(aEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + (aPollutionTick*20)+ EnumChatFormatting.RESET+"/sec"); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET+" %"); - mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); + //mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); mInfo.add("Total Time Since Built: "); mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks,"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java index 65ba8610dd..f8aaa1792d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java @@ -1,175 +1,126 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; - +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; public class GUI_PowerSubStation extends GT_GUIContainerMetaTile_Machine { public String mNEI; String mName; boolean[] mRepairStatus = new boolean[6]; - private static IIcon[] mGregToolIcons = new IIcon[6]; + + public final CONTAINER_PowerSubStation mPowerContainer; public GUI_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aNEI) { super(new CONTAINER_PowerSubStation(aInventoryPlayer, aTileEntity, false), CORE.RES_PATH_GUI + "PowerSubStation.png"); this.mName = aName; this.mNEI = aNEI; + mPowerContainer = (CONTAINER_PowerSubStation) mContainer; /** The X size of the inventory window in pixels. */ this.xSize = 196; /** The Y size of the inventory window in pixels. */ this.ySize = 191; - for (IIcon g : mGregToolIcons) { - if (g == null) { - getToolTextures(); - } - } - } - - private static final boolean getToolTextures() { - mGregToolIcons[0] = Textures.ItemIcons.WRENCH.getIcon(); - mGregToolIcons[1] = Textures.ItemIcons.HANDLE_SCREWDRIVER.getIcon(); - mGregToolIcons[2] = Textures.ItemIcons.MORTAR.getIcon(); - mGregToolIcons[3] = Textures.ItemIcons.JACKHAMMER.getIcon(); - mGregToolIcons[4] = Textures.ItemIcons.HANDLE_SOLDERING.getIcon(); - mGregToolIcons[5] = Textures.ItemIcons.CROWBAR.getIcon(); - return true; } protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); - if (this.mContainer != null) { + if (this.mPowerContainer != null) { + + //this.fontRendererObj.drawString("Error Code: " + mPowerContainer.mDisplayErrorCode, 10, 142, 16448255); - this.fontRendererObj.drawString("Error Code: "+((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode, 10, 142, 16448255); - this.fontRendererObj.drawString("In", 178, 10, 16448255); - this.fontRendererObj.drawString("Out", 176, 28, 16448255); - if (((this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString("Pipe is loose.", 10, 8, 16448255); mRepairStatus[0] = false; } else { mRepairStatus[0] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString("Screws are missing.", 10, 16, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 2) != 0) { mRepairStatus[1] = false; } else { mRepairStatus[1] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString("Something is stuck.", 10, 24, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 4) != 0) { mRepairStatus[2] = false; } else { mRepairStatus[2] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString("Platings are dented.", 10, 32, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 8) != 0) { mRepairStatus[3] = false; } else { mRepairStatus[3] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 16) != 0) { - this.fontRendererObj.drawString("Circuitry burned out.", 10, 40, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 16) != 0) { mRepairStatus[4] = false; } else { mRepairStatus[4] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString("That doesn't belong there.", 10, 48, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 32) != 0) { mRepairStatus[5] = false; } else { mRepairStatus[5] = true; - } - if (((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_PowerSubStation) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString( - "Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 8, 16448255); - } else { - this.fontRendererObj.drawString("Running perfectly.", 10, 8, 16448255); - } - } - if (this.mContainer.mEnergy > 160000000 && this.mContainer.mEnergy < 160010000) { - this.fontRendererObj.drawString("160,000,000 EU", 50, 155, 16711680); - } else if (this.mContainer.mEnergy > 320000000 && this.mContainer.mEnergy < 320010000) { - this.fontRendererObj.drawString("320,000,000 EU", 50, 155, 16711680); - } else if (this.mContainer.mEnergy > 640000000 && this.mContainer.mEnergy < 640010000) { - this.fontRendererObj.drawString("640,000,000 EU", 50, 155, 16711680); - } else { - this.fontRendererObj.drawString(GT_Utility.formatNumbers((long) this.mContainer.mEnergy) + " EU", - 50, 155, 16711680); } + if (mPowerContainer.mDisplayErrorCode == 0) { + if (mPowerContainer.mActive == 0) { + this.fontRendererObj.drawString("Turn on with Mallet", 10, 8, 16448255); + } + else { + this.fontRendererObj.drawString("Running perfectly", 10, 8, 16448255); + } + } + + this.fontRendererObj.drawString("In", 178, 10, 16448255); + this.fontRendererObj.drawString("Out", 176, 28, 16448255); + this.fontRendererObj.drawString("Avg In: "+GT_Utility.formatNumbers(this.mPowerContainer.mAverageEuAdded)+" EU", 10, 20, 16448255); + this.fontRendererObj.drawString("Avg Out: "+GT_Utility.formatNumbers(this.mPowerContainer.mAverageEuConsumed)+" EU", 10, 30, 16448255); + + final double tScale2 = MathUtils.findPercentage(this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU); + final int tScale = (int) (tScale2 * 2.55); + this.fontRendererObj.drawString("Stored:", 10, 132, 16448255); + this.fontRendererObj.drawString(GT_Utility.formatNumbers(this.mPowerContainer.mStoredEU) + " EU", 10, 142, Utils.rgbtoHexValue((255 - tScale), (0 + tScale), 0)); + this.fontRendererObj.drawString(GT_Utility.formatNumbers(tScale2)+"%", 70, 155, 16448255); + } } - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { /** The X size of the inventory window in pixels. */ if (this.xSize != 196) this.xSize = 196; /** The Y size of the inventory window in pixels. */ if (this.ySize != 191) - this.ySize = 191; - super.drawGuiContainerBackgroundLayer(par1, par2, par3); + this.ySize = 191; + super.drawGuiContainerBackgroundLayer(par1, par2, par3); final int x = (this.width - this.xSize) / 2; final int y = (this.height - this.ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - final double tScale = this.mContainer.mEnergy / this.mContainer.mStorage; + if (this.mPowerContainer != null) { + final double tScale = MathUtils.findPercentage(this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU) / 100; this.drawTexturedModalRect(x + 5, y + 156, 0, 251, Math.min(147, (int) (tScale * 148.0)), 5); - - //A1 + // A1 this.drawTexturedModalRect(x + 154, y + 76, 238, (!mRepairStatus[0] ? 0 : 18), 18, 18); - //A2 + // A2 this.drawTexturedModalRect(x + 154 + 20, y + 76, 238, (!mRepairStatus[1] ? 0 : 18), 18, 18); - //B1 + // B1 this.drawTexturedModalRect(x + 154, y + 76 + 18, 238, (!mRepairStatus[2] ? 0 : 18), 18, 18); - //B2 + // B2 this.drawTexturedModalRect(x + 154 + 20, y + 76 + 18, 238, (!mRepairStatus[3] ? 0 : 18), 18, 18); - //C1 + // C1 this.drawTexturedModalRect(x + 154, y + 76 + 36, 238, (!mRepairStatus[4] ? 0 : 18), 18, 18); - //C2 + // C2 this.drawTexturedModalRect(x + 154 + 20, y + 76 + 36, 238, (!mRepairStatus[5] ? 0 : 18), 18, 18); - if (mGregToolIcons[0] != null) { - //this.drawTexturedModelRectFromIcon(x + 154, y + 76, mGregToolIcons[0], 18, 18); - } - if (mGregToolIcons[1] != null) { - //this.drawTexturedModelRectFromIcon(x + 154 + 20, y + 76, mGregToolIcons[1], 18, 18); - } - if (mGregToolIcons[2] != null) { - //this.drawTexturedModelRectFromIcon(x + 154, y + 76 + 18, mGregToolIcons[2], 9, 9); - } - if (mGregToolIcons[3] != null) { - //this.drawTexturedModelRectFromIcon(x + 154 + 20, y + 76 + 18, mGregToolIcons[3], 9, 9); - } - if (mGregToolIcons[4] != null) { - //this.drawTexturedModelRectFromIcon(x + 154, y + 76 + 36, mGregToolIcons[4], 9, 9); - } - if (mGregToolIcons[5] != null) { - //this.drawTexturedModelRectFromIcon(x + 154 + 20, y + 76 + 36, mGregToolIcons[5], 9, 9); - } - - /*//Maint Done - this.drawTexturedModalRect(x + 154, y + 76, 238, 0, 18, 18); - //Maint Required - this.drawTexturedModalRect(x + 154 + 20, y + 76, 238, 18, 18, 18);*/ - } } -}
\ No newline at end of file +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java new file mode 100644 index 0000000000..1af597c05a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java @@ -0,0 +1,141 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import com.google.gson.JsonObject; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricAutoWorkbench; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_ElectricAutoWorkbench extends GT_ContainerMetaTile_Machine { + + public int mMode; + public int mThroughPut; + + public GT_Container_ElectricAutoWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 5)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 5)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 5)); + addSlotToContainer(new Slot(mTileEntity, 3, 8, 23)); + addSlotToContainer(new Slot(mTileEntity, 4, 26, 23)); + addSlotToContainer(new Slot(mTileEntity, 5, 44, 23)); + addSlotToContainer(new Slot(mTileEntity, 6, 8, 41)); + addSlotToContainer(new Slot(mTileEntity, 7, 26, 41)); + addSlotToContainer(new Slot(mTileEntity, 8, 44, 41)); + + addSlotToContainer(new GT_Slot_Output(mTileEntity, 9, 8, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 10, 26, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 11, 44, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 12, 62, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 13, 80, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 14, 98, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 15, 116, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 16, 134, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 17, 152, 60)); + + addSlotToContainer(new GT_Slot_Output(mTileEntity, 18, 152, 41)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 19, 64, 6, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 20, 81, 6, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 21, 98, 6, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 22, 64, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 23, 81, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 24, 98, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 25, 64, 40, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 26, 81, 40, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 27, 98, 40, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 28, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 29, 121, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 29, 121, 5, false, false, 1)); + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 18) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + + Slot tSlot = (Slot)inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (mTileEntity.getMetaTileEntity() == null) return null; + if (aSlotIndex > 18 && aSlotIndex < 28) { + ItemStack tStack = aPlayer.inventory.getItemStack(); + if (tStack != null) { + tStack = GT_Utility.copy(1, tStack); + } + tSlot.putStack(tStack); + return null; + } + if (aSlotIndex == 28) return null; + if (aSlotIndex == 29) { + if (aMouseclick == 0) { + ((GT_MetaTileEntity_ElectricAutoWorkbench)mTileEntity.getMetaTileEntity()).switchModeForward(); + } else { + ((GT_MetaTileEntity_ElectricAutoWorkbench)mTileEntity.getMetaTileEntity()).switchModeBackward(); + } + return null; + } + if (aSlotIndex == 30) { + ((GT_MetaTileEntity_ElectricAutoWorkbench)mTileEntity.getMetaTileEntity()).switchThrough(); + return null; + } + } + + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 19; + } + + public int getShiftClickSlotCount() { + return 9; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + mMode = ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).mMode; + mThroughPut = ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).mThroughPut; + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 103, this.mMode); + var1.sendProgressBarUpdate(this, 104, this.mThroughPut); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 103: + this.mMode = par2; + break; + case 104: + this.mThroughPut = par2; + break; + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java new file mode 100644 index 0000000000..3e8f509dfd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java @@ -0,0 +1,267 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricInventoryManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class GT_Container_ElectricInventoryManager extends GT_ContainerMetaTile_Machine { + + public int[] mTargetDirections = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + public int[] mRangeDirections = new int[]{0, 0, 0, 0}; + public int mTargetInOut; + public int mTargetEnergy; + + public GT_Container_ElectricInventoryManager(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 155, 5)); + addSlotToContainer(new Slot(mTileEntity, 1, 155, 23)); + addSlotToContainer(new Slot(mTileEntity, 2, 155, 41)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 5, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 5, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 5, 5, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 6, 61, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 7, 61, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 8, 61, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 9, 80, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 10, 80, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 11, 80, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 12, 136, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 13, 136, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 14, 136, 41, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 41, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 60, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 5, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 61, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 80, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 136, 60, false, true, 1)); + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 3 || aSlotIndex >= getAllSlotCount()) + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (mTileEntity.getMetaTileEntity() == null) + return null; + if (aSlotIndex < 15) { + ItemStack tStack = aPlayer.inventory.getItemStack(); + if (tStack != null) { + tStack = GT_Utility.copy(tStack); + if (aMouseclick != 0) { + tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); + } + tSlot.putStack(tStack); + } + else { + if (tSlot.getStack() != null) { + if (aMouseclick == 0) { + tSlot.getStack().stackSize -= (aShifthold == 1 ? 8 : 1); + if (tSlot.getStack().stackSize <= 0) { + tSlot.putStack(null); + } + } + else { + tSlot.getStack().stackSize += (aShifthold == 1 ? 8 : 1); + if (tSlot.getStack().stackSize > tSlot.getStack().getMaxStackSize()) { + tSlot.getStack().stackSize = tSlot.getStack().getMaxStackSize(); + } + } + } + } + return null; + } + else if (aSlotIndex >= 27 && aSlotIndex <= 30) { + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateRangeDirection(aSlotIndex - 27); + } + else if (aSlotIndex >= 31 && aSlotIndex <= 34) { + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchRangeEnergy(aSlotIndex - 31); + } + else if (aSlotIndex % 3 == 0) { + if (aMouseclick != 0) + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchSlot1InOut((aSlotIndex - 15) / 3); + else + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateSlot1Direction((aSlotIndex - 15) / 3); + } + else if (aSlotIndex % 3 == 1) { + if (aMouseclick != 0) + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchSlot2InOut((aSlotIndex - 16) / 3); + else + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateSlot2Direction((aSlotIndex - 16) / 3); + } + else if (aSlotIndex % 3 == 2) { + if (aMouseclick != 0) + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchSlot3InOut((aSlotIndex - 17) / 3); + else + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateSlot3Direction((aSlotIndex - 17) / 3); + } + } + return null; + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + mTargetDirections = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + mRangeDirections = new int[]{0, 0, 0, 0}; + + mRangeDirections[0] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(0); + mRangeDirections[1] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(1); + mRangeDirections[2] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(2); + mRangeDirections[3] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(3); + + mTargetDirections[0] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(0); + mTargetDirections[1] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(0); + mTargetDirections[2] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(0); + mTargetDirections[3] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(1); + mTargetDirections[4] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(1); + mTargetDirections[5] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(1); + mTargetDirections[6] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(2); + mTargetDirections[7] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(2); + mTargetDirections[8] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(2); + mTargetDirections[9] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(3); + mTargetDirections[10] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(3); + mTargetDirections[11] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(3); + + mTargetInOut = 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(0) ? 1 << 0 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(0) ? 1 << 1 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(0) ? 1 << 2 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(1) ? 1 << 3 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(1) ? 1 << 4 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(1) ? 1 << 5 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(2) ? 1 << 6 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(2) ? 1 << 7 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(2) ? 1 << 8 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(3) ? 1 << 9 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(3) ? 1 << 10 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(3) ? 1 << 11 : 0; + + mTargetEnergy = 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(0) ? 1 << 0 : 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(1) ? 1 << 1 : 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(2) ? 1 << 2 : 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(3) ? 1 << 3 : 0; + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + for (int i = 0; i < 12; i++) + var1.sendProgressBarUpdate(this, 100 + i, mTargetDirections[i]); + var1.sendProgressBarUpdate(this, 113, mTargetInOut); + var1.sendProgressBarUpdate(this, 114, mTargetEnergy); + for (int i = 0; i < 4; i++) + var1.sendProgressBarUpdate(this, 115 + i, mRangeDirections[i]); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100 : + mTargetDirections[0] = par2; + break; + case 101 : + mTargetDirections[1] = par2; + break; + case 102 : + mTargetDirections[2] = par2; + break; + case 103 : + mTargetDirections[3] = par2; + break; + case 104 : + mTargetDirections[4] = par2; + break; + case 105 : + mTargetDirections[5] = par2; + break; + case 106 : + mTargetDirections[6] = par2; + break; + case 107 : + mTargetDirections[7] = par2; + break; + case 108 : + mTargetDirections[8] = par2; + break; + case 109 : + mTargetDirections[9] = par2; + break; + case 110 : + mTargetDirections[10] = par2; + break; + case 111 : + mTargetDirections[11] = par2; + break; + + case 113 : + mTargetInOut = par2; + break; + case 114 : + mTargetEnergy = par2; + break; + case 115 : + mRangeDirections[0] = par2; + break; + case 116 : + mRangeDirections[1] = par2; + break; + case 117 : + mRangeDirections[2] = par2; + break; + case 118 : + mRangeDirections[3] = par2; + break; + } + } + + public int getSlotCount() { + return 3; + } + + public int getShiftClickSlotCount() { + return 3; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java new file mode 100644 index 0000000000..90f8380d14 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java @@ -0,0 +1,62 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_Container_CropHarvestor; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_ElectricAutoWorkbench extends GT_GUIContainerMetaTile_Machine { + + private static final String[] mModeText = new String[] {"Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle"}; + + public GT_GUIContainer_ElectricAutoWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_ElectricAutoWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "ElectricAutoWorkbench.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + drawTooltip(par1, par2); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + int tMode = ((GT_Container_ElectricAutoWorkbench)mContainer).mMode; + if (tMode != 0) drawTexturedModalRect(x + 120, y + 40, tMode*18, 166, 18, 18); + tMode = ((GT_Container_ElectricAutoWorkbench)mContainer).mThroughPut; + drawTexturedModalRect(x + 120, y + 4, tMode*18, 184, 18, 18); + } + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + List<String> list = new ArrayList<>(); + String[] mModeText = new String[] {"Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle"}; + if (y3 >= 45 && y3 <= 62) { + if (x3 >= 120 && x3 <= 137) { + list.add("Mode: "+mModeText[((GT_Container_ElectricAutoWorkbench) mContainer).mMode]); + /*switch (((GT_Container_ElectricAutoWorkbench) mContainer).mMode) { + case 0: + list.add("Mode: "); + }*/ + } + } + if (!list.isEmpty()) { + drawHoveringText(list, x3, y3, fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java new file mode 100644 index 0000000000..cf57d3faf1 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java @@ -0,0 +1,58 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +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 GT_GUIContainer_ElectricInventoryManager extends GT_GUIContainerMetaTile_Machine { + + public GT_GUIContainer_ElectricInventoryManager(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_ElectricInventoryManager(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "InventoryManager.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + drawTexturedModalRect(x + 4, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[0]*18, 202, 18, 54); + drawTexturedModalRect(x + 60, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[1]*18, 202, 18, 54); + drawTexturedModalRect(x + 79, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[2]*18, 202, 18, 54); + drawTexturedModalRect(x + 135, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[3]*18, 202, 18, 54); + + drawTexturedModalRect(x + 23, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[0]*18+126, 166, 18, 18); + drawTexturedModalRect(x + 41, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[1]*18+126, 166, 18, 18); + drawTexturedModalRect(x + 98, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[2]*18+126, 166, 18, 18); + drawTexturedModalRect(x + 116, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[3]*18+126, 166, 18, 18); + + drawTexturedModalRect(x + 4, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 1)!=0?184:166, 18, 18); + drawTexturedModalRect(x + 60, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 2)!=0?184:166, 18, 18); + drawTexturedModalRect(x + 79, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 4)!=0?184:166, 18, 18); + drawTexturedModalRect(x + 135, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 8)!=0?184:166, 18, 18); + + int i = -1; + + drawTexturedModalRect(x + 23, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 23, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 23, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 41, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 41, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 41, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 98, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 98, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 98, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 116, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 116, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 116, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java new file mode 100644 index 0000000000..9bca97de82 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java @@ -0,0 +1,187 @@ +package gtPlusPlus.xmod.gregtech.api.gui.basic; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; +import ic2.core.item.ItemIC2; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_CropHarvestor extends GT_ContainerMetaTile_Machine { + + public boolean mModeAlternative = false; + public int mWaterAmount = 0; + public int mWaterRealAmount = 0; + + public GT_Container_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + + + int aSlot = 1; + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 48, 64, false, true, 1)); + addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 8, 14)); + addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 26, 14)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 32)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 32)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 50)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 50)); + + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 7)); + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 25)); + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 43)); + + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + + GT_MetaTileEntity_CropHarvestor machine = (GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity(); + + if (aSlotIndex == 0) { + machine.mModeAlternative = !machine.mModeAlternative; + return null; + } + + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public int getSlotCount() { + return 24; + } + + @Override + public int getSlotStartIndex() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 6; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + + // GT_MetaTileEntity_Boiler.getCapacity() is used for both water and steam capacity. + int capacity = ((GT_MetaTileEntity_CropHarvestor) this.mTileEntity.getMetaTileEntity()).getCapacity(); + + mModeAlternative = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).mModeAlternative; + mWaterRealAmount = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).getFluidAmount(); + this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterRealAmount * 54 / (capacity - 100))); + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 102, mModeAlternative ? 1 : 0); + var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); + var1.sendProgressBarUpdate(this, 104, this.mWaterRealAmount); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 102: + mModeAlternative = (par2 != 0); + break; + case 103: + this.mWaterAmount = par2; + break; + case 104: + this.mWaterRealAmount = par2; + break; + } + } + + public static class SlotWeedEx extends Slot { + + public SlotWeedEx(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + @Override + public synchronized boolean isItemValid(final ItemStack itemstack) { + return isWeedEx(itemstack); + } + + @Override + public int getSlotStackLimit() { + return 1; + } + + private static boolean isWeedEx(ItemStack aStack) { + if (aStack != null && aStack.getItem() instanceof ItemIC2) { + if (aStack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) { + return true; + } + } + return false; + } + } + + public class SlotFertilizer extends Slot { + + public SlotFertilizer(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + @Override + public synchronized boolean isItemValid(final ItemStack aStack) { + if (aStack != null && aStack.getItem() instanceof ItemIC2) { + if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) { + return true; + } + } + return false; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java new file mode 100644 index 0000000000..504ae61b4a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java @@ -0,0 +1,75 @@ +package gtPlusPlus.xmod.gregtech.api.gui.basic; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.gui.GT_Container_Boiler; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_CropHarvestor extends GT_GUIContainerMetaTile_Machine { + + private final String mLocalName; + + public GT_GUIContainer_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_CropHarvestor(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "CropHarvestor.png"); + mLocalName = aLocalName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + drawTooltip(par1, par2); + //fontRendererObj.drawString("Crop Manager ("+this.mContainer.mTileEntity.getInputVoltage()+"v)", 8, 4, 4210752); + //fontRendererObj.drawString(mLocalName, 70, 69, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { + drawTexturedModalRect(x + 48, y + 64, 177, 37, 16, 16); + } + + int tScale = ((GT_Container_CropHarvestor) this.mContainer).mWaterAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 47, y + 61 - tScale, 204, 54 - tScale, 10, tScale); + }; + + } + + private void drawTooltip(int x2, int y2) { + int xStart = (width - xSize) / 2; + int yStart = (height - ySize) / 2; + int x = x2 - xStart; + int y = y2 - yStart + 5; + List<String> list = new ArrayList<>(); + if (y >= 68 && y <= 85) { + if (x >= 47 && x <= 64) { + if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { + list.add("Disable Hydration/Fertilizing/Weed-EX"); + } + else { + list.add("Enable Hydration/Fertilizing/Weed-EX"); + } + } + } + if (y >= 12 && y <= 66) { + if (x >= 47 && x <= 56) { + int aWater = ((GT_Container_CropHarvestor) mContainer).mWaterRealAmount; + list.add("Water: "+aWater+"L / "+((GT_Container_CropHarvestor) mContainer).mTileEntity.getMetaTileEntity().getCapacity()+"L"); + } + } + if (!list.isEmpty()) { + drawHoveringText(list, x, y, fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java index 3b96731f00..96e8e362ef 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java @@ -6,6 +6,7 @@ import java.util.List; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { @@ -52,6 +53,7 @@ public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { } if (!list.isEmpty()) { this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java new file mode 100644 index 0000000000..8abe7bff66 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -0,0 +1,409 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.*; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotDataStick; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; +import net.minecraft.entity.player.*; +import net.minecraft.inventory.*; +import net.minecraft.item.ItemStack; + +public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { + + public long mEUOut; + public int mEUOut1; + public int mEUOut2; + + public int mHeat; + + public int mMaxHeat; + + public int mHEM; + + public int mExplosionStrength; + + public long mEU; + public int mEU1; + public int mEU2; + + public long mStoredEU; + public int mStoredEU1; + public int mStoredEU2; + public long mMaxStoredEU; + public int mMaxStoredEU1; + public int mMaxStoredEU2; + + public int mProgress; + + public int mID; + + public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { + super(aInventoryPlayer, aTileEntity); + Logger.INFO("1 Container Mode: "+aID); + Logger.INFO("2 Container Mode: "+getMode()); + mID = getMode(); + Logger.INFO("3 Container Mode: "+getMode()); + // addSlotsComputer(aInventoryPlayer); + detectAndSendChanges(); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotsComputer(aInventoryPlayer); + } + + private int getMode() { + return ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + } + + public void addSlotsComputer(InventoryPlayer aInventoryPlayer) { + int y; + mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + Logger.INFO(""+(Utils.isClient() ? "Client" : "Server")+" Mode: " + mID); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); + switch (this.mID) { + case 1 : + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 86, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 70, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 54, false, false, 1)); + for (y = 0; y < 6; y++) { + for (int x = 0; x < 9; x++) + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); + } + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 113, 153, 28, false, false, 64)); + break; + case 2 : + addSlotToContainer(new SlotDataStick(this.mTileEntity, 54, 8, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 55, 26, 28)); + addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 56, 134, 28)); + addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 57, 152, 28)); + break; + case 3 : + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + case 4 : + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 152, 35, false, false, 64)); + break; + case 5 : + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 190, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 206, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 206, 38, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 206, 56, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 206, 74, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 206, 92, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 206, 110, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 153, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 65, 169, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 66, 185, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 67, 153, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 68, 169, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 69, 185, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 70, 153, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 71, 169, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 72, 185, 39, false, false, 64)); + break; + case 6 : + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + } + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + //Logger.INFO("Clicked slot " + aSlotIndex); + if (aSlotIndex < 0) { + //Logger.INFO(""); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { + //Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + return null; + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if (tSlot == null) { + //Logger.INFO("Null Slot?"); + } + else { + ItemStack tStack = tSlot.getStack(); + //Logger.INFO("Good Slot!"); + if (aSlotIndex == 0) { + //Logger.INFO("Slot is 0"); + if (aMouseclick == 0) { + Logger.INFO("Forward"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); + } + else { + Logger.INFO("Backwards"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); + } + if (aPlayer instanceof EntityPlayerMP) { + EntityPlayerMP aPlayerMP = (EntityPlayerMP) aPlayer; + changePage(aPlayerMP, ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + } + //FMLNetworkHandler.openGui(entityPlayer, mod, modGuiId, world, x, y, z); + //aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); + } + else if (aSlotIndex <= 2 && this.mID == 3) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } + else if (aSlotIndex <= 2 && this.mID == 6) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } + else if (aSlotIndex <= 2 && this.mID == 4) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } + else if (aSlotIndex <= 2 && this.mID == 5) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } + else if (aSlotIndex <= 58 && this.mID == 1) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); + onCraftMatrixChanged(this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); + onCraftMatrixChanged(this.mTileEntity); + } + else if (aSlotIndex == 3) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); + } + else { + if (aShifthold == 1) { + tSlot.putStack(null); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null); + return null; + } + + if (aMouseclick == 1) { + tSlot.putStack(null); + } + if (aMouseclick == 0) { + if (tStack == null) { + if (getSlot(58).getStack() != null && aSlotIndex != 58) { + tSlot.putStack(getSlot(58).getStack().copy()); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, new GT_ItemStack(getSlot(58).getStack().copy())); + } + else { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0)); + } + return null; + } + for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { + if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i)); + /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { + tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); + }*/ + return null; + } + } + tSlot.putStack(null); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null); + return null; + } + if (tStack == null) + return null; + if (tStack.stackSize < tStack.getMaxStackSize()) { + tStack.stackSize++; + return null; + } + tStack.stackSize = 1; + return null; + } + } + else { + //Logger.INFO("Super 2"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + } + //Logger.INFO("???"); + return null; + } + + + + public void changePage(EntityPlayerMP aPlayerMP, int aMode) { + GT_TileEntity_ComputerCube aCompTile = (GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity(); + aCompTile.onRightclick(mTileEntity, aPlayerMP); + } + + public boolean doesBindPlayerInventory() { + return (this.mID != 1 && this.mID != 5); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + mStoredEU = mTileEntity.getStoredEU(); + mMaxStoredEU = mTileEntity.getEUCapacity(); + int[] aStored = MathUtils.splitLongIntoTwoIntegers(mStoredEU); + int[] aMaxStorage = MathUtils.splitLongIntoTwoIntegers(mMaxStoredEU); + mStoredEU1 = aStored[0]; + mStoredEU2 = aStored[1]; + mMaxStoredEU1 = aMaxStorage[0]; + mMaxStoredEU2 = aMaxStorage[1]; + + + this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; + int[] aEUSplit1 = MathUtils.splitLongIntoTwoIntegers(mEUOut); + this.mEUOut1 = aEUSplit1[0]; + this.mEUOut2 = aEUSplit1[1]; + this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; + this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; + this.mHEM = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); + this.mExplosionStrength = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); + this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; + this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; + this.mMaxProgressTime = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxProgress; + this.mProgressTime = (int) ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getEUVar(); + int[] aEUSplit2 = MathUtils.splitLongIntoTwoIntegers(mEU); + this.mEU1 = aEUSplit2[0]; + this.mEU2 = aEUSplit2[1]; + Iterator<ICrafting> var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = var2.next(); + var1.sendProgressBarUpdate(this, 101, this.mID); + var1.sendProgressBarUpdate(this, 102, this.mHeat & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, this.mMaxHeat & 0xFFFF); + var1.sendProgressBarUpdate(this, 104, this.mHEM); + var1.sendProgressBarUpdate(this, 105, this.mExplosionStrength); + var1.sendProgressBarUpdate(this, 106, this.mHeat >>> 16); + var1.sendProgressBarUpdate(this, 107, this.mMaxHeat >>> 16); + var1.sendProgressBarUpdate(this, 108, this.mEU1); + var1.sendProgressBarUpdate(this, 109, this.mEU2); + var1.sendProgressBarUpdate(this, 110, this.mProgress); + var1.sendProgressBarUpdate(this, 111, this.mEUOut1); + var1.sendProgressBarUpdate(this, 112, this.mEUOut2); + var1.sendProgressBarUpdate(this, 113, mStoredEU1); + var1.sendProgressBarUpdate(this, 114, mStoredEU2); + var1.sendProgressBarUpdate(this, 115, mMaxStoredEU1); + var1.sendProgressBarUpdate(this, 116, mMaxStoredEU2); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 101 : + this.mID = par2; + break; + case 102 : + this.mHeat = this.mHeat & 0xFFFF0000 | par2; + break; + case 103 : + this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; + break; + case 104 : + this.mHEM = par2; + break; + case 105 : + this.mExplosionStrength = par2; + break; + case 106 : + this.mHeat = this.mHeat & 0xFFFF | par2 << 16; + break; + case 107 : + this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; + break; + case 108 : + this.mEU1 = par2; + case 109 : + this.mEU2 = par2; + this.mEU = MathUtils.combineTwoIntegersToLong(mEU1, mEU2); + break; + case 110 : + this.mProgress = par2; + break; + case 111 : + this.mEUOut1 = par2; + case 112 : + this.mEUOut2 = par2; + this.mEUOut = MathUtils.combineTwoIntegersToLong(mEUOut1, mEUOut2); + break; + case 113 : + mStoredEU1 = par2; + break; + case 114 : + mStoredEU2 = par2; + mStoredEU = MathUtils.combineTwoIntegersToLong(mStoredEU1, mStoredEU2); + break; + case 115 : + mMaxStoredEU1 = par2; + break; + case 116 : + mMaxStoredEU2 = par2; + mMaxStoredEU = MathUtils.combineTwoIntegersToLong(mMaxStoredEU1, mMaxStoredEU2); + break; + } + } + + public int getSlotStartIndex() { + return 1; + } + + public int getSlotCount() { + return (this.mID == 2) ? 4 : 0; + } + + public int getShiftClickSlotCount() { + return (this.mID == 2) ? 2 : 0; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java new file mode 100644 index 0000000000..acae0d39c5 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java @@ -0,0 +1,176 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.redstone.GT_MetaTileEntity_RedstoneCircuitBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class GT_Container_RedstoneCircuitBlock extends GT_ContainerMetaTile_Machine { + + public GT_Container_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 6, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 24, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 42, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 60, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 6, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 24, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 42, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 1, 26, 6, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 24, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 26, 42, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 26, 60, false, true, 1)); + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 0 || aSlotIndex > 6) + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (mTileEntity.getMetaTileEntity() == null) + return null; + if (aSlotIndex < 4) { + ItemStack tStack = aPlayer.inventory.getItemStack(); + if (tStack == null) { + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).changeGateData(aSlotIndex, aMouseclick == 0 ? aShifthold == 0 ? +1 : aShifthold == 1 ? +128 : +16 : aShifthold == 0 ? -1 : aShifthold == 1 ? -128 : -16); + } + else { + tStack = GT_Utility.copy(tStack); + if (aMouseclick != 0) + tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).stackGateData(aSlotIndex, tStack); + } + return null; + } + else if (aSlotIndex == 4) { + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchOutput(); + } + else if (aSlotIndex == 5) { + mTileEntity.setActive(!mTileEntity.isActive()); + } + else if (aSlotIndex == 6) { + if (aMouseclick == 0) + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchGateForward(aShifthold != 0); + else + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchGateBackward(aShifthold != 0); + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int mData[] = new int[]{0, 0, 0, 0, 0, 0, 0, 0}, mGate = 0; + + @SuppressWarnings("rawtypes") + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) + return; + mGate = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGate; + mData = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGateData; + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, mGate & 65535); + var1.sendProgressBarUpdate(this, 101, mGate >>> 16); + var1.sendProgressBarUpdate(this, 102, mData[0] & 65535); + var1.sendProgressBarUpdate(this, 103, mData[0] >>> 16); + var1.sendProgressBarUpdate(this, 104, mData[1] & 65535); + var1.sendProgressBarUpdate(this, 105, mData[1] >>> 16); + var1.sendProgressBarUpdate(this, 106, mData[2] & 65535); + var1.sendProgressBarUpdate(this, 107, mData[2] >>> 16); + var1.sendProgressBarUpdate(this, 108, mData[3] & 65535); + var1.sendProgressBarUpdate(this, 109, mData[3] >>> 16); + var1.sendProgressBarUpdate(this, 110, mData[4] & 65535); + var1.sendProgressBarUpdate(this, 111, mData[4] >>> 16); + var1.sendProgressBarUpdate(this, 112, mData[5] & 65535); + var1.sendProgressBarUpdate(this, 113, mData[5] >>> 16); + var1.sendProgressBarUpdate(this, 114, mData[6] & 65535); + var1.sendProgressBarUpdate(this, 115, mData[6] >>> 16); + var1.sendProgressBarUpdate(this, 116, mData[7] & 65535); + var1.sendProgressBarUpdate(this, 117, mData[7] >>> 16); + } + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100 : + mGate = mGate & -65536 | par2; + break; + case 101 : + mGate = mGate & 65535 | par2 << 16; + break; + case 102 : + mData[0] = mData[0] & -65536 | par2; + break; + case 103 : + mData[0] = mData[0] & 65535 | par2 << 16; + break; + case 104 : + mData[1] = mData[1] & -65536 | par2; + break; + case 105 : + mData[1] = mData[1] & 65535 | par2 << 16; + break; + case 106 : + mData[2] = mData[2] & -65536 | par2; + break; + case 107 : + mData[2] = mData[2] & 65535 | par2 << 16; + break; + case 108 : + mData[3] = mData[3] & -65536 | par2; + break; + case 109 : + mData[3] = mData[3] & 65535 | par2 << 16; + break; + case 110 : + mData[4] = mData[4] & -65536 | par2; + break; + case 111 : + mData[4] = mData[4] & 65535 | par2 << 16; + break; + case 112 : + mData[5] = mData[5] & -65536 | par2; + break; + case 113 : + mData[5] = mData[5] & 65535 | par2 << 16; + break; + case 114 : + mData[6] = mData[6] & -65536 | par2; + break; + case 115 : + mData[6] = mData[6] & 65535 | par2 << 16; + break; + case 116 : + mData[7] = mData[7] & -65536 | par2; + break; + case 117 : + mData[7] = mData[7] & 65535 | par2 << 16; + break; + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java new file mode 100644 index 0000000000..71defdc72a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -0,0 +1,172 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machine { + + public final GT_Container_ComputerCube mPowerContainer; + + public GT_GUIContainer_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aBaseMetaTileEntity, int aID) { + super(new GT_Container_ComputerCube(aInventoryPlayer, aBaseMetaTileEntity, aID), CORE.RES_PATH_GUI + "computer/"+aID+".png"); + mPowerContainer = (GT_Container_ComputerCube) mContainer; + if (mPowerContainer.mID == 5) { + this.xSize += 50; + } + } + + + public static ResourceLocation[] mGUIbackground = new ResourceLocation[8]; + + static { + mGUIbackground[0] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/0.png"); + mGUIbackground[1] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/1.png"); + mGUIbackground[2] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/2.png"); + mGUIbackground[3] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/3.png"); + mGUIbackground[4] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/4.png"); + mGUIbackground[5] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/5.png"); + mGUIbackground[6] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/6.png"); + mGUIbackground[7] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/Redstone.png"); + + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + //Logger.INFO("3 GUI Mode: "+xSize); + //GT_TileEntity_ComputerCube tTileEntity = (GT_TileEntity_ComputerCube) tContainer.mTileEntity; + if (tContainer != null) + switch (tContainer.mID) { + case 0 : + this.fontRendererObj.drawString("Solaris 1.7.10", 56, 70, Utils.rgbtoHexValue(100, 190, 255)); + //this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + break; + case 1 : + this.fontRendererObj.drawString("Reactorstats:", 7, 108, 16448255); + this.fontRendererObj.drawString(toNumber(tContainer.mEU) + "EU at " + tContainer.mEUOut + "EU/t", 7, 120, 16448255); + this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255); + this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", 7, 136, 16448255); + this.fontRendererObj.drawString("Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255); + this.fontRendererObj.drawString("Runtime: " + ((tContainer.mProgress > 0) ? (/*(tContainer.mEU / tContainer.mEUOut)*/ tContainer.mProgress / 20) : 0) + "secs", 7, 152, 16448255); + break; + case 2 : + this.fontRendererObj.drawString("Scanner", 51, 7, 16448255); + if (tContainer.mProgress == 0) { + this.fontRendererObj.drawString("Can be used to", 51, 24, 16448255); + this.fontRendererObj.drawString("scan things", 51, 32, 16448255); + this.fontRendererObj.drawString("Currently", 51, 48, Utils.rgbtoHexValue(200, 20, 20)); + this.fontRendererObj.drawString("Disabled", 51, 56, Utils.rgbtoHexValue(200, 20, 20)); + } + else { + this.fontRendererObj.drawString("Progress:", 51, 24, 16448255); + this.fontRendererObj.drawString(MathUtils.findPercentage(tContainer.mProgress, tContainer.mMaxProgressTime) + " %", 51, 32, 16448255); + } + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + break; + case 3 : + this.fontRendererObj.drawString("Centrifuge", 7, 7, 16448255); + this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(), 7, 23, 16448255); + this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); + break; + case 4 : + this.fontRendererObj.drawString("Fusionreactor", 7, 7, 16448255); + this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_TileEntity_ComputerCube.sFusionReactorRecipes.size(), 7, 15, 16448255); + this.fontRendererObj.drawString("Start: " + toNumber(tContainer.mEU) + "EU", 7, 23, 16448255); + this.fontRendererObj.drawString("EU/t: " + toNumber(tContainer.mEUOut), 7, 31, 16448255); + this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + " Ticks", 7, 39, 16448255); + GT_Recipe tRecipe = GT_TileEntity_ComputerCube.sFusionReactorRecipes.get(tContainer.mMaxHeat); + this.fontRendererObj.drawString(""+tRecipe.mFluidOutputs[0].getLocalizedName(), 7, 55, 16448255); + if (tContainer.mEUOut < 0) { + this.fontRendererObj.drawString("IN: " + toNumber(-tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 47, 16448255); + break; + } + this.fontRendererObj.drawString("OUT: " + toNumber(tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 47, 16448255); + break; + case 5 : + if (tContainer.mID == 5 && this.xSize == 176) { + this.xSize += 50; + } + if (tContainer.mMaxHeat >= 0 && tContainer.mMaxHeat < GT_Computercube_Description.sDescriptions.size()) + for (int i = 0; i < ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription.length; i++) { + if (i == 0) { + this.fontRendererObj.drawString(((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7, 16448255); + } + else { + this.fontRendererObj.drawString(((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7 + + 8 * i, 16448255); + } + } + break; + case 6 : + this.fontRendererObj.drawString("Electrolyzer", 7, 7, 16448255); + this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(), 7, 23, 16448255); + this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); + break; + } + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + if (mContainer != null) { + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + mc.renderEngine.bindTexture(mGUIbackground[((GT_Container_ComputerCube) this.mContainer).mID]); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + switch (tContainer.mID) { + case 0 : + if (this.mPowerContainer.mStoredEU > 0 && this.mPowerContainer.mMaxStoredEU > 0) { + final double tScale = MathUtils.findPercentage(this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU); + this.drawTexturedModalRect(x + 44, y + 8, 0, 166, Math.min(MathUtils.roundToClosestInt(tScale), 95), 5); + } + else { + // + //Logger.INFO("1 No Power? "+tContainer.mProgressTime+" | "+tContainer.mTileEntity.getEUCapacity()); + //Logger.INFO("2 No Power? "+aComp.getEUVar()+" | "+aComp.maxEUStore()); + } + break; + case 5 : + if (tContainer.mExplosionStrength != 0) + drawTexturedModalRect(x + 152, y + 6, 0, 166, 50, 50); + break; + } + } + } + + public String toNumber(long mEU) { + String tString = ""; + boolean temp = true, negative = false; + if (mEU < 0) { + mEU *= -1; + negative = true; + } + int i; + for (i = 1000000000; i > 0; i /= 10) { + long tDigit = mEU / i % 10; + if (temp && tDigit != 0) + temp = false; + if (!temp) { + tString = tString + tDigit; + if (i != 1) { + int j; + for (j = i; j > 0;) { + if (j == 1) + tString = tString + ","; + j /= 1000; + } + } + } + } + if (tString.equals("")) + tString = "0"; + return negative ? ("-" + tString) : tString; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java new file mode 100644 index 0000000000..53d60c3a68 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java @@ -0,0 +1,95 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.GregTech_API; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_CircuitryBehavior; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_RedstoneCircuitBlock extends GT_GUIContainerMetaTile_Machine { + + public GT_GUIContainer_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_RedstoneCircuitBlock(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "RedstoneCircuitBlock.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(((GT_Container_RedstoneCircuitBlock) mContainer).mGate); + if (tCircuit != null) { + this.fontRendererObj.drawString(tCircuit.getName(), 46, 8, 16448255); + this.fontRendererObj.drawString(tCircuit.getDescription(), 46, 19, 16448255); + + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 0), 46, 33, 16448255); + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 1), 46, 44, 16448255); + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 2), 46, 55, 16448255); + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3), 46, 66, 16448255); + + String tString; + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 0); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[0]) : tString, 99, 33, 16448255); + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 1); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[1]) : tString, 99, 44, 16448255); + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 2); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[2]) : tString, 99, 55, 16448255); + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[3]) : tString, 99, 66, 16448255); + } + this.drawTooltip(par1, par2); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + if (((GT_Container_RedstoneCircuitBlock) mContainer).mOutput > 0) + drawTexturedModalRect(x + 151, y + 5, 176, 0, 18, 18); + if ((((GT_Container_RedstoneCircuitBlock) mContainer).mActive & 1) > 0) + drawTexturedModalRect(x + 151, y + 23, 176, 18, 18, 18); + if (((GT_Container_RedstoneCircuitBlock) mContainer).mDisplayErrorCode > 0) + if ((((GT_Container_RedstoneCircuitBlock) mContainer).mTileEntity.getTimer() / 5) % 2 == 0) + drawTexturedModalRect(x + 140, y + 9, 194, 0, 7, 7); + else + ; + else + drawTexturedModalRect(x + 140, y + 9, 201, 0, 7, 7); + } + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + final List<String> list = new ArrayList<String>(); + + int y = 10; + if (x3 >= 151 && x3 <= 168) { + if (y3 >= y && y3 <= (y + 17)) { + list.add("Toggle EU Output"); + } + if (y3 >= (y + 18) && y3 <= (y + 35)) { + list.add("Toggle Active State"); + } + if (y3 >= (y + 36) && y3 <= (y + 53)) { + list.add("Change Redstone Circuit"); + } + } + + if (!list.isEmpty()) { + //RenderHelper.enableGUIStandardItemLighting(); + this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + //RenderHelper.enableStandardItemLighting(); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java index 1be79b40cc..4d35df251c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java @@ -7,6 +7,8 @@ import gtPlusPlus.core.lib.CORE; import java.util.ArrayList; import java.util.List; + +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { @@ -54,6 +56,7 @@ public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { if (!list.isEmpty()) { this.drawHoveringText(list, x, y, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java index e6203823b6..606880d6e9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.gui.hatches; import gregtech.api.gui.GT_Container_1by1; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; @@ -36,12 +37,7 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { } @Override public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { - if (itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 176) { - return true; - } - } - return false; + return GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(itemstack); } @Override public int getSlotStackLimit() { @@ -52,9 +48,10 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { return false; } @Override - public void putStack(ItemStack p_75215_1_) { - // TODO Auto-generated method stub - super.putStack(p_75215_1_); + public void putStack(ItemStack aStack) { + if (isItemValid(aStack)) { + this.inventory.setInventorySlotContents(0, aStack); + } } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java new file mode 100644 index 0000000000..d7ec19a9ac --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java @@ -0,0 +1,124 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +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_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotBlueprint; +import gtPlusPlus.core.slots.SlotElectric; +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 GT_Container_AdvancedWorkbench extends GT_ContainerMetaTile_Machine { + + public GT_Container_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); + + addSlotToContainer(new SlotElectric(mTileEntity, 16, 82, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 17, 100, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 18, 118, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 19, 136, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); + + addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + Logger.INFO("Clicked on slot "+aSlotIndex); + if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; + try { + ItemStack tStack = ((Slot)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)mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } else if (aSlotIndex == 33) { + ItemStack tStack2, tCraftedStack = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); j++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); + } + } + } else { + if (aMouseclick == 0) { + if (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + return aPlayer.inventory.getItemStack(); + } else { + for (int i = 0; i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); i++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + } + return null; + } else if (aSlotIndex == 34) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } else if (aSlotIndex == 35) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } catch(Throwable e) { + //GT_Log.log.catching(e); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 33; + } + + public int getShiftClickSlotCount() { + return 21; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java new file mode 100644 index 0000000000..d26c4d49fd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java @@ -0,0 +1,121 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +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_Utility; +import gtPlusPlus.core.slots.SlotBlueprint; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_BronzeWorkbench extends GT_ContainerMetaTile_Machine { + + public GT_Container_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); + + addSlotToContainer(new Slot(mTileEntity, 16, 82, 8)); + addSlotToContainer(new Slot(mTileEntity, 17, 100, 8)); + addSlotToContainer(new Slot(mTileEntity, 18, 118, 8)); + addSlotToContainer(new Slot(mTileEntity, 19, 136, 8)); + addSlotToContainer(new Slot(mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); + + addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; + try { + ItemStack tStack = ((Slot)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_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } else if (aSlotIndex == 33) { + ItemStack tStack2, tCraftedStack = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); j++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); + } + } + } else { + if (aMouseclick == 0) { + if (((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + return aPlayer.inventory.getItemStack(); + } else { + for (int i = 0; i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); i++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + } + return null; + } else if (aSlotIndex == 34) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } else if (aSlotIndex == 35) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } catch(Throwable e) { + //GT_Log.log.catching(e); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 33; + } + + public int getShiftClickSlotCount() { + return 21; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java new file mode 100644 index 0000000000..094a7a7eb9 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java @@ -0,0 +1,86 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_AdvancedWorkbench extends GT_GUIContainerMetaTile_Machine { + + private final String mLocalName; + + public GT_GUIContainer_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_AdvancedWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "AdvancedCraftingTable.png"); + mLocalName = aLocalName; + } + + public GT_GUIContainer_AdvancedWorkbench(GT_ContainerMetaTile_Machine aContainer, String aLocalName, String aResource) { + super(aContainer, aResource); + mLocalName = aLocalName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + //fontRendererObj.drawString(mLocalName, 8, 4, 4210752); + this.drawTooltip(par1, par2); + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + final List<String> list = new ArrayList<String>(); + //154 - 172 + + if (KeyboardUtils.isShiftKeyDown()) { + if (y3 >= 30 && y3 <= 49) { + if (x3 >= 135 && x3 <= 154) { + list.add("Blueprint Slot"); + list.add("Shift+Lmb Sets to crafting output"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Extraction Slot"); + list.add("Things can always be pulled from here"); + } + } + if (y3 >= 50 && y3 <= 67) { + if (x3 >= 135 && x3 <= 152) { + list.add("Flush"); + list.add("Empty crafting grid back to storage"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Automation"); + list.add("Allows output while"); + list.add("crafting grid is full"); + } + } + if (y3 >= 68 && y3 <= 85){ + if (x3 >= 135 && x3 <= 152) { + list.add("Output Slot"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Free Parking"); + } + } + } + if (!list.isEmpty()) { + this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java new file mode 100644 index 0000000000..178c9241f1 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_BronzeWorkbench extends GT_GUIContainer_AdvancedWorkbench { + + public GT_GUIContainer_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_BronzeWorkbench(aInventoryPlayer, aTileEntity), aLocalName, CORE.RES_PATH_GUI + "BronzeCraftingTable.png"); + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IBaseCustomMetaTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IBaseCustomMetaTileEntity.java new file mode 100644 index 0000000000..71d15e6e77 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IBaseCustomMetaTileEntity.java @@ -0,0 +1,7 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +public interface IBaseCustomMetaTileEntity { + + public boolean doesExplode(); + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index ce26d14e53..a72c6e98f3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -1,11 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; -import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; -import gregtech.api.util.GT_Recipe; import gtPlusPlus.core.material.Material; import net.minecraft.item.ItemStack; - import net.minecraftforge.fluids.FluidStack; public interface IGregtech_RecipeAdder { @@ -341,5 +338,7 @@ public interface IGregtech_RecipeAdder { public boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); public boolean addVacuumFreezerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU); + + public boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU, int aAmps); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java index 6967c8eb33..5ccbd8cb2d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -15,6 +15,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import ic2.api.Direction; @@ -22,7 +23,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -public class BaseCustomTileEntity extends BaseMetaTileEntity { +public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCustomMetaTileEntity { protected NBTTagCompound mRecipeStuff2; private static final Field ENTITY_ITEM_HEALTH_FIELD_2; @@ -49,6 +50,10 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { super(); Logger.MACHINE_INFO("Created new BaseCustomTileEntity"); } + + public boolean doesExplode() { + return true; + } public void writeToNBT(NBTTagCompound aNBT) { try { @@ -70,6 +75,10 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { } public void doEnergyExplosion() { + if (!doesExplode()) { + Logger.INFO("Machine tried to explode, let's stop that. xo [doEnergyExplosion]"); + return; + } if (this.getUniversalEnergyCapacity() > 0L && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { this.doExplosion( @@ -83,6 +92,12 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { } public void doExplosion(long aAmount) { + + if (!doesExplode()) { + Logger.INFO("Machine tried to explode, let's stop that. xo [doExplosion]"); + return; + } + if (this.canAccessData()) { if (GregTech_API.sMachineWireFire && this.mMetaTileEntity.isElectric()) { try { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java index a4440114e8..d600d0baca 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java @@ -10,34 +10,38 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { public BaseCustomPower_MTE() { super(); - Logger.MACHINE_INFO("Created new BaseCustomPower_MTE"); + Logger.INFO("Created new BaseCustomPower_MTE"); + } + + public boolean doesExplode() { + return false; } public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (mMetaTileEntity == null) { - Logger.MACHINE_INFO("Bad Tile"); + Logger.INFO("Bad Tile"); } if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L && aVoltage > 0L && this.getStoredEU() < this.getEUCapacity() && this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage()) { - Logger.MACHINE_INFO("Injecting Energy Units"); + Logger.INFO("Injecting Energy Units"); return super.injectEnergyUnits(aSide, aVoltage, aAmperage); } else { - Logger.MACHINE_INFO("canAccessData(): "+canAccessData()); - Logger.MACHINE_INFO("isElectric(): "+this.mMetaTileEntity.isElectric()); - Logger.MACHINE_INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide)); - Logger.MACHINE_INFO("aAmperage: "+aAmperage); - Logger.MACHINE_INFO("aVoltage: "+aVoltage); - Logger.MACHINE_INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity())); - Logger.MACHINE_INFO("this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); - Logger.MACHINE_INFO("this.mMetaTileEntity.maxAmperesIn(): "+(this.mMetaTileEntity.maxAmperesIn())); - Logger.MACHINE_INFO("this.mAcceptedAmperes: "+(this.getInputAmperage())); + Logger.INFO("canAccessData(): "+canAccessData()); + Logger.INFO("isElectric(): "+this.mMetaTileEntity.isElectric()); + Logger.INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide)); + Logger.INFO("aAmperage: "+aAmperage); + Logger.INFO("aVoltage: "+aVoltage); + Logger.INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity())); + Logger.INFO("this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); + Logger.INFO("this.mMetaTileEntity.maxAmperesIn(): "+(this.mMetaTileEntity.maxAmperesIn())); + Logger.INFO("this.mAcceptedAmperes: "+(this.getInputAmperage())); return 0L; } } public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - Logger.MACHINE_INFO("Draining Energy Units 4"); + Logger.INFO("Draining Energy Units 4"); if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { @@ -54,7 +58,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { @Override public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { - Logger.MACHINE_INFO("Draining Energy Units 3"); + Logger.INFO("Draining Energy Units 3"); // TODO Auto-generated method stub return super.decreaseStoredEnergyUnits(aEnergy, aIgnoreTooLessEnergy); } @@ -73,7 +77,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { @Override public boolean outputsEnergyTo(byte aSide) { - Logger.MACHINE_INFO("Draining Energy Units 2"); + Logger.INFO("Draining Energy Units 2"); // TODO Auto-generated method stub return super.outputsEnergyTo(aSide); } @@ -134,7 +138,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { @Override public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { - Logger.MACHINE_INFO("Draining Energy Units 1"); + Logger.INFO("Draining Energy Units 1"); // TODO Auto-generated method stub return super.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java index 785c4698db..8110037c46 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java @@ -79,7 +79,6 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo @Override public String[] getDescription() { - AutoMap<String> aTooltip = new AutoMap<String>(); String []s1 = null; s1 = new String[aTooltip.size()]; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java index 8b7ccc202a..31d24ff343 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java @@ -4,7 +4,6 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.entity.Entity; @@ -16,6 +15,7 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { public MetaTileEntityCustomPower(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { super(aID, aBasicName, aRegionalName, aInvSlotCount); this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); + this.getBaseMetaTileEntity().setMetaTileID((short) aID); } public MetaTileEntityCustomPower(String aStack, int aInvSlotCount) { @@ -25,11 +25,17 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { public long getMinimumStoredEU() { return 0L; } + + public boolean doesExplode() { + return this.getBaseCustomMetaTileEntity().doesExplode(); + } + + public void doExplosion(long aExplosionPower) { - if (MathUtils.randInt(1, 10) > 0) { - //Logger.INFO("Machine tried to explode, let's stop that. xo"); + if (!doesExplode()) { + Logger.INFO("Machine tried to explode, let's stop that. xo [doExplosion]"); return; } @@ -68,12 +74,10 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { @Override public void onExplosion() { - - if (MathUtils.randInt(1, 10) > 0) { - //Logger.INFO("Machine tried to explode, let's stop that. xo"); + if (!doesExplode()) { + Logger.INFO("Machine tried to explode, let's stop that. xo [onExplosion]"); return; } - // TODO Auto-generated method stub super.onExplosion(); } @@ -84,7 +88,6 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { @Override public long getEUVar() { - // TODO Auto-generated method stub return super.getEUVar(); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java index e6bf4b8486..3821b2a95c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java @@ -9,8 +9,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock; import ic2.api.item.ElectricItem; @@ -19,9 +17,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock { - + public boolean mCharge = false; public boolean mDecharge = false; public int mBatteryCount = 0; @@ -30,53 +29,50 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock private long mStored = 0L; private long mMax = 0L; - public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, - String aDescription, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription, new ITexture[0]); } - public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, - int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } public String[] getDescription() { - String []s1 = super.getDescription(); - s1 = new String[0]; - return s1; + final String[] desc = new String[6]; + int tTier = this.mTier; + desc[0] = "" + EnumChatFormatting.BOLD + "16 Fuse Slots"; + desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW + (GT_Values.V[tTier]) + EnumChatFormatting.GRAY + " EU/t"; + desc[2] = "However this " + EnumChatFormatting.ITALIC + EnumChatFormatting.RED + "MUST" + EnumChatFormatting.GRAY + " be in a single Amp"; + desc[3] = "This machine can accept upto a single amp of " + GT_Values.VN[Math.min(tTier + 2, 15)] + " as a result"; + desc[4] = "Breaker Loss: " + EnumChatFormatting.RED + "" + (GT_Values.V[tTier] / 16) + EnumChatFormatting.GRAY + " EU/t"; + desc[5] = CORE.GT_Tooltip; + return desc; } public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[2][17][]; for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 - ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] - : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)]}; - - rTextures[1][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 - ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] - : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + + 1], this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)]}; + + rTextures[1][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + + 1], this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } return rTextures; } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, - this.mInventory.length); + return new GT_MetaTileEntity_BasicBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mInventory.length); } public boolean isSimpleMachine() { @@ -132,11 +128,11 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock } public long maxAmperesIn() { - return (long) (1); + return 16; } public long maxAmperesOut() { - return (long) 16; + return 16; } public int rechargerSlotStartIndex() { @@ -176,7 +172,8 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; - } else { + } + else { aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -199,14 +196,14 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock this.mChargeableCount = 0; ItemStack[] arg3 = this.mInventory; int arg4 = arg3.length; - + for (int arg5 = 0; arg5 < arg4; ++arg5) { ItemStack tStack = arg3[arg5]; if (GT_ModHandler.isElectricItem(tStack, this.mTier)) { if (GT_ModHandler.isChargerItem(tStack)) { ++this.mBatteryCount; } - + ++this.mChargeableCount; } }*/ @@ -254,7 +251,8 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock tStored += tStep; } - } else if (aStack.getItem() instanceof IElectricItem) { + } + else if (aStack.getItem() instanceof IElectricItem) { tStored += (long) ElectricItem.manager.getCharge(aStack); tScale += (long) ((IElectricItem) aStack.getItem()).getMaxCharge(aStack); } @@ -273,11 +271,15 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock return new long[]{tStored, tScale}; } - public String[] getInfoData() { - return new String[]{}; + public String[] getInfoData() { + return new String[]{"Tile Type: " + this.getTileEntityBaseType()}; } public boolean isGivingInformation() { return true; } -}
\ No newline at end of file + + public boolean doesExplode() { + return true; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java index a892346463..67a6fc7aeb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java @@ -2,8 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import java.util.ArrayList; -import gregtech.api.gui.GT_Container_4by4; -import gregtech.api.gui.GT_GUIContainer_4by4; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -11,7 +9,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_DataHatch; +import gtPlusPlus.xmod.gregtech.api.gui.GUI_DataHatch; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -22,28 +24,30 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE public GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 16, new String[]{ + super(aID, aName, aNameRegional, aTier, 17, new String[]{ "Holds Data Orbs for the Elemental Duplicator", + "Can insert/extract the circuit slot", + "Use Circuit to select a slot (1-16)", CORE.GT_Tooltip }); } public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 16, aDescription, aTextures); + super(aName, aTier, 17, aDescription, aTextures); } public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 16, aDescription, aTextures); + super(aName, aTier, 17, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Cyber_Interface)}; + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Cyber_Interface)}; + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb)}; } @Override @@ -80,12 +84,12 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity); + return new CONTAINER_DataHatch(aPlayerInventory, aBaseMetaTileEntity); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository"); + return new GUI_DataHatch(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository"); } @Override @@ -96,13 +100,13 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE } public void updateSlots() { - for (int i = 0; i < mInventory.length; i++) + for (int i = 0; i < mInventory.length-1; i++) if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; fillStacksIntoFirstSlots(); } protected void fillStacksIntoFirstSlots() { - for (int i = 0; i < mInventory.length; i++) { + for (int i = 0; i < mInventory.length-1; i++) { if (mInventory[i] != null && mInventory[i].stackSize <= 0) { mInventory[i] = null; } @@ -130,20 +134,47 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return true; + Logger.INFO("Checking if we can pull "+aStack.getDisplayName()+" from slot "+aIndex); + if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) { + return true; + } + return false; } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); + Logger.INFO("Checking if we can put "+aStack.getDisplayName()+" into slot "+aIndex); + if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) { + return true; + } + return false; } public ArrayList<ItemStack> getInventory(){ ArrayList<ItemStack> aContents = new ArrayList<ItemStack>(); - for (int i=0;i<this.getSizeInventory();i++) { - aContents.add(this.getStackInSlot(i)); - } + for (int i = getBaseMetaTileEntity().getSizeInventory() - 2; i >= 0; i--) { + if (getBaseMetaTileEntity().getStackInSlot(i) != null) + aContents.add(getBaseMetaTileEntity().getStackInSlot(i)); + } return aContents; } + @Override + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { + if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) { + Logger.INFO("Putting "+aStack.getDisplayName()+" into slot "+aIndex); + return true; + } + return false; + } + + @Override + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { + if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack)) { + Logger.INFO("Pulling "+aStack.getDisplayName()+" from slot "+aIndex); + return true; + } + return false; + } + } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java index a9cd179214..a4040c1c5e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java @@ -1,18 +1,21 @@ -/* package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine; import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine; @@ -21,15 +24,16 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextu import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +@SuppressWarnings("deprecation") public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { public boolean mHasController = false; public boolean mUsingAnimation = true; private String mControllerLocation; + public int mEUt = 0; public GT_MetaTileEntity_Hatch_Turbine(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 16, "Turbine Rotor holder for XL Turbines"); @@ -42,6 +46,18 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Turbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription[0], aTextures); } + + @Override + public String[] getDescription() { + return new String[]{ + this.mDescription, + "Right Click with a soldering iron to reset controller link", + "Right Click with a wrench to remove turbine", + "Right Click with a screwdriver for technical information", + "Sneak + Right Click with a wrench to rotate", + "Sneak + Right Click with a screwdriver to disable animations", + CORE.GT_Tooltip}; + } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { @@ -53,6 +69,14 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { return new ITexture[]{aBaseTexture, getFrontFacingTurbineTexture()}; } + public int getEU() { + return this.mEUt; + } + + public void setEU(int aEU) { + this.mEUt = aEU; + } + @Override public boolean isSimpleMachine() { return true; @@ -73,6 +97,31 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { return false; } + public boolean hasTurbine() { + ItemStack aStack = this.mInventory[0]; + boolean aIsValid = GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(aStack); + return aIsValid; + } + + public ItemStack getTurbine() { + if (hasTurbine()) { + return this.mInventory[0]; + } + return null; + } + + public boolean canWork() { + return hasTurbine(); + } + + public boolean insertTurbine(ItemStack aTurbine) { + if (GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(aTurbine)) { + this.mInventory[0] = aTurbine; + return true; + } + return false; + } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Hatch_Turbine(mName, mTier, StaticFields59.getDescriptionArray(this), mTextures); @@ -80,32 +129,23 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - //aBaseMetaTileEntity.openGUI(aPlayer); - PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Using Animations? "+usingAnimations()); - PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Has Controller? "+this.mHasController); - if (mHasController) { - PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Controller Location: "+BlockPos.generateBlockPos(mControllerLocation).getLocationString()); - PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Controller Active? "+this.isControllerActive()); + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + else { + aBaseMetaTileEntity.openGUI(aPlayer); } - PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Is Active? "+this.getBaseMetaTileEntity().isActive()); return true; } @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - switch (mTier) { - default: - return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); - } + return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - switch (mTier) { - default: - return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Rotor Hatch"); - } + return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Rotor Hatch"); } @Override @@ -122,6 +162,20 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { public int getInventoryStackLimit() { return 1; } + + public void damageTurbine(int aEUt, int damageFactorLow, float damageFactorHigh) { + if (hasTurbine() && MathUtils.randInt(0, 1) == 0) { + ItemStack aTurbine = getTurbine(); + ((GT_MetaGenerated_Tool) aTurbine.getItem()).doDamage(aTurbine, (long)getDamageToComponent(aTurbine) * (long) Math.min(aEUt / damageFactorLow, Math.pow(aEUt, damageFactorHigh))); + if (aTurbine.stackSize == 0) { + aTurbine = null; + } + } + } + + private final int getDamageToComponent(ItemStack aStack) { + return 1; + } @Override public void saveNBTData(NBTTagCompound aNBT) { @@ -138,22 +192,6 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - this.mUsingAnimation = Utils.invertBoolean(mUsingAnimation); - if (this.mUsingAnimation) { - PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); - } - else { - PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); - } - PlayerUtils.messagePlayer(aPlayer, "Has Controller: "+this.mHasController); - if (mHasController) { - PlayerUtils.messagePlayer(aPlayer, "Controller Location: "+this.mControllerLocation); - } - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (this.mHasController) { @@ -180,10 +218,10 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { public boolean isControllerActive() { GregtechMetaTileEntity_LargerTurbineBase x = getController(); if (x != null) { - Logger.INFO("Checking Status of Controller."); - return x.isMachineRunning(); + //Logger.INFO("Checking Status of Controller. Running? "+(x.mEUt > 0)); + return x.mEUt > 0; } - Logger.INFO("Status of Controller failed, controller is null."); + //Logger.INFO("Status of Controller failed, controller is null."); return false; } @@ -239,7 +277,7 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { private ITexture getFrontFacingTurbineTexture() { if (!mHasController) { - return this.getBaseMetaTileEntity().isActive() ? new GT_RenderedTexture(LargeTurbineTextureHandler.frontFaceHPActive_4) : new GT_RenderedTexture(LargeTurbineTextureHandler.frontFace_4 ); + return this.getBaseMetaTileEntity().isActive() ? new GT_RenderedTexture(LargeTurbineTextureHandler.OVERLAY_LP_TURBINE_ACTIVE[4] ) : new GT_RenderedTexture(LargeTurbineTextureHandler.OVERLAY_LP_TURBINE[4] ); } else { if (usingAnimations()) { @@ -271,46 +309,98 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { return false; } + public void setActive(boolean b) { + this.getBaseMetaTileEntity().setActive(b); + } + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + return false; + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!aPlayer.isSneaking()) { + PlayerUtils.messagePlayer(aPlayer, "Using Animations? "+usingAnimations()); + PlayerUtils.messagePlayer(aPlayer, "Has Controller? "+this.mHasController); + if (mHasController) { + PlayerUtils.messagePlayer(aPlayer, "Controller Location: "+BlockPos.generateBlockPos(mControllerLocation).getLocationString()); + PlayerUtils.messagePlayer(aPlayer, "Controller Active? "+this.isControllerActive()); + } + PlayerUtils.messagePlayer(aPlayer, "Active? "+this.getBaseMetaTileEntity().isActive()); + PlayerUtils.messagePlayer(aPlayer, "Has Turbine inserted? "+this.hasTurbine()); + if (this.hasTurbine()) { + Materials aMat = GT_MetaGenerated_Tool.getPrimaryMaterial(getTurbine()); + String aSize = GregtechMetaTileEntity_LargerTurbineBase.getTurbineSizeString(GregtechMetaTileEntity_LargerTurbineBase.getTurbineSize(getTurbine())); + PlayerUtils.messagePlayer(aPlayer, "Using: "+aMat.mLocalizedName+" "+aSize); + } + } + else { + this.mUsingAnimation = Utils.invertBoolean(mUsingAnimation); + if (this.mUsingAnimation) { + PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); + } + else { + PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); + } + } + } + @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { - // TODO Auto-generated method stub + public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (this.getBaseMetaTileEntity().isServerSide() && !aPlayer.isSneaking()) { + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if (tCurrentItem != null) { + if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) { + return onToolClick(tCurrentItem, aPlayer, aWrenchingSide); + } + } + } return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { - //Do Super - boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); - // Do Things + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (this.getBaseMetaTileEntity().isServerSide()) { ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem != null) { - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) { - if (mControllerLocation != null && mControllerLocation.length() > 0) { - if (setController(BlockPos.generateBlockPos(mControllerLocation))) { - if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - String tChat = "Trying to Reset linked Controller"; - IGregTechTileEntity g = this.getBaseMetaTileEntity(); - GT_Utility.sendChatToPlayer(aPlayer, tChat); - GT_Utility.sendSoundToPlayers(g.getWorld(), GregTech_API.sSoundList.get(101), 1.0F, -1, - g.getXCoord(), g.getYCoord(), g.getZCoord()); - } - } + if (tCurrentItem != null) { + if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) { + return onToolClick(tCurrentItem, aPlayer, aWrenchingSide); + } + } + } + return false; + } + + public boolean onToolClick(ItemStack tCurrentItem, EntityPlayer aPlayer, byte aSide) { + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { + boolean aHasTurbine = this.hasTurbine(); + if (aPlayer.inventory.getFirstEmptyStack() >= 0 && aHasTurbine) { + if (PlayerUtils.isCreative(aPlayer) || GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { + aPlayer.inventory.addItemStackToInventory((this.getTurbine())); + this.mInventory[0] = null; + GT_Utility.sendChatToPlayer(aPlayer, "Removed turbine with wrench."); + return true; + } + } + else { + GT_Utility.sendChatToPlayer(aPlayer, aHasTurbine ? "Cannot remove turbine, no free inventory space." : "No turbine to remove."); + } + } + else if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { + if (mControllerLocation != null && mControllerLocation.length() > 0) { + if (setController(BlockPos.generateBlockPos(mControllerLocation))) { + if (PlayerUtils.isCreative(aPlayer) || GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { + String tChat = "Trying to Reset linked Controller"; + IGregTechTileEntity g = this.getBaseMetaTileEntity(); + GT_Utility.sendChatToPlayer(aPlayer, tChat); + GT_Utility.sendSoundToPlayers(g.getWorld(), GregTech_API.sSoundList.get(101), 1.0F, -1, g.getXCoord(), g.getYCoord(), g.getZCoord()); + return true; } } } } - return aSuper; + return false; } - public void setActive(boolean b) { - this.getBaseMetaTileEntity().setActive(b); - } - - - - - -}*/ +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java index 422837fa46..fdc8a7777b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java @@ -2,20 +2,52 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; import java.util.Locale; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.item.ItemStack; public abstract class CustomMetaTileBase extends MetaTileEntity { + + private IBaseCustomMetaTileEntity mBaseCustomMetaTileEntity2; + + /** + * accessibility to this Field is no longer given, see below + */ + private IGregTechTileEntity mBaseCustomMetaTileEntity; + public CustomMetaTileBase(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { super(aID, aBasicName, aRegionalName, aInvSlotCount); GT_LanguageManager.addStringLocalization("gtpp.blockmachines." + aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH) + ".name", aRegionalName); this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity()); - this.getBaseMetaTileEntity().setMetaTileID((short) aID); + this.getBaseMetaTileEntity().setMetaTileID((short) aID); + mBaseCustomMetaTileEntity2 = (IBaseCustomMetaTileEntity) getBaseMetaTileEntity(); } + + @Override + public IGregTechTileEntity getBaseMetaTileEntity() { + return mBaseCustomMetaTileEntity; + } + + public IBaseCustomMetaTileEntity getBaseCustomMetaTileEntity() { + return mBaseCustomMetaTileEntity2; + } + + @Override + public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { + super.setBaseMetaTileEntity(aBaseMetaTileEntity); + if (mBaseCustomMetaTileEntity != null && aBaseMetaTileEntity == null) { + mBaseCustomMetaTileEntity.getMetaTileEntity().inValidate(); + mBaseCustomMetaTileEntity.setMetaTileEntity(null); + } + mBaseCustomMetaTileEntity = aBaseMetaTileEntity; + if (mBaseCustomMetaTileEntity != null) { + mBaseCustomMetaTileEntity.setMetaTileEntity(this); + } + } public CustomMetaTileBase(String aName, int aInvSlotCount) { super(aName, aInvSlotCount); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java index 768a57f8b2..d0021f8358 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java @@ -87,6 +87,7 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer public String[] getDescription() { return new String[] { this.mDescription, "Accepts 4A and outputs 16A", + "Toggle 2A/8A half-mode with Screwdriver", CORE.GT_Tooltip}; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 356f96f7cc..1232166baa 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -40,7 +40,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; -import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -94,7 +93,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En private static final Method findRecipe09; public GT_Recipe mLastRecipe; - private MultiblockRequirements mRequirements; private boolean mInternalCircuit = false; protected long mTotalRunTime = 0; protected boolean mVoidExcess = false; @@ -191,81 +189,102 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En @Override public final String[] getInfoData() { ArrayList<String> mInfo = new ArrayList<String>(); - if (!this.getMetaName().equals("")) { - mInfo.add(this.getMetaName()); - } - - String[] extra = getExtraInfoData(); - - if (extra == null) { - extra = new String[0]; - } - if (extra.length > 0) { - for (String s : extra) { - mInfo.add(s); + try { + if (!this.getMetaName().equals("")) { + mInfo.add(this.getMetaName()); } - } - - long seconds = (this.mTotalRunTime/20); - int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); - int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); - long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks); - long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); - long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); - - int mPollutionReduction = getPollutionReductionForAllMufflers(); - long storedEnergy = getStoredEnergyInAllEnergyHatches(); - long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches(); - int tTier = this.getControlCoreTier(); - mInfo.add(getMachineTooltip()); - + String[] extra = getExtraInfoData(); - //Lets borrow the GTNH handling - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ - EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s"); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+ - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU"); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+ - EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t"); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+ - EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ - EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.problems")+": "+ - EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ - " "+StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ - EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); + if (extra == null) { + extra = new String[0]; + } + if (extra.length > 0) { + for (String s : extra) { + mInfo.add(s); + } + } + long seconds = (this.mTotalRunTime/20); + int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); + int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); + long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks); + long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); + long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); + + mInfo.add(getMachineTooltip()); + + //Lets borrow the GTNH handling + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ + EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ + EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s"); + + + if (!this.mAllEnergyHatches.isEmpty()) { + long storedEnergy = getStoredEnergyInAllEnergyHatches(); + long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches(); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU")); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ + EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET)); + ; + } + if (!this.mAllDynamoHatches.isEmpty()) { + long storedEnergy = getStoredEnergyInAllDynamoHatches(); + long maxEnergy = getMaxEnergyStorageOfAllDynamoHatches(); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+" In Dynamos:"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU")); + } - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + this.getPollutionPerTick(null)*20+ EnumChatFormatting.RESET+"/sec"); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"); + if (-mEUt > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t")); + } + else { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Integer.toString(mEUt) + EnumChatFormatting.RESET + " EU/t")); + } + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.problems")+": "+ + EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ + " "+StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ + EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); - mInfo.add(StatCollector.translateToLocal("GTPP.CC.machinetier")+": "+ - EnumChatFormatting.GREEN+tTier+EnumChatFormatting.RESET); + if (this.getPollutionPerSecond(null) > 0) { + int mPollutionReduction = getPollutionReductionForAllMufflers(); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + this.getPollutionPerSecond(null)+ EnumChatFormatting.RESET+"/sec"); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"); + } - mInfo.add(StatCollector.translateToLocal("GTPP.CC.discount")+": "+ - EnumChatFormatting.GREEN+(getEuDiscountForParallelism())+EnumChatFormatting.RESET + "%"); + if (this.mControlCoreBus.size() > 0) { + int tTier = this.getControlCoreTier(); + mInfo.add(StatCollector.translateToLocal("GTPP.CC.machinetier")+": "+ + EnumChatFormatting.GREEN+tTier+EnumChatFormatting.RESET); + } - mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(getMaxParallelRecipes())+EnumChatFormatting.RESET); + mInfo.add(StatCollector.translateToLocal("GTPP.CC.discount")+": "+ + EnumChatFormatting.GREEN+(getEuDiscountForParallelism())+EnumChatFormatting.RESET + "%"); + mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(getMaxParallelRecipes())+EnumChatFormatting.RESET); - mInfo.add("Total Time Since Built: " + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks, " + EnumChatFormatting.DARK_GREEN+ Integer.toString(days) +EnumChatFormatting.RESET+ " Days, "); - mInfo.add(EnumChatFormatting.DARK_GREEN + Long.toString(hours) +EnumChatFormatting.RESET + " Hours, " + EnumChatFormatting.DARK_GREEN+ Long.toString(minutes) +EnumChatFormatting.RESET+ " Minutes, " + EnumChatFormatting.DARK_GREEN+ Long.toString(second) +EnumChatFormatting.RESET+ " Seconds."); - mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + Long.toString(this.mTotalRunTime)); + mInfo.add("Total Time Since Built: " + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks, " + EnumChatFormatting.DARK_GREEN+ Integer.toString(days) +EnumChatFormatting.RESET+ " Days, "); + mInfo.add(EnumChatFormatting.DARK_GREEN + Long.toString(hours) +EnumChatFormatting.RESET + " Hours, " + EnumChatFormatting.DARK_GREEN+ Long.toString(minutes) +EnumChatFormatting.RESET+ " Minutes, " + EnumChatFormatting.DARK_GREEN+ Long.toString(second) +EnumChatFormatting.RESET+ " Seconds."); + mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + Long.toString(this.mTotalRunTime)); - String[] mInfo2 = new String[mInfo.size()]; - mInfo.toArray(mInfo2); - return mInfo2; + String[] mInfo2 = mInfo.toArray(new String[mInfo.size()]); + return mInfo2; + } + catch (Throwable t) { + t.printStackTrace(); + } + return new String[] {}; } @@ -282,7 +301,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public long getStoredEnergyInAllEnergyHatches() { long storedEnergy=0; - for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + for(GT_MetaTileEntity_Hatch tHatch : mAllEnergyHatches) { if (isValidMetaTileEntity(tHatch)) { storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); } @@ -292,7 +311,27 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public long getMaxEnergyStorageOfAllEnergyHatches() { long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + for(GT_MetaTileEntity_Hatch tHatch : mAllEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + return maxEnergy; + } + + public long getStoredEnergyInAllDynamoHatches() { + long storedEnergy=0; + for(GT_MetaTileEntity_Hatch tHatch : mAllDynamoHatches) { + if (isValidMetaTileEntity(tHatch)) { + storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); + } + } + return storedEnergy; + } + + public long getMaxEnergyStorageOfAllDynamoHatches() { + long maxEnergy=0; + for(GT_MetaTileEntity_Hatch tHatch : mAllDynamoHatches) { if (isValidMetaTileEntity(tHatch)) { maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); } @@ -316,17 +355,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public final static String TAG_HIDE_POLLUTION = "TAG_HIDE_POLLUTION"; public final static String TAG_HIDE_MACHINE_TYPE = "TAG_HIDE_MACHINE_TYPE"; - public synchronized final MultiblockRequirements getRequirements() { - return mRequirements; - } - - //public abstract MultiblockRequirements setRequirements(); - - public synchronized final void setRequirementsInternal() { - //this.mRequirements = setRequirements(); - this.mRequirements = null; - } - public int getAmountOfOutputs() { return 1; } @@ -725,26 +753,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); } - public boolean checkRecipeGeneric(GT_Recipe aRecipe, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, boolean isPerfectOC) { - if (aRecipe == null) { - return false; - } - ArrayList<ItemStack> tItems = getStoredInputs(); - ArrayList<FluidStack> tFluids = getStoredFluids(); - ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); - FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe, isPerfectOC); - } - - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll) { - return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null, false); - } - public boolean checkRecipeGeneric(GT_Recipe aRecipe, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { @@ -755,14 +763,14 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En ArrayList<FluidStack> tFluids = getStoredFluids(); ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe, false); + return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); } public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, boolean isPerfectOC) { - return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null, isPerfectOC); + int aSpeedBonusPercent, int aOutputChanceRoll) { + return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null); } @@ -913,10 +921,14 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return rEnergy; } + public boolean hasPerfectOverclock() { + return false; + } + public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) { + int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats @@ -931,7 +943,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En log("Running checkRecipeGeneric(0)"); GT_Recipe tRecipe = findRecipe( - getBaseMetaTileEntity(), mLastRecipe, false, + getBaseMetaTileEntity(), mLastRecipe, false, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); log("Running checkRecipeGeneric(1)"); @@ -1041,8 +1053,12 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } else { while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; - if (isPerpectOC) this.mMaxProgresstime /= 4; - else this.mMaxProgresstime /= 2; + if (hasPerfectOverclock()) { + this.mMaxProgresstime /= 4; + } + else { + this.mMaxProgresstime /= 2; + } } } @@ -1284,7 +1300,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En //Bad modify, let's just use the original recipe. if (!mHasBoostedCurrentRecipe || mBoostedRecipe == null) { tRecipe = aRecipe != null ? aRecipe : findRecipe( - getBaseMetaTileEntity(), mLastRecipe, false, + getBaseMetaTileEntity(), mLastRecipe, false, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); } @@ -1452,7 +1468,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public boolean isMachineRunning() { boolean aRunning = this.getBaseMetaTileEntity().isActive(); - log("Queried Multiblock is currently running: "+aRunning); + //log("Queried Multiblock is currently running: "+aRunning); return aRunning; } @@ -1662,7 +1678,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } public boolean checkHatch() { - return mMaintenanceHatches.size() <= 1 && !mMufflerHatches.isEmpty(); + return mMaintenanceHatches.size() <= 1 && (this.getPollutionPerSecond(null) > 0 ? !mMufflerHatches.isEmpty() : true); } public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { @@ -2426,7 +2442,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } else { try { - return (GT_Recipe) findRecipe09.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs); + return (GT_Recipe) findRecipe09.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); return null; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java deleted file mode 100644 index 7af6af2ffd..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java +++ /dev/null @@ -1,469 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.api.objects.data.Triplet; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer.LayerBlockData; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraftforge.common.util.ForgeDirection; - -public abstract class MultiblockBlueprint { - - private final MultiblockLayer[] mBlueprintData; - - public final int height; - public final int width; - public final int depth; - public final int mMinimumCasingCount; - public final int mTextureID; - - /** - * Cached Matrix of the Multiblock, which makes future structural checks far quicker. - */ - private final BlockPos[][][] StructureMatrix; - - /** - * Has {@value StructureMatrix} been set yet? - */ - @SuppressWarnings("unused") - private boolean mGeneratedMatrix = false; - - /** - * A detailed class which will contain blueprints for a Multiblock. - * Values are not relative to the controller, but in total. - * @param x - Overall width - * @param y - Overall height - * @param z - Overall depth - * @param aMinimumCasings - The lowest amount of casings required - * @param aTextureID - The texture ID used by hatches. - */ - public MultiblockBlueprint(final int x, final int y, final int z, final int aMinimumCasings, final int aTextureID) { - mBlueprintData = new MultiblockLayer[y]; - height = y; - width = x; - depth = z; - mMinimumCasingCount = aMinimumCasings; - mTextureID = aTextureID; - StructureMatrix = new BlockPos[width][height][depth]; - //Logger.INFO("Created new Blueprint."); - } - - /** - * - * @param aY - The Y level of the layer to return, where 0 is the bottom and N is the top. - * @return - A {@link MultiblockLayer} object. - */ - public MultiblockLayer getLayer(int aY) { - return mBlueprintData[aY]; - } - - /** - * - * @param aLayer - A {@link MultiblockLayer} object. - * @param aY - The Y level of the layer, where 0 is the bottom and N is the top. - * - */ - public void setLayer(MultiblockLayer aLayer, int aY) { - mBlueprintData[aY] = aLayer; - } - - public MultiblockLayer getControllerLayer() { - for (MultiblockLayer u : mBlueprintData) { - if (u.hasController()) { - return u; - } - } - return null; - } - - public int getControllerY() { - int i = 0; - for (MultiblockLayer u : mBlueprintData) { - if (u.hasController()) { - return i; - } - i++; - } - return 0; - } - - @SuppressWarnings({ "unused", "rawtypes" }) - public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity) { - //Check for Nulls - if (aBaseMetaTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - GT_MetaTileEntity_MultiBlockBase aControllerObject = null; - if (aMetaTileEntity instanceof GT_MetaTileEntity_MultiBlockBase) { - aControllerObject = (GT_MetaTileEntity_MultiBlockBase) aMetaTileEntity; - } - if (aControllerObject == null) { - return false; - } - - //Get some Vars - int xOffSetMulti = ((this.getControllerLayer().width-1)/2); - int zOffSetMulti = ((this.getControllerLayer().depth-1)/2); - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * xOffSetMulti; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * zOffSetMulti; - ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()); - int tAmount = 0; - - int contX = aControllerObject.getBaseMetaTileEntity().getXCoord(), contY = aControllerObject.getBaseMetaTileEntity().getYCoord(), contZ = aControllerObject.getBaseMetaTileEntity().getZCoord(); - - Logger.INFO("Controller is located at ["+contX+", "+contY+", "+contZ+"]"); - - boolean debugCacheDataVisually = true; - - - if (/*!mGeneratedMatrix || StructureMatrix == null*/ true) { - //Try Fancy Cache Stuff - BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, 0, 0, 0); - for (int Y = 0; Y < height; Y++) { - for (int Z = 0; Z < depth; Z++) { - for (int X = 0; X < width; X++) { - int offsetX, offsetZ; - Pair<Integer, Integer> j = MultiblockLayer.rotateOffsetValues(aDir, X, Z); - offsetX = j.getKey(); - offsetZ = j.getValue(); - - Logger.INFO("Pre-Rotated Offsets ["+X+", "+(aPos.yPos + Y)+", "+Z+"] | "+aDir.name()); - Logger.INFO("Rotated Offsets ["+offsetX+", "+(aPos.yPos + Y)+", "+offsetZ+"]"); - - // Resolve Negatives - int negTestX, negTestZ; - if (aPos.xPos < 0) { - int testA = aPos.xPos; - testA -= -offsetX; - negTestX = testA; - } else { - negTestX = offsetX + aPos.xPos; - } - if (aPos.zPos < 0) { - int testA = aPos.zPos; - testA -= -offsetZ; - negTestZ = testA; - } else { - negTestZ = offsetZ + aPos.zPos; - } - Logger.INFO("Caching With Offset ["+negTestX+", "+(aPos.yPos + Y)+", "+negTestZ+"]"); - StructureMatrix[X][Y][Z] = new BlockPos(negTestX, (aPos.yPos + Y), negTestZ, aPos.world); - - if (debugCacheDataVisually) { - aBaseMetaTileEntity.getWorld().setBlock(negTestX, (aPos.yPos + Y), negTestZ, Blocks.glass); - } - } - } - } - Logger.INFO("Cached blueprint matrix."); - mGeneratedMatrix = true; - } - else { - Logger.INFO("Found cached blueprint matrix."); - } - - if (StructureMatrix == null) { - Logger.INFO("Error caching blueprint matrix."); - return false; - } - - - int a1, a2, a3; - a1 = StructureMatrix.length; - a2 = StructureMatrix[0].length; - a3 = StructureMatrix[0][0].length; - - Logger.INFO("Matrix Size ["+a1+", "+a2+", "+a3+"]"); - - for (int H = 0; H < a2; H++) { - - MultiblockLayer currentLayer = this.getLayer(H); - for (int W = 0; W < a1; W++) { - for (int D = 0; D < a3; D++) { - - BlockPos aToCheck = StructureMatrix[W][H][D]; - if (aToCheck == null) { - Logger.INFO("Found bad data stored at X: "+W+", Y: "+H+", Z: "+D); - continue; - } - else { - //Logger.INFO("Found data stored at X: "+W+", Y: "+H+", Z: "+D); - Logger.INFO("Checking "+aToCheck.getLocationString()); - } - - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntity(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos); - final Block tBlock = aBaseMetaTileEntity.getBlock(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos); - final int tMeta = aBaseMetaTileEntity.getMetaID(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos); - - - LayerBlockData g1 = currentLayer.getDataFromCoordsWithDirection(aDir, W, D); - if (g1 == null) { - Logger.INFO("Failed to find LayerBlockData. Using AIR_FALLBACK"); - //return false;*/ - g1 = LayerBlockData.FALLBACK_AIR_CHECK; - } - else { - if (g1.isController) { - Logger.INFO("Controller is at X: "+W+", Y: "+H+", Z: "+D); - } - } - - boolean isMatch = g1.match(tBlock, tMeta); - - - if (!isMatch) { - Logger.INFO("Checking ["+aToCheck.xPos+", "+ aToCheck.yPos +", "+ aToCheck.zPos+"]"); - Logger.INFO("Checking Position relative to Grid. X: "+W+", Y: "+H+", Z: "+D); - Logger.INFO("Found "+tBlock.getLocalizedName()+" : "+tMeta + " | Bad ["+W+", "+D+"]"); - - LayerBlockData g = currentLayer.getDataFromCoordsWithDirection(aDir, W, D); - - if (g == null) { - Logger.INFO("Expected "+" BAD DATA - Possibly Unset Area in Blueprint."); - - } - else { - Logger.INFO("Expected "+g.mBlock.getLocalizedName()+" : "+g.mMeta + ""); - } - aBaseMetaTileEntity.getWorld().setBlock(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos, g.mBlock); - aBaseMetaTileEntity.getWorld().setBlockMetadataWithNotify(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos, g.mMeta, 4); - //return false; - } - else { - - LayerBlockData g = currentLayer.getDataFromCoordsWithDirection(aDir, W, D); - - - - - - - - - - - - - - - - - - - - boolean isHatchValidType = false; - if (g != null) { - if (g.canBeHatch && !g.isController && tTileEntity != null) { - IMetaTileEntity aMetaTileEntity2 = tTileEntity.getMetaTileEntity(); - if (aMetaTileEntity2 != null) { - if (aMetaTileEntity2 instanceof GT_MetaTileEntity_MultiBlockBase) { - isHatchValidType = true; - break; - } - else { - for (Class c : g.mHatchClass) { - if (c != null) { - if (c.isInstance(aMetaTileEntity2)) { - isHatchValidType = true; - break; - } - } - } - } - } - } - } - - if (!isHatchValidType && !g.isController && tTileEntity != null) { - Logger.INFO("Checking ["+aToCheck.xPos+", "+ aToCheck.yPos +", "+ aToCheck.zPos+"]"); - Logger.INFO("Hatch Type did not match allowed types. "+tTileEntity.getClass().getSimpleName()); - return false; - } - if (!aControllerObject.addToMachineList(tTileEntity, mTextureID)) { - tAmount++; - } - - - } - } - } - } - - boolean hasCorrectHatches = ( - aControllerObject.mInputBusses.size() >= this.getMinimumInputBus() && - aControllerObject.mOutputBusses.size() >= this.getMinimumOutputBus() && - aControllerObject.mInputHatches.size() >= this.getMinimumInputHatch() && - aControllerObject.mOutputHatches.size() >= this.getMinimumOutputHatch() && - aControllerObject.mDynamoHatches.size() >= this.getMinimumOutputEnergy() && - aControllerObject.mEnergyHatches.size() >= this.getMinimumInputEnergy() && - aControllerObject.mMaintenanceHatches.size() >= this.getMinimumMaintHatch() && - aControllerObject.mMufflerHatches.size() >= this.getMinimumMufflers()); - - - Logger.INFO("mInputBusses: "+aControllerObject.mInputBusses.size()); - Logger.INFO("mOutputBusses: "+aControllerObject.mOutputBusses.size()); - Logger.INFO("mInputHatches: "+aControllerObject.mInputHatches.size()); - Logger.INFO("mOutputHatches: "+aControllerObject.mOutputHatches.size()); - Logger.INFO("mEnergyHatches: "+aControllerObject.mEnergyHatches.size()); - Logger.INFO("mDynamoHatches: "+aControllerObject.mDynamoHatches.size()); - Logger.INFO("mMaintenanceHatches: "+aControllerObject.mMaintenanceHatches.size()); - Logger.INFO("mMufflerHatches: "+aControllerObject.mMufflerHatches.size()); - - boolean built = hasCorrectHatches && tAmount >= mMinimumCasingCount; - Logger.INFO("Built? "+built); - Logger.INFO("hasCorrectHatches? "+hasCorrectHatches); - Logger.INFO("tAmount? "+tAmount); - return built; - } - - public BlockPos getOffsetRelativeToGridPosition(final IGregTechTileEntity aBaseMetaTileEntity, final int x, final int y, final int z) { - - if (aBaseMetaTileEntity == null) { - return null; - } - - int controllerX, controllerY, controllerZ; - MultiblockLayer layerController = this.getControllerLayer(); - - if (layerController == null) { - return null; - } - - int controllerYRelative = this.getControllerY(); - Pair<Integer, Integer> controllerLocationRelativeToGrid = layerController.getControllerLocation(); - - if (controllerLocationRelativeToGrid == null) { - return null; - } - - controllerX = aBaseMetaTileEntity.getXCoord(); - controllerY = aBaseMetaTileEntity.getYCoord(); - controllerZ = aBaseMetaTileEntity.getZCoord(); - - Logger.INFO("Controller is at ["+controllerX+", "+controllerY+", "+controllerZ+"]"); - - ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()); - Logger.INFO("Controller is facing "+aDir.name()); - - //Find Bottom Left corner of Structure - // 0, 0, 0 - - int offsetX, offsetY, offsetZ; - int X = controllerLocationRelativeToGrid.getKey(), Z = controllerLocationRelativeToGrid.getValue(); - Logger.INFO("Attempting to translate offsets ["+X+", "+Z+"]"); - if (aDir == ForgeDirection.NORTH) { - offsetX = -X; - offsetZ = -Z; - } - - else if (aDir == ForgeDirection.EAST) { - offsetX = Z; - offsetZ = -X; - } - - else if (aDir == ForgeDirection.SOUTH) { - offsetX = X; - offsetZ = Z; - } - - else if (aDir == ForgeDirection.WEST) { - offsetX = -Z; - offsetZ = X; - } - else { - offsetX = -X; - offsetZ = -Z; - } - - offsetY = -controllerYRelative; - - Logger.INFO("Attempting to use offsets ["+offsetX+", "+offsetY+", "+offsetZ+"]"); - - //Resolve Negatives - int negTestX, negTestZ; - if (controllerX < 0) { - Logger.INFO("Found Negative X Pos."); - int testA = controllerX; - testA -= offsetX; - Logger.INFO("Adding Inverted Offset of "+offsetX+", making "+testA); - negTestX = testA; - } - else { - negTestX = offsetX + controllerX; - } - if (controllerZ < 0) { - Logger.INFO("Found Negative Z Pos."); - int testA = controllerZ; - testA -= -offsetZ; - Logger.INFO("Adding Inverted Offset of "+offsetZ+", making "+testA); - negTestZ = testA; - } - else { - negTestZ = offsetZ + controllerZ; - } - - - //} - //Bottom left Corner position - BlockPos p = new BlockPos(negTestX, offsetY+controllerY, negTestZ, aBaseMetaTileEntity.getWorld()); - - Logger.INFO("World XYZ for Bottom left Corner Block of structure ["+p.xPos+", "+p.yPos+", "+p.zPos+"]"); - - //Add the xyz relative to the grid. - BlockPos offsetPos = new BlockPos(p.xPos+x, p.yPos+y, p.zPos+z, aBaseMetaTileEntity.getWorld()); - Logger.INFO("World XYZ for Target Check Block in structure ["+offsetPos.xPos+", "+offsetPos.yPos+", "+offsetPos.zPos+"]"); - - return p; - } - - - public IGregTechTileEntity getTileAtOffset(final IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z){ - BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, x, y, z); - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(aPos.xPos, aPos.yPos, aPos.zPos); - //aBaseMetaTileEntity.getWorld().setBlock(xh, yh, zh, Blocks.gold_ore); - return tTileEntity; - } - - public Pair<Block, Integer> getBlockAtOffset(final IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z){ - BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, x, y, z); - final Block tBlock = aBaseMetaTileEntity.getBlockOffset(aPos.xPos, aPos.yPos, aPos.zPos); - final int tMeta = aBaseMetaTileEntity.getMetaIDOffset(aPos.xPos, aPos.yPos, aPos.zPos); - return new Pair<Block, Integer>(tBlock, tMeta); - } - - public Triplet<Integer, Integer, Integer> getOffsetFromControllerTo00(){ - MultiblockLayer l = this.getControllerLayer(); - if (l == null) { - return null; - } - int yOffset = this.getControllerY(); - Pair<Integer, Integer> cl = l.getControllerLocation(); - - if (cl == null) { - return null; - } - - return new Triplet<Integer, Integer, Integer> (cl.getKey(), yOffset, cl.getValue()); - //return new Triplet<Integer, Integer, Integer> (cl.getKey(), yOffset, cl.getValue()); - - } - - public abstract int getMinimumInputBus(); - public abstract int getMinimumInputHatch(); - public abstract int getMinimumOutputBus(); - public abstract int getMinimumOutputHatch(); - public abstract int getMinimumInputEnergy(); - public abstract int getMinimumOutputEnergy(); - public abstract int getMinimumMaintHatch(); - public abstract int getMinimumMufflers(); - -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java deleted file mode 100644 index c5554a6679..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java +++ /dev/null @@ -1,643 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import java.util.HashMap; - -import gregtech.api.GregTech_API; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.init.Blocks; -import net.minecraftforge.common.util.ForgeDirection; - -public class MultiblockLayer { - - public final int width; - public final int depth; - - private boolean mFinalised; - - - /** - * WARNING!! May be {@link null}. - */ - private Pair<Integer, Integer> mControllerLocation; - - /** - * Holds the North facing Orientation data. - */ - public final LayerBlockData[][] mLayerData; - public final AutoMap<LayerBlockData[][]> mVariantOrientations = new AutoMap<LayerBlockData[][]>(); - - /** - * A detailed class which will contain a single x/z Layer for a {@link MultiblockBlueprint}. - * Values are not relative, but in total. - * @param x - Overall width - * @param z - Overall depth - */ - public MultiblockLayer(final int x, final int z) { - width = x; - depth = z; - mLayerData = new LayerBlockData[x][z]; - //Logger.INFO("Created new Blueprint Layer."); - } - - /** - * A detailed class which will contain a single x/z Layer for a {@link MultiblockBlueprint}. - * Values are not relative, but in total. - */ - public MultiblockLayer(final LayerBlockData[][] aData) { - width = aData.length; - depth = aData[0].length; - mLayerData = aData; - } - - /** - * - * @param aBlock - The block expected as this location. - * @param aMeta - The meta for the block above. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @param canBeHatch - is this location able to be substituted for any hatch? - * @return - Is this data added to the layer data map? - */ - public boolean addBlockForPos(Block aBlock, int aMeta, int x, int z, boolean canBeHatch) { - return addBlockForPos(aBlock, aMeta, x, z, canBeHatch, new Class[] {}); - } - - /** - * - * @param aBlock - The block expected as this location. - * @param aMeta - The meta for the block above. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @param canBeHatch - is this location able to be substituted for a hatch? - * @param aHatchTypeClass - Specify the class for the hatch if you want it explicit. Use base classes to allow custom hatches which extend. - * @return - Is this data added to the layer data map? - */ - public boolean addBlockForPos(Block aBlock, int aMeta, int x, int z, boolean canBeHatch, Class aHatchTypeClass) { - return addBlockForPos(aBlock, aMeta, x, z, canBeHatch, new Class[] {aHatchTypeClass}); - } - - /** - * - * @param aBlock - The block expected as this location. - * @param aMeta - The meta for the block above. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @param canBeHatch - is this location able to be substituted for a hatch? - * @param aHatchTypeClass - Specify the class for the hatch if you want it explicit. Use base classes to allow custom hatches which extend. - * @return - Is this data added to the layer data map? - */ - public boolean addBlockForPos(Block aBlock, int aMeta, int x, int z, boolean canBeHatch, Class[] aHatchTypeClass) { - if (x > width -1) { - return false; - } - if (z > depth - 1) { - return false; - } - - if (canBeHatch && (aHatchTypeClass == null || aHatchTypeClass.length <= 0)){ - - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - aHatchTypeClass = new Class[] { - GT_MetaTileEntity_Hatch_Dynamo.class, - GT_MetaTileEntity_Hatch_Energy.class, - GT_MetaTileEntity_Hatch_Input.class, - GT_MetaTileEntity_Hatch_InputBus.class, - GT_MetaTileEntity_Hatch_Maintenance.class, - GT_MetaTileEntity_Hatch_Muffler.class, - GT_MetaTileEntity_Hatch_Output.class, - GT_MetaTileEntity_Hatch_OutputBus.class, - GT_MetaTileEntity_Hatch.class - }; - } - else { - Class aDataHatch = ReflectionUtils.getClass("gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess"); - if (aDataHatch != null) { - aHatchTypeClass = new Class[] { - aDataHatch, - GT_MetaTileEntity_Hatch_Dynamo.class, - GT_MetaTileEntity_Hatch_Energy.class, - GT_MetaTileEntity_Hatch_Input.class, - GT_MetaTileEntity_Hatch_InputBus.class, - GT_MetaTileEntity_Hatch_Maintenance.class, - GT_MetaTileEntity_Hatch_Muffler.class, - GT_MetaTileEntity_Hatch_Output.class, - GT_MetaTileEntity_Hatch_OutputBus.class, - GT_MetaTileEntity_Hatch.class - }; - } else { - aHatchTypeClass = new Class[] { - GT_MetaTileEntity_Hatch_Dynamo.class, - GT_MetaTileEntity_Hatch_Energy.class, - GT_MetaTileEntity_Hatch_Input.class, - GT_MetaTileEntity_Hatch_InputBus.class, - GT_MetaTileEntity_Hatch_Maintenance.class, - GT_MetaTileEntity_Hatch_Muffler.class, - GT_MetaTileEntity_Hatch_Output.class, - GT_MetaTileEntity_Hatch_OutputBus.class, - GT_MetaTileEntity_Hatch.class - }; - } - } - } - - - - mLayerData[x][z] = new LayerBlockData(aBlock, aMeta, canBeHatch, aHatchTypeClass); - return true; - } - - /** - * Adds a controller to the layer at the designated location, Details about the controller do not need to be specified. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addController(int x, int z) { - setControllerLocation(new Pair<Integer, Integer>(x, z)); - return addBlockForPos(GregTech_API.sBlockMachines, 0, x, z, true, GT_MetaTileEntity_MultiBlockBase.class); - } - - - /** - * Adds a Muffler to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addMuffler(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Muffler.class); - } - - - /** - * Adds a Maint Hatch to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addMaintHatch(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Maintenance.class); - } - - - /** - * Adds ah Input to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addInputBus(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_InputBus.class); - } - - - /** - * Adds an Output to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addOutputBus(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_OutputBus.class); - } - - /** - * Adds ah Input to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addInputHatch(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Input.class); - } - - - /** - * Adds an Output to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addOutputHatch(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Output.class); - } - - /** - * Adds ah Input to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addInput(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, new Class[] {GT_MetaTileEntity_Hatch_Input.class, GT_MetaTileEntity_Hatch_InputBus.class}); - } - - - /** - * Adds an Output to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addOutput(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, new Class[] {GT_MetaTileEntity_Hatch_Output.class, GT_MetaTileEntity_Hatch_OutputBus.class}); - } - - /** - * Adds ah Input to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addEnergyInput(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Energy.class); - } - - - /** - * Adds an Output to the layer at the designated location. - * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. - * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. - * @return - Is this controller added to the layer data map? - */ - public boolean addEnergyOutput(Block aBlock, int aMeta, int x, int z) { - return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Dynamo.class); - } - - /** - * - * @param aBlock - The block you expect. - * @param aMeta - The meta you expect. - * @param x - the non-relative x location you expect it. - * @param z - the non-relative z location you expect it. - * @param aDir - The direction the controller is facing. - * @return - True if the correct Block was found. May also return true if a hatch is found when allowed or it's the controller. - */ - public boolean getBlockForPos(Block aBlock, int aMeta, int x, int z, ForgeDirection aDir) { - //Logger.INFO("Grid Index X: "+x+" | Z: "+z + " | "+aDir.name()); - LayerBlockData g; - if (aDir == ForgeDirection.SOUTH) { - g = mVariantOrientations.get(2)[x][z]; - } - else if (aDir == ForgeDirection.WEST) { - g = mVariantOrientations.get(3)[x][z]; - } - else if (aDir == ForgeDirection.NORTH) { - LayerBlockData[][] aData = mVariantOrientations.get(0); - if (aData != null) { - //Logger.INFO("Found Valid Orientation Data. "+aData.length + ", "+aData[0].length); - g = aData[x][z]; - } - else { - //Logger.INFO("Did not find valid orientation data."); - g = null; - } - } - else if (aDir == ForgeDirection.EAST) { - g = mVariantOrientations.get(1)[x][z]; - } - else { - g = mLayerData[x][z]; - } - if (g == null) { - Logger.INFO("Failed to find LayerBlockData. Using AIR_FALLBACK"); - //return false;*/ - g = LayerBlockData.FALLBACK_AIR_CHECK; - } - - return g.match(aBlock, aMeta); - } - - - - /** - * Is this layer final? - * @return - If true, layer data cannot be edited. - */ - public final boolean isLocked() { - return mFinalised; - } - - /** - * Used to finalize the layer, after which all four Orientations are then generated. - * Cannot be set to false, useful for not locking the layer if an error occurs. - * @param lockData - */ - public final void lock(boolean lockData) { - if (!lockData) { - Logger.INFO("Failed to lock layer"); - return; - } - //Logger.INFO("Trying to lock layer"); - this.mFinalised = true; - generateOrientations(); - //Logger.INFO("Trying to Build Blueprint Layer [Constructed orietations & finalized]"); - } - - private void generateOrientations() { - try { - - //Logger.INFO("Trying to gen orients for layer"); - //North - mVariantOrientations.put(mLayerData); - LayerBlockData[][] val; - //Logger.INFO("1 done"); - //East - val = rotateArrayClockwise(mLayerData); - mVariantOrientations.put((LayerBlockData[][]) val); - //Logger.INFO("2 done"); - //South - val = rotateArrayClockwise(mLayerData); - mVariantOrientations.put((LayerBlockData[][]) val); - //Logger.INFO("3 done"); - //West - val = rotateArrayClockwise(mLayerData); - mVariantOrientations.put((LayerBlockData[][]) val); - //Logger.INFO("4 done"); - - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - public static LayerBlockData[][] rotateArrayClockwise(LayerBlockData[][] mat) { - //Logger.INFO("Rotating Layer 90' Clockwise"); - try { - final int M = mat.length; - final int N = mat[0].length; - //Logger.INFO("Dimension X: "+M); - //Logger.INFO("Dimension Z: "+N); - LayerBlockData[][] ret = new LayerBlockData[N][M]; - for (int r = 0; r < M; r++) { - for (int c = 0; c < N; c++) { - ret[c][M-1-r] = mat[r][c]; - } - } - //Logger.INFO("Returning Rotated Layer"); - return ret; - } - catch (Throwable t) { - t.printStackTrace(); - return null; - } - } - - public boolean hasController() { - if (getControllerLocation() == null) { - return false; - } - return true; - } - - public Pair<Integer, Integer> getControllerLocation() { - return mControllerLocation; - } - - public void setControllerLocation(Pair<Integer, Integer> mControllerLocation) { - if (hasController()) { - return; - } - this.mControllerLocation = mControllerLocation; - } - - public LayerBlockData getDataFromCoordsWithDirection(ForgeDirection aDir, int W, int D) { - LayerBlockData g; - if (aDir == ForgeDirection.SOUTH) { - g = this.mVariantOrientations.get(2)[W][D]; - } - else if (aDir == ForgeDirection.WEST) { - g = this.mVariantOrientations.get(3)[W][D]; - } - else if (aDir == ForgeDirection.NORTH) { - g = this.mVariantOrientations.get(0)[W][D]; - } - else if (aDir == ForgeDirection.EAST) { - g = this.mVariantOrientations.get(1)[W][D]; - } - else { - g = this.mLayerData[W][D]; - } - return g; - } - - public static Pair<Integer, Integer> rotateOffsetValues(ForgeDirection aDir, int X, int Z) { - int offsetX, offsetZ; - - if (aDir == ForgeDirection.NORTH) { - offsetX = X; - offsetZ = Z; - } - - else if (aDir == ForgeDirection.EAST) { - offsetX = -X; - offsetZ = Z; - } - - else if (aDir == ForgeDirection.SOUTH) { - offsetX = -X; - offsetZ = -Z; - } - - else if (aDir == ForgeDirection.WEST) { - offsetX = X; - offsetZ = -Z; - } - else { - offsetX = X; - offsetZ = Z; - } - - return new Pair<Integer, Integer>(offsetX, offsetZ); - } - - - - - - - - - - - - - - - - /** - * Generates a complete {@link MultiblockLayer} from String data. - * @param aDataMap - A {@link HashMap} containing single character {@link String}s, which map to {@link Pair}<{@link Block}, {@link Integer}>s contains pairs of Blocks & Meta. - * @param aHorizontalStringRows - The horizontal rows used to map blocks to a grid. Each array slot is one vertical row going downwards as the index increases. - * @return - */ - public static MultiblockLayer generateLayerFromData(HashMap<String, Pair<Block, Integer>> aDataMap, String[] aHorizontalStringRows) { - AutoMap<Pair<String, Pair<Block, Integer>>> x = new AutoMap<Pair<String, Pair<Block, Integer>>>(); - - for (String u : aDataMap.keySet()) { - Pair<Block, Integer> r = aDataMap.get(u); - if (r != null) { - x.put(new Pair<String, Pair<Block, Integer>>(u, r)); - } - } - - //String aFreeLetters = "abdefgijklmnopqrstuvwxyz"; - /*for (Pair<Block, Integer> h : aDataMap.values()) { - String y = aFreeLetters.substring(0, 0); - aFreeLetters = aFreeLetters.replace(y.toLowerCase(), ""); - Pair<String, Pair<Block, Integer>> t = new Pair<String, Pair<Block, Integer>>(y, h); - x.put(t); - }*/ - return generateLayerFromData(x, aHorizontalStringRows); - } - - - /** - * Generates a complete {@link MultiblockLayer} from String data. - * @param aDataMap - An {@link AutoMap} which contains {@link Pair}s. These Pairs hold a single character {@link String} and another Pair. This inner pair holds a {@link Block} and an {@link Integer}. - * @param aHorizontalStringRows - An array which holds the horizontal (X/Width) string data for the layer. - * @return A complete Multiblock Layer. - */ - public static MultiblockLayer generateLayerFromData(AutoMap<Pair<String, Pair<Block, Integer>>> aDataMap, String[] aHorizontalStringRows) { - int width = aHorizontalStringRows[0].length(); - int depth = aHorizontalStringRows.length; - MultiblockLayer L = new MultiblockLayer(width, depth); - HashMap<String, Pair<Block, Integer>> K = new HashMap<String, Pair<Block, Integer>>(); - - //24 Free Letters - //C = Controller - //H = Hatch - String aFreeLetters = "abdefgijklmnopqrstuvwxyz"; - AutoMap<Pair<String, Pair<Block, Integer>>> j = new AutoMap<Pair<String, Pair<Block, Integer>>>(); - - //Map the keys to a Hashmap - for (Pair<String, Pair<Block, Integer>> t : aDataMap) { - String aKeyTemp = t.getKey(); - if (aKeyTemp.toUpperCase().equals("C")){ - j.put(t); - } - else if (aKeyTemp.toUpperCase().equals("H")){ - j.put(t); - } - else { - K.put(aKeyTemp.toLowerCase(), t.getValue()); - aFreeLetters.replace(aKeyTemp.toLowerCase(), ""); - } - } - - //Map any Invalid Characters to new ones, in case someone uses C/H. - if (j.size() > 0) { - for (Pair<String, Pair<Block, Integer>> h : j) { - String newKey = aFreeLetters.substring(0, 0); - K.put(newKey.toLowerCase(), h.getValue()); - aFreeLetters.replace(newKey.toLowerCase(), ""); - } - } - - int xPos = 0; - int zPos = 0; - - //Vertical Iterator - for (String s : aHorizontalStringRows) { - //Horizontal Iterator - for (int q = 0; q < s.length(); q++) { - //Get char as a String at index q. - String c = s.substring(q, q); - //if the character at c matches the character in this row, we add it to the map. - if (c.toLowerCase().equals(s.toLowerCase())) { - Pair<Block, Integer> p = K.get(c); - if (c.toLowerCase().equals("c")) { - L.addController(xPos, zPos); - } - else if (c.toLowerCase().equals("h")) { - L.addBlockForPos(p.getKey(), p.getValue(), xPos, zPos, true); - } - else { - L.addBlockForPos(p.getKey(), p.getValue(), xPos, zPos, false); - } - } - xPos++; - } - xPos = 0; - zPos++; - } - L.lock(true); - return L; - } - - - - - public static class LayerBlockData{ - - public static final LayerBlockData FALLBACK_AIR_CHECK = new LayerBlockData(Blocks.air, 0, false); - - public final Block mBlock; - public final int mMeta; - public final boolean canBeHatch; - public final Class[] mHatchClass; - - public final boolean isController; - - - public LayerBlockData(Block aBlock, int aMeta, boolean aHatch) { - this(aBlock, aMeta, aHatch, new Class[] {}); - } - - public LayerBlockData(Block aBlock, int aMeta, boolean aHatch, Class clazz) { - this(aBlock, aMeta, aHatch, new Class[] {clazz}); - } - - public LayerBlockData(Block aBlock, int aMeta, boolean aHatch, Class[] clazz) { - mBlock = aBlock; - mMeta = aMeta; - canBeHatch = aHatch; - mHatchClass = clazz; - if (clazz != null && clazz.length > 0 && clazz[0].equals(GT_MetaTileEntity_MultiBlockBase.class)) { - isController = true; - } - else { - isController = false; - } - } - - public boolean match(Block blockToTest, int metaToTest) { - - //If Both are some kind of Air Block, good enough. - if (blockToTest instanceof BlockAir && mBlock instanceof BlockAir) { - return true; - } - - if (isController && blockToTest == GregTech_API.sBlockMachines) { - return true; - } - - if (canBeHatch && blockToTest == GregTech_API.sBlockMachines) { - return true; - } - - if (blockToTest == mBlock && metaToTest == mMeta) { - return true; - } - - return false; - } - } - -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java deleted file mode 100644 index 10909081d1..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java +++ /dev/null @@ -1,108 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -public class MultiblockRequirements { - - public int mInputBusMinimum = 0; - public int mInputHatchMinimum = 0; - - public int mOutputBusMinimum = 0; - public int mOutputHatchMinimum = 0; - - public int mMaintMinimum = 1; - - public int mEnergyHatchMinimum = 1; - public int mDynamoHatchMinimum = 0; - - public final int mMinimumCasingCount; - - public final MultiblockBlueprint mBlueprint; - - //public static final int mControlCoreMinimum = 1; - /** - * - * @param aInputBusses - * @param aOutputBusses - * @param aInputHatches - * @param aOutputHatches - * @param aEnergyHatches - * @param aDynamoHatches - * @param aMaintHatches - * @param aBlueprint - A data object containing the structural data for this Multiblock - */ - public MultiblockRequirements(int aCasingCount, MultiblockBlueprint aBlueprint) { - mMinimumCasingCount = aCasingCount; - mBlueprint = aBlueprint; - } - - public final int getInputBusMinimum() { - return this.mInputBusMinimum; - } - - public final MultiblockRequirements setInputBusMinimum(int mInputBusMinimum) { - this.mInputBusMinimum = mInputBusMinimum; - return this; - } - - public final int getInputHatchMinimum() { - return this.mInputHatchMinimum; - } - - public final MultiblockRequirements setInputHatchMinimum(int mInputHatchMinimum) { - this.mInputHatchMinimum = mInputHatchMinimum; - return this; - } - - public final int getOutputBusMinimum() { - return this.mOutputBusMinimum; - } - - public final MultiblockRequirements setOutputBusMinimum(int mOutputBusMinimum) { - this.mOutputBusMinimum = mOutputBusMinimum; - return this; - } - - public final int getOutputHatchMinimum() { - return this.mOutputHatchMinimum; - } - - public final MultiblockRequirements setOutputHatchMinimum(int mOutputHatchMinimum) { - this.mOutputHatchMinimum = mOutputHatchMinimum; - return this; - } - - public final int getMaintMinimum() { - return this.mMaintMinimum; - } - - public final MultiblockRequirements setMaintMinimum(int mMaintMinimum) { - this.mMaintMinimum = mMaintMinimum; - return this; - } - - public final int getEnergyHatchMinimum() { - return this.mEnergyHatchMinimum; - } - - public final MultiblockRequirements setEnergyHatchMinimum(int mEnergyHatchMinimum) { - this.mEnergyHatchMinimum = mEnergyHatchMinimum; - return this; - } - - public final int getDynamoHatchMinimum() { - return this.mDynamoHatchMinimum; - } - - public final MultiblockRequirements setDynamoHatchMinimum(int mDynamoHatchMinimum) { - this.mDynamoHatchMinimum = mDynamoHatchMinimum; - return this; - } - - public final MultiblockBlueprint getBlueprint() { - return this.mBlueprint; - } - - public final int getMinimumCasingCount() { - return this.mMinimumCasingCount; - } - -} |