From 7d1f51a8937e0a86486267437d444696e81e8aa0 Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:04:28 +0200 Subject: Buildscript + Spotless (#318) * Convert AES.java to readable class * Buildscript * Spotless --- .../gregtech/api/gui/CONTAINER_AdvancedBoiler.java | 53 +- .../xmod/gregtech/api/gui/CONTAINER_Cyclotron.java | 49 +- .../xmod/gregtech/api/gui/CONTAINER_DataHatch.java | 38 +- .../gregtech/api/gui/CONTAINER_DeluxeTank.java | 110 ++- .../api/gui/CONTAINER_Hatch_Muffler_Advanced.java | 86 +-- .../api/gui/CONTAINER_IndustrialCentrifuge.java | 55 +- .../api/gui/CONTAINER_IronBlastFurnace.java | 41 +- .../xmod/gregtech/api/gui/CONTAINER_MatterFab.java | 137 ++-- .../api/gui/CONTAINER_MetaTileMachineLong.java | 470 ++++++------- .../gregtech/api/gui/CONTAINER_MultiMachine.java | 493 +++++++------- .../CONTAINER_MultiMachine_NoPlayerInventory.java | 24 +- .../api/gui/CONTAINER_PowerSubStation.java | 139 ++-- .../xmod/gregtech/api/gui/CONTAINER_SafeBlock.java | 160 +++-- .../gregtech/api/gui/CONTAINER_SolarGenerator.java | 143 ++-- .../gregtech/api/gui/CONTAINER_SteamCondenser.java | 167 ++--- .../gregtech/api/gui/CONTAINER_SuperChest.java | 103 ++- .../gregtech/api/gui/CONTAINER_TreeFarmer.java | 109 +-- .../xmod/gregtech/api/gui/GUI_AdvancedBoiler.java | 10 +- .../xmod/gregtech/api/gui/GUI_Cyclotron.java | 35 +- .../xmod/gregtech/api/gui/GUI_DataHatch.java | 18 +- .../xmod/gregtech/api/gui/GUI_DeluxeTank.java | 56 +- .../api/gui/GUI_Hatch_Muffler_Advanced.java | 71 +- .../gregtech/api/gui/GUI_IndustrialCentrifuge.java | 121 ++-- .../gregtech/api/gui/GUI_IronBlastFurnace.java | 58 +- .../xmod/gregtech/api/gui/GUI_MatterFab.java | 143 ++-- .../xmod/gregtech/api/gui/GUI_MultiMachine.java | 612 +++++++++-------- .../gregtech/api/gui/GUI_MultiMachine_Default.java | 42 +- .../gregtech/api/gui/GUI_Multi_Basic_Slotted.java | 130 ++-- .../xmod/gregtech/api/gui/GUI_PowerSubStation.java | 218 +++--- .../xmod/gregtech/api/gui/GUI_SafeBlock.java | 79 ++- .../xmod/gregtech/api/gui/GUI_SolarGenerator.java | 71 +- .../xmod/gregtech/api/gui/GUI_SteamCondenser.java | 84 ++- .../xmod/gregtech/api/gui/GUI_SuperChest.java | 55 +- .../xmod/gregtech/api/gui/GUI_TreeFarmer.java | 76 +-- .../xmod/gregtech/api/gui/SyncedLong.java | 2 +- .../xmod/gregtech/api/gui/SyncedValueManager.java | 1 - .../GT_Container_ElectricAutoWorkbench.java | 210 +++--- .../GT_Container_ElectricInventoryManager.java | 509 +++++++------- .../GT_GUIContainer_ElectricAutoWorkbench.java | 84 +-- .../GT_GUIContainer_ElectricInventoryManager.java | 218 ++++-- .../api/gui/basic/CONTAINER_PollutionCleaner.java | 168 +++-- .../api/gui/basic/GT_Container_CropHarvestor.java | 326 +++++---- .../gui/basic/GT_GUIContainer_CropHarvestor.java | 118 ++-- .../api/gui/basic/GUI_PollutionCleaner.java | 115 ++-- .../gui/computer/GT_Container_ComputerCube.java | 734 ++++++++++----------- .../GT_Container_RedstoneCircuitBlock.java | 293 ++++---- .../gui/computer/GT_GUIContainer_ComputerCube.java | 349 +++++----- .../GT_GUIContainer_RedstoneCircuitBlock.java | 187 ++++-- .../gui/fluidreactor/Container_FluidReactor.java | 318 +++++---- .../api/gui/fluidreactor/GUI_FluidReactor.java | 220 +++--- .../api/gui/hatches/CONTAINER_1by1_Turbine.java | 67 +- .../gregtech/api/gui/hatches/CONTAINER_2by2.java | 5 +- .../gregtech/api/gui/hatches/CONTAINER_4by4.java | 5 +- .../gui/hatches/CONTAINER_HatchNbtConsumable.java | 198 +++--- .../gregtech/api/gui/hatches/GUI_1by1_Turbine.java | 10 +- .../xmod/gregtech/api/gui/hatches/GUI_2by2.java | 18 +- .../xmod/gregtech/api/gui/hatches/GUI_4by4.java | 18 +- .../api/gui/hatches/GUI_HatchNbtConsumable.java | 52 +- .../hatches/charge/CONTAINER_Electric_2by2.java | 17 +- .../hatches/charge/CONTAINER_Electric_4by4.java | 14 +- .../api/gui/hatches/charge/GUI_Electric_2by2.java | 22 +- .../api/gui/hatches/charge/GUI_Electric_4by4.java | 23 +- .../api/gui/power/CONTAINER_BasicTank.java | 89 ++- .../xmod/gregtech/api/gui/power/GUI_BasicTank.java | 46 +- .../workbench/GT_Container_AdvancedWorkbench.java | 206 +++--- .../workbench/GT_Container_BronzeWorkbench.java | 202 +++--- .../GT_GUIContainer_AdvancedWorkbench.java | 123 ++-- .../workbench/GT_GUIContainer_BronzeWorkbench.java | 9 +- 68 files changed, 4857 insertions(+), 4375 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java index 04d8d91201..005485cbde 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java @@ -1,32 +1,27 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import java.util.Iterator; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_Boiler_Base; +import java.util.Iterator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; -public class CONTAINER_AdvancedBoiler - extends GT_ContainerMetaTile_Machine { +public class CONTAINER_AdvancedBoiler extends GT_ContainerMetaTile_Machine { public int mWaterAmount = 0; public int mSteamAmount = 0; public int mProcessingEnergy = 0; public int mTemperature = 2; - + public CONTAINER_AdvancedBoiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { + public void addSlots(InventoryPlayer aInventoryPlayer) { addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); @@ -34,33 +29,47 @@ public class CONTAINER_AdvancedBoiler } @Override - public int getSlotCount() { + public int getSlotCount() { return 4; } @Override - public int getShiftClickSlotCount() { + public int getShiftClickSlotCount() { return 1; } @Override - public void detectAndSendChanges() { + public void detectAndSendChanges() { super.detectAndSendChanges(); if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { return; } - + int steamCapacity = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).getSteamCapacity(); int waterCapacity = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).getCapacity(); this.mTemperature = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mTemperature; - this.mProcessingEnergy = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - this.mSteamAmount = (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mSteam == null ? 0 : ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mSteam.amount); - this.mWaterAmount = (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mFluid == null ? 0 : ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mFluid.amount); + this.mProcessingEnergy = + ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; + this.mSteamAmount = (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mSteam == null + ? 0 + : ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mSteam.amount); + this.mWaterAmount = (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mFluid == null + ? 0 + : ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mFluid.amount); - this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); + this.mTemperature = Math.min( + 54, + Math.max( + 0, + this.mTemperature + * 54 + / (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()) + .maxProgresstime() + - 10))); this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (steamCapacity - 100))); this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / (waterCapacity - 100))); - this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); + this.mProcessingEnergy = + Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); Iterator var2 = this.crafters.iterator(); while (var2.hasNext()) { @@ -73,7 +82,7 @@ public class CONTAINER_AdvancedBoiler } @Override - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java index 6d0eb6b14c..f11a943e44 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java @@ -11,27 +11,30 @@ import net.minecraft.entity.player.InventoryPlayer; */ public class CONTAINER_Cyclotron extends GT_ContainerMetaTile_Machine { - public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - //this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); - } - - @Override - public int getSlotCount() { - return 0; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } + public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_Cyclotron( + final InventoryPlayer aInventoryPlayer, + final IGregTechTileEntity aTileEntity, + final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + // this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); + } + + @Override + public int getSlotCount() { + return 0; + } + + @Override + public int getShiftClickSlotCount() { + return 0; + } } 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 index fe100955e0..0951c231d5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java @@ -3,9 +3,7 @@ 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; @@ -36,7 +34,6 @@ public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine { 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 @@ -48,23 +45,23 @@ public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine { 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); - } + @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) { @@ -76,7 +73,4 @@ public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine { return ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); } } - - - } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java index a4508781aa..e0698f9d24 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java @@ -1,20 +1,16 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import java.util.Iterator; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import gregtech.api.gui.GT_Container_BasicTank; import gregtech.api.gui.GT_Slot_Output; import gregtech.api.gui.GT_Slot_Render; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank; +import java.util.Iterator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -23,58 +19,58 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn */ public class CONTAINER_DeluxeTank extends GT_Container_BasicTank { - public CONTAINER_DeluxeTank(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public CONTAINER_DeluxeTank(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 41, 42)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 3, 59, 42)); - } + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 41, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 3, 59, 42)); + } - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (this.mTileEntity.isClientSide() || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - if (((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) { - this.mContent = ((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount; - } else { - this.mContent = 0; - } - final Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - final ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mContent & 65535); - var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); - } - } + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity.isClientSide() || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + if (((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) { + this.mContent = ((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount; + } else { + this.mContent = 0; + } + final Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + final ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mContent & 65535); + var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); + } + } - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(final int par1, final int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mContent = (this.mContent & -65536) | par2; - break; - case 101: - this.mContent = (this.mContent & 65535) | (par2 << 16); - break; - } - } + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(final int par1, final int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + this.mContent = (this.mContent & -65536) | par2; + break; + case 101: + this.mContent = (this.mContent & 65535) | (par2 << 16); + break; + } + } - @Override - public int getSlotCount() { - return 2; - } + @Override + public int getSlotCount() { + return 2; + } - @Override - public int getShiftClickSlotCount() { - return 1; - } + @Override + public int getShiftClickSlotCount() { + return 1; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java index 17226a399e..9031003349 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java @@ -5,47 +5,49 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.slots.SlotAirFilter; import net.minecraft.entity.player.InventoryPlayer; - public class CONTAINER_Hatch_Muffler_Advanced extends GT_ContainerMetaTile_Machine { - public long maxEU = 0; - public long storedEU = 0; - - public CONTAINER_Hatch_Muffler_Advanced(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_Hatch_Muffler_Advanced(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new SlotAirFilter(this.mTileEntity, 0, 80, 35)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } - - @Override - public void updateProgressBar(final int id, final int value) { - super.updateProgressBar(id, value); - switch (id) { - default: - break; - } - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - } - -} \ No newline at end of file + public long maxEU = 0; + public long storedEU = 0; + + public CONTAINER_Hatch_Muffler_Advanced( + final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_Hatch_Muffler_Advanced( + final InventoryPlayer aInventoryPlayer, + final IGregTechTileEntity aTileEntity, + final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new SlotAirFilter(this.mTileEntity, 0, 80, 35)); + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } + + @Override + public void updateProgressBar(final int id, final int value) { + super.updateProgressBar(id, value); + switch (id) { + default: + break; + } + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java index df8df2f775..a24288e877 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java @@ -1,10 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; - import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -13,27 +12,31 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; */ public class CONTAINER_IndustrialCentrifuge extends GT_ContainerMetaTile_Machine { - public CONTAINER_IndustrialCentrifuge(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_IndustrialCentrifuge(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } + public CONTAINER_IndustrialCentrifuge( + final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_IndustrialCentrifuge( + final InventoryPlayer aInventoryPlayer, + final IGregTechTileEntity aTileEntity, + final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java index 78150aedbe..483a1abc16 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java @@ -1,32 +1,31 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; - import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Output; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; public class CONTAINER_IronBlastFurnace extends GT_ContainerMetaTile_Machine { - public CONTAINER_IronBlastFurnace(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public CONTAINER_IronBlastFurnace(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); - } + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); + this.addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); + } - @Override - public int getSlotCount() { - return 4; - } + @Override + public int getSlotCount() { + return 4; + } - @Override - public int getShiftClickSlotCount() { - return 2; - } + @Override + public int getShiftClickSlotCount() { + return 2; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java index 93591b2aaf..43996e25c8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java @@ -1,13 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.gui; -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.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_MassFabricator; +import java.util.Iterator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; @@ -17,24 +15,27 @@ import net.minecraft.inventory.ICrafting; * The Container I use for all my Basic Machines */ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { - - public int mMatterProduced = 0; - public int mScrapProduced = 0; - public int mAmplifierProduced = 0; - public int mScrapUsed = 0; - public int mAmplifierUsed = 0; - public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public int mMatterProduced = 0; + public int mScrapProduced = 0; + public int mAmplifierProduced = 0; + public int mScrapUsed = 0; + public int mAmplifierUsed = 0; + + public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } + public CONTAINER_MatterFab( + final InventoryPlayer aInventoryPlayer, + final IGregTechTileEntity aTileEntity, + final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } - @Override + @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - //addSlotToContainer(new SlotNoInput(mTileEntity, 1, 152, 5)); + // addSlotToContainer(new SlotNoInput(mTileEntity, 1, 152, 5)); } @Override @@ -46,58 +47,58 @@ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { public int getShiftClickSlotCount() { return 0; } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - GregtechMetaTileEntity_MassFabricator aTile = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()); - mAmplifierProduced = aTile.mAmplifierProduced; - mAmplifierUsed = aTile.mAmplifierUsed; - mMatterProduced = aTile.mMatterProduced; - mScrapProduced = aTile.mScrapProduced; - mScrapUsed = aTile.mScrapUsed; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 201, mAmplifierProduced); - var1.sendProgressBarUpdate(this, 202, mAmplifierUsed); - var1.sendProgressBarUpdate(this, 203, mMatterProduced); - var1.sendProgressBarUpdate(this, 204, mScrapProduced); - var1.sendProgressBarUpdate(this, 205, mScrapUsed); - } - } + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + GregtechMetaTileEntity_MassFabricator aTile = + ((GregtechMetaTileEntity_MassFabricator) this.mTileEntity.getMetaTileEntity()); - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } + mAmplifierProduced = aTile.mAmplifierProduced; + mAmplifierUsed = aTile.mAmplifierUsed; + mMatterProduced = aTile.mMatterProduced; + mScrapProduced = aTile.mScrapProduced; + mScrapUsed = aTile.mScrapUsed; - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 201: - mAmplifierProduced = (par2); - break; - case 202: - mAmplifierUsed = (par2); - break; - case 203: - mMatterProduced = (par2); - break; - case 204: - mScrapProduced = (par2); - break; - case 205: - mScrapUsed = (par2); - break; - } - } - + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 201, mAmplifierProduced); + var1.sendProgressBarUpdate(this, 202, mAmplifierUsed); + var1.sendProgressBarUpdate(this, 203, mMatterProduced); + var1.sendProgressBarUpdate(this, 204, mScrapProduced); + var1.sendProgressBarUpdate(this, 205, mScrapUsed); + } + } + + @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 201: + mAmplifierProduced = (par2); + break; + case 202: + mAmplifierUsed = (par2); + break; + case 203: + mMatterProduced = (par2); + break; + case 204: + mScrapProduced = (par2); + break; + case 205: + mScrapUsed = (par2); + break; + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java index 6a3322ab2e..456d501fdc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java @@ -2,243 +2,255 @@ package gtPlusPlus.xmod.gregtech.api.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import gregtech.api.gui.GT_Container; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_LanguageManager; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; - +import java.util.Iterator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; -import java.util.Iterator; - public class CONTAINER_MetaTileMachineLong extends GT_Container { - public int mActive = 0, mMaxProgressTime = 0, mProgressTime = 0, mSteam = 0, mSteamStorage = 0, mOutput = 0, mInput = 0, mID = 0, mDisplayErrorCode = 0; - private int oActive = 0, oMaxProgressTime = 0, oProgressTime = 0, oSteam = 0, oSteamStorage = 0, oOutput = 0, oInput = 0, oID = 0, oDisplayErrorCode = 0, mTimer = 0; - - public long pEnergy, pStorage; - private long nEnergy, nStorage; - - public short pIntMaxCountCurrent, pIntMaxCountMax; - private short nIntMaxCountCurrent, nIntMaxCountMax; - - public CONTAINER_MetaTileMachineLong(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - - mTileEntity = aTileEntity; - - if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { - addSlots(aInventoryPlayer); - if (doesBindPlayerInventory()) bindPlayerInventory(aInventoryPlayer); - detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - public CONTAINER_MetaTileMachineLong(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { - super(aInventoryPlayer, aTileEntity); - mTileEntity = aTileEntity; - - if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { - addSlots(aInventoryPlayer); - if (doesBindPlayerInventory() && doesBindInventory) bindPlayerInventory(aInventoryPlayer); - detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - - private Pair getPowerStored(){ - final long mStoredPower = this.pEnergy; - long mMaxInts = (mStoredPower/Integer.MAX_VALUE); - long mLeftOver = (mStoredPower % Integer.MAX_VALUE); - if (mMaxInts < 0 || mMaxInts >= /*4294967298L*/ Integer.MAX_VALUE) { - return new Pair(-1, 0); - } - if (mLeftOver < 0 || mLeftOver > Integer.MAX_VALUE) { - mLeftOver = 0; - } - Pair power = new Pair((int) mMaxInts, (int) mLeftOver); - return power; - } - - private Pair getMaxPowerStored(){ - final long mMaxStoredPower = this.pStorage; - long mMaxInts = (mMaxStoredPower/Integer.MAX_VALUE); - long mLeftOver = (mMaxStoredPower % Integer.MAX_VALUE); - if (mMaxInts < 0 || mMaxInts >= /*4294967298L*/ Integer.MAX_VALUE) { - return new Pair(-1, 0); - } - if (mLeftOver < 0 || mLeftOver > Integer.MAX_VALUE) { - mLeftOver = 0; - } - Pair power = new Pair((int) mMaxInts, (int) mLeftOver); - return power; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - pStorage = Math.min(Long.MAX_VALUE, mTileEntity.getEUCapacity()); - pEnergy = Math.min(Long.MAX_VALUE, mTileEntity.getStoredEU()); - mSteamStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getSteamCapacity()); - mSteam = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredSteam()); - mOutput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getOutputVoltage()); - mInput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getInputVoltage()); - mDisplayErrorCode = mTileEntity.getErrorDisplayID(); - mProgressTime = mTileEntity.getProgress(); - mMaxProgressTime = mTileEntity.getMaxProgress(); - mActive = mTileEntity.isActive() ? 1 : 0; - mTimer++; - - Pair powerPacket = getPowerStored(); - Pair maxPowerPacket = getMaxPowerStored(); - - int mPacketsToSend = powerPacket.getKey(); - int mLeftOverPowerStored = powerPacket.getValue(); - - int mMaxStorageA = maxPowerPacket.getKey(); - int mMaxStorageB = maxPowerPacket.getValue(); - - //Someone has a VERY FULL power supply. - if (mPacketsToSend == -1) { - Logger.INFO("TOO MUCH MATH - USE BIGINTEGER - GAME BREAKING BUG MAY OCCUR"); - return; - } - - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - if (mTimer % 500 == 10 || nEnergy != pEnergy) { - var1.sendProgressBarUpdate(this, 0, mLeftOverPowerStored & 65535); - var1.sendProgressBarUpdate(this, 1, mLeftOverPowerStored >>> 16); - var1.sendProgressBarUpdate(this, 7730, mPacketsToSend); - } - if (mTimer % 500 == 10 || nStorage != pStorage) { - var1.sendProgressBarUpdate(this, 2, mMaxStorageB & 65535); - var1.sendProgressBarUpdate(this, 3, mMaxStorageB >>> 16); - var1.sendProgressBarUpdate(this, 7731, mMaxStorageA); - } - if (mTimer % 500 == 10 || oOutput != mOutput) { - var1.sendProgressBarUpdate(this, 4, mOutput); - } - if (mTimer % 500 == 10 || oInput != mInput) { - var1.sendProgressBarUpdate(this, 5, mInput); - } - if (mTimer % 500 == 10 || oDisplayErrorCode != mDisplayErrorCode) { - var1.sendProgressBarUpdate(this, 6, mDisplayErrorCode); - } - if (mTimer % 500 == 10 || oProgressTime != mProgressTime) { - var1.sendProgressBarUpdate(this, 11, mProgressTime & 65535); - var1.sendProgressBarUpdate(this, 12, mProgressTime >>> 16); - } - if (mTimer % 500 == 10 || oMaxProgressTime != mMaxProgressTime) { - var1.sendProgressBarUpdate(this, 13, mMaxProgressTime & 65535); - var1.sendProgressBarUpdate(this, 14, mMaxProgressTime >>> 16); - } - if (mTimer % 500 == 10 || oID != mID) { - var1.sendProgressBarUpdate(this, 15, mID); - } - if (mTimer % 500 == 10 || oActive != mActive) { - var1.sendProgressBarUpdate(this, 16, mActive); - } - if (mTimer % 500 == 10 || oSteam != mSteam) { - var1.sendProgressBarUpdate(this, 17, mSteam & 65535); - var1.sendProgressBarUpdate(this, 18, mSteam >>> 16); - } - if (mTimer % 500 == 10 || oSteamStorage != mSteamStorage) { - var1.sendProgressBarUpdate(this, 19, mSteamStorage & 65535); - var1.sendProgressBarUpdate(this, 20, mSteamStorage >>> 16); - } - } - - oID = mID; - oSteam = mSteam; - oInput = mInput; - oActive = mActive; - oOutput = mOutput; - nEnergy = pEnergy; - nStorage = pStorage; - oSteamStorage = mSteamStorage; - oProgressTime = mProgressTime; - oMaxProgressTime = mMaxProgressTime; - oDisplayErrorCode = mDisplayErrorCode; - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - /*case 7730: - pIntMaxCountCurrent = par2;*/ - case 0: - pEnergy = pEnergy & -65536 | par2; - break; - case 1: - pEnergy = pEnergy & 65535 | par2 << 16; - break; - case 2: - pStorage = pStorage & -65536 | par2; - break; - case 3: - pStorage = pStorage & 65535 | par2 << 16; - break; - case 4: - mOutput = par2; - break; - case 5: - mInput = par2; - break; - case 6: - mDisplayErrorCode = par2; - break; - case 11: - mProgressTime = mProgressTime & -65536 | par2; - break; - case 12: - mProgressTime = mProgressTime & 65535 | par2 << 16; - break; - case 13: - mMaxProgressTime = mMaxProgressTime & -65536 | par2; - break; - case 14: - mMaxProgressTime = mMaxProgressTime & 65535 | par2 << 16; - break; - case 15: - mID = par2; - break; - case 16: - mActive = par2; - break; - case 17: - mSteam = mSteam & -65536 | par2; - break; - case 18: - mSteam = mSteam & 65535 | par2 << 16; - break; - case 19: - mSteamStorage = mSteamStorage & -65536 | par2; - break; - case 20: - mSteamStorage = mSteamStorage & 65535 | par2 << 16; - break; - } - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return mTileEntity.isUseableByPlayer(player); - } - - public String trans(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); - } -} \ No newline at end of file + public int mActive = 0, + mMaxProgressTime = 0, + mProgressTime = 0, + mSteam = 0, + mSteamStorage = 0, + mOutput = 0, + mInput = 0, + mID = 0, + mDisplayErrorCode = 0; + private int oActive = 0, + oMaxProgressTime = 0, + oProgressTime = 0, + oSteam = 0, + oSteamStorage = 0, + oOutput = 0, + oInput = 0, + oID = 0, + oDisplayErrorCode = 0, + mTimer = 0; + public long pEnergy, pStorage; + private long nEnergy, nStorage; + public short pIntMaxCountCurrent, pIntMaxCountMax; + private short nIntMaxCountCurrent, nIntMaxCountMax; + + public CONTAINER_MetaTileMachineLong(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + + mTileEntity = aTileEntity; + + if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { + addSlots(aInventoryPlayer); + if (doesBindPlayerInventory()) bindPlayerInventory(aInventoryPlayer); + detectAndSendChanges(); + } else { + aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; + } + } + + public CONTAINER_MetaTileMachineLong( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { + super(aInventoryPlayer, aTileEntity); + mTileEntity = aTileEntity; + + if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { + addSlots(aInventoryPlayer); + if (doesBindPlayerInventory() && doesBindInventory) bindPlayerInventory(aInventoryPlayer); + detectAndSendChanges(); + } else { + aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; + } + } + + private Pair getPowerStored() { + final long mStoredPower = this.pEnergy; + long mMaxInts = (mStoredPower / Integer.MAX_VALUE); + long mLeftOver = (mStoredPower % Integer.MAX_VALUE); + if (mMaxInts < 0 || mMaxInts >= /*4294967298L*/ Integer.MAX_VALUE) { + return new Pair(-1, 0); + } + if (mLeftOver < 0 || mLeftOver > Integer.MAX_VALUE) { + mLeftOver = 0; + } + Pair power = new Pair((int) mMaxInts, (int) mLeftOver); + return power; + } + + private Pair getMaxPowerStored() { + final long mMaxStoredPower = this.pStorage; + long mMaxInts = (mMaxStoredPower / Integer.MAX_VALUE); + long mLeftOver = (mMaxStoredPower % Integer.MAX_VALUE); + if (mMaxInts < 0 || mMaxInts >= /*4294967298L*/ Integer.MAX_VALUE) { + return new Pair(-1, 0); + } + if (mLeftOver < 0 || mLeftOver > Integer.MAX_VALUE) { + mLeftOver = 0; + } + Pair power = new Pair((int) mMaxInts, (int) mLeftOver); + return power; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; + pStorage = Math.min(Long.MAX_VALUE, mTileEntity.getEUCapacity()); + pEnergy = Math.min(Long.MAX_VALUE, mTileEntity.getStoredEU()); + mSteamStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getSteamCapacity()); + mSteam = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredSteam()); + mOutput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getOutputVoltage()); + mInput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getInputVoltage()); + mDisplayErrorCode = mTileEntity.getErrorDisplayID(); + mProgressTime = mTileEntity.getProgress(); + mMaxProgressTime = mTileEntity.getMaxProgress(); + mActive = mTileEntity.isActive() ? 1 : 0; + mTimer++; + + Pair powerPacket = getPowerStored(); + Pair maxPowerPacket = getMaxPowerStored(); + + int mPacketsToSend = powerPacket.getKey(); + int mLeftOverPowerStored = powerPacket.getValue(); + + int mMaxStorageA = maxPowerPacket.getKey(); + int mMaxStorageB = maxPowerPacket.getValue(); + + // Someone has a VERY FULL power supply. + if (mPacketsToSend == -1) { + Logger.INFO("TOO MUCH MATH - USE BIGINTEGER - GAME BREAKING BUG MAY OCCUR"); + return; + } + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + if (mTimer % 500 == 10 || nEnergy != pEnergy) { + var1.sendProgressBarUpdate(this, 0, mLeftOverPowerStored & 65535); + var1.sendProgressBarUpdate(this, 1, mLeftOverPowerStored >>> 16); + var1.sendProgressBarUpdate(this, 7730, mPacketsToSend); + } + if (mTimer % 500 == 10 || nStorage != pStorage) { + var1.sendProgressBarUpdate(this, 2, mMaxStorageB & 65535); + var1.sendProgressBarUpdate(this, 3, mMaxStorageB >>> 16); + var1.sendProgressBarUpdate(this, 7731, mMaxStorageA); + } + if (mTimer % 500 == 10 || oOutput != mOutput) { + var1.sendProgressBarUpdate(this, 4, mOutput); + } + if (mTimer % 500 == 10 || oInput != mInput) { + var1.sendProgressBarUpdate(this, 5, mInput); + } + if (mTimer % 500 == 10 || oDisplayErrorCode != mDisplayErrorCode) { + var1.sendProgressBarUpdate(this, 6, mDisplayErrorCode); + } + if (mTimer % 500 == 10 || oProgressTime != mProgressTime) { + var1.sendProgressBarUpdate(this, 11, mProgressTime & 65535); + var1.sendProgressBarUpdate(this, 12, mProgressTime >>> 16); + } + if (mTimer % 500 == 10 || oMaxProgressTime != mMaxProgressTime) { + var1.sendProgressBarUpdate(this, 13, mMaxProgressTime & 65535); + var1.sendProgressBarUpdate(this, 14, mMaxProgressTime >>> 16); + } + if (mTimer % 500 == 10 || oID != mID) { + var1.sendProgressBarUpdate(this, 15, mID); + } + if (mTimer % 500 == 10 || oActive != mActive) { + var1.sendProgressBarUpdate(this, 16, mActive); + } + if (mTimer % 500 == 10 || oSteam != mSteam) { + var1.sendProgressBarUpdate(this, 17, mSteam & 65535); + var1.sendProgressBarUpdate(this, 18, mSteam >>> 16); + } + if (mTimer % 500 == 10 || oSteamStorage != mSteamStorage) { + var1.sendProgressBarUpdate(this, 19, mSteamStorage & 65535); + var1.sendProgressBarUpdate(this, 20, mSteamStorage >>> 16); + } + } + + oID = mID; + oSteam = mSteam; + oInput = mInput; + oActive = mActive; + oOutput = mOutput; + nEnergy = pEnergy; + nStorage = pStorage; + oSteamStorage = mSteamStorage; + oProgressTime = mProgressTime; + oMaxProgressTime = mMaxProgressTime; + oDisplayErrorCode = mDisplayErrorCode; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + /*case 7730: + pIntMaxCountCurrent = par2;*/ + case 0: + pEnergy = pEnergy & -65536 | par2; + break; + case 1: + pEnergy = pEnergy & 65535 | par2 << 16; + break; + case 2: + pStorage = pStorage & -65536 | par2; + break; + case 3: + pStorage = pStorage & 65535 | par2 << 16; + break; + case 4: + mOutput = par2; + break; + case 5: + mInput = par2; + break; + case 6: + mDisplayErrorCode = par2; + break; + case 11: + mProgressTime = mProgressTime & -65536 | par2; + break; + case 12: + mProgressTime = mProgressTime & 65535 | par2 << 16; + break; + case 13: + mMaxProgressTime = mMaxProgressTime & -65536 | par2; + break; + case 14: + mMaxProgressTime = mMaxProgressTime & 65535 | par2 << 16; + break; + case 15: + mID = par2; + break; + case 16: + mActive = par2; + break; + case 17: + mSteam = mSteam & -65536 | par2; + break; + case 18: + mSteam = mSteam & 65535 | par2 << 16; + break; + case 19: + mSteamStorage = mSteamStorage & -65536 | par2; + break; + case 20: + mSteamStorage = mSteamStorage & 65535 | par2 << 16; + break; + } + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return mTileEntity.isUseableByPlayer(player); + } + + public String trans(String aKey, String aEnglish) { + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index 88b9661c95..fd4aff592e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -1,9 +1,5 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; @@ -14,6 +10,9 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; @@ -25,259 +24,263 @@ import net.minecraft.inventory.ICrafting; */ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { - public String[] mTileDescription; - private String[] oTileDescription; - - private GregtechMeta_MultiBlockBase mMCTEI; - private boolean mControllerSet = false; + public String[] mTileDescription; + private String[] oTileDescription; + + private GregtechMeta_MultiBlockBase mMCTEI; + private boolean mControllerSet = false; + + public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + public CONTAINER_MultiMachine( + final InventoryPlayer aInventoryPlayer, + final IGregTechTileEntity aTileEntity, + final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } - public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public static void setControllerInstance(CONTAINER_MultiMachine aContainer, IGregTechTileEntity aTile) { + if (aTile == null) { + return; + } + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return; + } + if (aMetaTileEntity instanceof GregtechMeta_MultiBlockBase) { + aContainer.mMCTEI = (GregtechMeta_MultiBlockBase) aMetaTileEntity; + } + } - public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - public static void setControllerInstance(CONTAINER_MultiMachine aContainer, IGregTechTileEntity aTile) { - if (aTile == null) { - return; - } - final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return; - } - if (aMetaTileEntity instanceof GregtechMeta_MultiBlockBase) { - aContainer.mMCTEI = (GregtechMeta_MultiBlockBase) aMetaTileEntity; - } - } + public int aTotalTickTime = 0; + public int aMaxParallel = 0; + public int aPollutionTick = 0; + public int aMaxInputVoltage = 0; + public int aInputTier = 0; + public int aOutputTier = 0; + public int aRecipeDuration = 0; + public int aRecipeEU = 0; + public int aRecipeSpecial = 0; + public int aPollutionReduction = 0; + public int aStoredEnergy = 0; + public int aMaxEnergy = 0; + public int aEfficiency = 0; - public int aTotalTickTime = 0; - public int aMaxParallel = 0; - public int aPollutionTick = 0; - public int aMaxInputVoltage = 0; - public int aInputTier = 0; - public int aOutputTier = 0; - public int aRecipeDuration = 0; - public int aRecipeEU = 0; - public int aRecipeSpecial = 0; - public int aPollutionReduction = 0; - public int aStoredEnergy = 0; - public int aMaxEnergy = 0; - public int aEfficiency = 0; + private int oTotalTickTime = 0; + private int oMaxParallel = 0; + private int oPollutionTick = 0; + private int oMaxInputVoltage = 0; + private int oInputTier = 0; + private int oOutputTier = 0; + private int oRecipeDuration = 0; + private int oRecipeEU = 0; + private int oRecipeSpecial = 0; + private int oPollutionReduction = 0; + private int oStoredEnergy = 0; + private int oMaxEnergy = 0; + private int oEfficiency = 0; - private int oTotalTickTime = 0; - private int oMaxParallel = 0; - private int oPollutionTick = 0; - private int oMaxInputVoltage = 0; - private int oInputTier = 0; - private int oOutputTier = 0; - private int oRecipeDuration = 0; - private int oRecipeEU = 0; - private int oRecipeSpecial = 0; - private int oPollutionReduction = 0; - private int oStoredEnergy = 0; - private int oMaxEnergy = 0; - private int oEfficiency = 0; + private static Field timer; + // private static Field crafters; - private static Field timer; - //private static Field crafters; + @Override + public final void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) { + return; + } + if (!mControllerSet) { + setControllerInstance(this, this.mTileEntity); + } + mControllerSet = (mMCTEI != null); + if (timer == null) { + timer = ReflectionUtils.getField(getClass(), "mTimer"); + } + if (crafters == null) { + // crafters = ReflectionUtils.getField(getClass(), "crafters"); + } + if (timer != null && crafters != null && mControllerSet) { + // Logger.INFO("Trying to update clientside GUI data"); + try { + // Logger.INFO("0"); + int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); - @Override - public final void detectAndSendChanges() { - super.detectAndSendChanges(); - if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) { - return; - } - if (!mControllerSet) { - setControllerInstance(this, this.mTileEntity); - } - mControllerSet = (mMCTEI != null); - if (timer == null) { - timer = ReflectionUtils.getField(getClass(), "mTimer"); - } - if (crafters == null) { - //crafters = ReflectionUtils.getField(getClass(), "crafters"); - } - if (timer != null && crafters != null && mControllerSet) { - //Logger.INFO("Trying to update clientside GUI data"); - try { - //Logger.INFO("0"); - int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); - - //List crafters1List = (List) crafters1; - List crafters2 = new ArrayList(); - //Logger.INFO("1"); - for (Object o : crafters) { - if (o instanceof ICrafting) { - crafters2.add((ICrafting) o); - } - } - //Logger.INFO("2"); - if (!crafters2.isEmpty()) { - //Logger.INFO("3"); - handleInitialFieldSetting(); + // List crafters1List = (List) crafters1; + List crafters2 = new ArrayList(); + // Logger.INFO("1"); + for (Object o : crafters) { + if (o instanceof ICrafting) { + crafters2.add((ICrafting) o); + } + } + // Logger.INFO("2"); + if (!crafters2.isEmpty()) { + // Logger.INFO("3"); + handleInitialFieldSetting(); - try { - //Logger.INFO("4"); - for (final ICrafting var3 : crafters2) { - handleCraftingEvent(aTimer, var3); - } - //Logger.INFO("5"); - handleInternalFieldSetting(); - //Logger.INFO("6"); - } catch (Throwable t) { + try { + // Logger.INFO("4"); + for (final ICrafting var3 : crafters2) { + handleCraftingEvent(aTimer, var3); + } + // Logger.INFO("5"); + handleInternalFieldSetting(); + // Logger.INFO("6"); + } catch (Throwable t) { - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - else { - Logger.INFO("Failed."); - } - } + } + } + } catch (Throwable t) { + t.printStackTrace(); + } + } else { + Logger.INFO("Failed."); + } + } - public void handleInitialFieldSetting() { - this.aTotalTickTime = MathUtils.balance((int) mMCTEI.getTotalRuntimeInTicks(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aMaxParallel = mMCTEI.getMaxParallelRecipes(); - this.aPollutionTick = mMCTEI.getPollutionPerTick(null); - this.aMaxInputVoltage = MathUtils.balance((int) mMCTEI.getMaxInputVoltage(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aInputTier = MathUtils.balance((int) mMCTEI.getInputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aOutputTier = MathUtils.balance((int) mMCTEI.getOutputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); - if (mMCTEI.mLastRecipe != null) { - GT_Recipe aRecipe = mMCTEI.mLastRecipe; - this.aRecipeDuration = MathUtils.balance(aRecipe.mDuration, Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aRecipeEU = MathUtils.balance(aRecipe.mEUt, Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aRecipeSpecial = MathUtils.balance(aRecipe.mSpecialValue, Integer.MIN_VALUE, Integer.MAX_VALUE); - } - this.aPollutionReduction = mMCTEI.getPollutionReductionForAllMufflers(); - - this.aStoredEnergy = MathUtils.balance((int) mMCTEI.getStoredEnergyInAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aMaxEnergy = MathUtils.balance((int) mMCTEI.getMaxEnergyStorageOfAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aEfficiency = MathUtils.balance(mMCTEI.mEfficiency, Integer.MIN_VALUE, Integer.MAX_VALUE); - } + public void handleInitialFieldSetting() { + this.aTotalTickTime = + MathUtils.balance((int) mMCTEI.getTotalRuntimeInTicks(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aMaxParallel = mMCTEI.getMaxParallelRecipes(); + this.aPollutionTick = mMCTEI.getPollutionPerTick(null); + this.aMaxInputVoltage = + MathUtils.balance((int) mMCTEI.getMaxInputVoltage(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aInputTier = MathUtils.balance((int) mMCTEI.getInputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aOutputTier = MathUtils.balance((int) mMCTEI.getOutputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); + if (mMCTEI.mLastRecipe != null) { + GT_Recipe aRecipe = mMCTEI.mLastRecipe; + this.aRecipeDuration = MathUtils.balance(aRecipe.mDuration, Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aRecipeEU = MathUtils.balance(aRecipe.mEUt, Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aRecipeSpecial = MathUtils.balance(aRecipe.mSpecialValue, Integer.MIN_VALUE, Integer.MAX_VALUE); + } + this.aPollutionReduction = mMCTEI.getPollutionReductionForAllMufflers(); - public void handleCraftingEvent(int aTimer, ICrafting aCrafter) { - int aID = 750; - if (aTimer % 500 == 10 || this.oTotalTickTime != this.aTotalTickTime) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aTotalTickTime); - } - if (aTimer % 500 == 10 || this.oMaxParallel != this.aMaxParallel) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxParallel); - } - if (aTimer % 500 == 10 || this.oPollutionTick != this.aPollutionTick) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionTick); - } - if (aTimer % 500 == 10 || this.oMaxInputVoltage != this.aMaxInputVoltage) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxInputVoltage); - } - if (aTimer % 500 == 10 || this.oInputTier != this.aInputTier) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aInputTier); - } - if (aTimer % 500 == 10 || this.oOutputTier != this.aOutputTier) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aOutputTier); - } - if (aTimer % 500 == 10 || this.oRecipeDuration != this.aRecipeDuration) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeDuration); - } - if (aTimer % 500 == 10 || this.oRecipeEU != this.aRecipeEU) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeEU); - } - if (aTimer % 500 == 10 || this.oRecipeSpecial != this.aRecipeSpecial) { - a