From 9a2741128a78bb52eba50a631126e090a5a2abd8 Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 26 Nov 2022 01:45:28 +0900 Subject: Rewrite GUIs with ModularUI (#1381) * Base work for ModularUI compat * Remove useless interface * Add almost all the widgets * Invert method * Refactor NEI stack placement positions * NEI handlers on ModularUI * Add some more docs * AdvDebugStructureWriter * Fix NEI progressbar not working * PrimitiveBlastFurnace * clean * derp * clean * spotlessApply * Boilers * Buffers * clean * N by N slots containers * Fix boilers not having bucket interaction Put opening UI to individual MetaTEs * Maintenance Hatch * clean * spotlessApply * Add dependency * IndustrialApiary * Adapt to ModularUI change * Base work for covers & fix crash with MP * Fix crash with server * Rewrite base work for covers * Send initial cover data on cover GUI open so that the time of showing incorrect data will be eliminated * Covers part 1 * Rename package: ModularUI -> modularui * Rename class: GT_UIInfo -> GT_UIInfos * Fix build * Covers part2 * Fix missing client check with tile UI & fix title overlap * CoverTabLine * Move cover window creators to inner class * Fix crash with null base TE * Close GUI when tile is broken * Color cover window with tile colorization * Change signature of addUIWidgets * FluidFilter cover, FluidDisplaySlotWidget, BasicTank, BasicGenerator, Output Hatch, MicrowaveEnergyTransmitter, Teleporter, DigitalChest, DigitalTank * Add title tab * Move package: modularui -> modularui/widget * Programmed circuit + IConfigurationCircuitSupport * clean * VolumetricFlask * Remove integrated circuit overlay from recipe input slots * Input Hatch & Quadruple Input Hatch * Multiblock * Deprecate old cover GUI * BasicMachines * Finish BasicMachine & NEI * Expand DTPF NEI to 9 slots * Fix ME input bus on MP * Move AESlotWidget to public class * Move GT_Recipe_Map constructors with mNEIUnificateOutput to setter method * Move SteamTexture.Variant to outer enum * Switch to remote repository * oops * Update MUI * Update MUI * Minor refactor for change amount buttons * Display items and fluids that exceed usual count * blah * use +=, why didn't I do this * Update MUI * Move ModularUI to Base (#1510) * Move ModularUI to Base * Move most of the ModularUI functionality to `BaseTileEntity` (and `CoverableTileEntity`) * `CommonMetaTileEntity` delegates ato the MetaTileEntity * Added several interfaces (with defaults) to indicate if a tile/metatile override/implement certain behaviors. * Moved `IConfigurationCircuitSupport` interface such that it will work with BaseTileEntity or a MetaTileEntity * Address reviews Co-authored-by: miozune * Update MUI * Minor changes to NEI * Return :facepalm: * IGetTabIconSet override * Some more changes to NEI * Merge texture getter interfaces to new class GUITextureSet * Remove BBF structure picture as it's auto-buildable now * Make unified title tab style of texture angular * Expose some boiler texture getters for addon * Fix crash with cover GUI on pipe * Lower the number of recipe per page for DTPF & update MUI * Update MUI * Fix crash with middle-clicking slot on circuit selection GUI * Fix circuit selection window not syncing item from base machine * Merge GT_NEI_AssLineHandler into GT_NEI_DefaultHandler * Update MUI * Add in TecTech multi message * Allow changing the way of binding player inventory * Update MUI * Update MUI * Update MUI * Update MUI * Update MUI * Make MUI non-transitive to allow addons to use their own version * Force enable mixin * Format fluid amount tooltip * Add GUITextureSet.STEAM * Add guard against null ModularWindow creation * Add constructors for Muffler Hatch with inventory * Fix output slot on digital chest and tank allowing insertion * Don't log null ModularWindow * Add default implementation for IHasWorldObjectAndCoords#openGUI * Make openGTTileEntityUI accept MultiTE & cleanup Co-authored-by: Jason Mitchell --- .../common/gui/GT_ContainerVolumetricFlask.java | 20 - .../gui/GT_Container_AdvDebugStructureWriter.java | 213 --------- .../gregtech/common/gui/GT_Container_Boiler.java | 99 ----- .../gui/GT_Container_BronzeBlastFurnace.java | 31 -- .../common/gui/GT_Container_ChestBuffer.java | 102 ----- .../gregtech/common/gui/GT_Container_Filter.java | 138 ------ .../common/gui/GT_Container_IndustrialApiary.java | 249 ----------- .../common/gui/GT_Container_InputBus_ME.java | 121 ------ .../common/gui/GT_Container_ItemDistributor.java | 83 ---- .../GT_Container_MicrowaveEnergyTransmitter.java | 188 -------- .../common/gui/GT_Container_OutputHatch.java | 53 --- .../gui/GT_Container_PrimitiveBlastFurnace.java | 37 -- .../common/gui/GT_Container_QuantumChest.java | 70 --- .../common/gui/GT_Container_Regulator.java | 177 -------- .../common/gui/GT_Container_SuperBuffer.java | 97 ----- .../common/gui/GT_Container_Teleporter.java | 190 --------- .../common/gui/GT_GUIContainerVolumetricFlask.java | 234 ---------- .../GT_GUIContainer_AdvDebugStructureWriter.java | 76 ---- .../common/gui/GT_GUIContainer_Boiler.java | 46 -- .../gui/GT_GUIContainer_BronzeBlastFurnace.java | 47 -- .../common/gui/GT_GUIContainer_ChestBuffer.java | 19 - .../common/gui/GT_GUIContainer_Filter.java | 19 - .../common/gui/GT_GUIContainer_FusionReactor.java | 96 ----- .../gui/GT_GUIContainer_IndustrialApiary.java | 174 -------- .../common/gui/GT_GUIContainer_InputBus_ME.java | 77 ---- .../gui/GT_GUIContainer_ItemDistributor.java | 21 - ...GT_GUIContainer_MicrowaveEnergyTransmitter.java | 75 ---- .../common/gui/GT_GUIContainer_OutputHatch.java | 75 ---- .../gui/GT_GUIContainer_PrimitiveBlastFurnace.java | 81 ---- .../common/gui/GT_GUIContainer_QuantumChest.java | 46 -- .../common/gui/GT_GUIContainer_RecipeFilter.java | 23 - .../common/gui/GT_GUIContainer_Regulator.java | 44 -- .../common/gui/GT_GUIContainer_SuperBuffer.java | 19 - .../common/gui/GT_GUIContainer_Teleporter.java | 63 --- .../gregtech/common/gui/modularui/UIHelper.java | 222 ++++++++++ .../modularui/uifactory/SelectItemUIFactory.java | 221 ++++++++++ .../common/gui/modularui/widget/AESlotWidget.java | 40 ++ .../modularui/widget/CoverCycleButtonWidget.java | 89 ++++ .../widget/CoverDataControllerWidget.java | 138 ++++++ .../CoverDataFollower_CycleButtonWidget.java | 38 ++ .../widget/CoverDataFollower_SlotWidget.java | 102 +++++ .../widget/CoverDataFollower_TextFieldWidget.java | 110 +++++ .../CoverDataFollower_ToggleButtonWidget.java | 84 ++++ .../gui/modularui/widget/DataControllerWidget.java | 162 +++++++ .../modularui/widget/FluidDisplaySlotWidget.java | 474 +++++++++++++++++++++ .../modularui/widget/ItemWatcherSlotWidget.java | 47 ++ 46 files changed, 1727 insertions(+), 3103 deletions(-) delete mode 100644 src/main/java/gregtech/common/gui/GT_ContainerVolumetricFlask.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_AdvDebugStructureWriter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_Boiler.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_BronzeBlastFurnace.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_Filter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_IndustrialApiary.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_InputBus_ME.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_MicrowaveEnergyTransmitter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_PrimitiveBlastFurnace.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_QuantumChest.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_Regulator.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java delete mode 100644 src/main/java/gregtech/common/gui/GT_Container_Teleporter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainerVolumetricFlask.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_AdvDebugStructureWriter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_BronzeBlastFurnace.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_ChestBuffer.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_Filter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_IndustrialApiary.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_InputBus_ME.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_ItemDistributor.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_MicrowaveEnergyTransmitter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_RecipeFilter.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_Regulator.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_SuperBuffer.java delete mode 100644 src/main/java/gregtech/common/gui/GT_GUIContainer_Teleporter.java create mode 100644 src/main/java/gregtech/common/gui/modularui/UIHelper.java create mode 100644 src/main/java/gregtech/common/gui/modularui/uifactory/SelectItemUIFactory.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/AESlotWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/CoverCycleButtonWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/CoverDataControllerWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/CoverDataFollower_CycleButtonWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/CoverDataFollower_SlotWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/CoverDataFollower_TextFieldWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/CoverDataFollower_ToggleButtonWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/DataControllerWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/FluidDisplaySlotWidget.java create mode 100644 src/main/java/gregtech/common/gui/modularui/widget/ItemWatcherSlotWidget.java (limited to 'src/main/java/gregtech/common/gui') diff --git a/src/main/java/gregtech/common/gui/GT_ContainerVolumetricFlask.java b/src/main/java/gregtech/common/gui/GT_ContainerVolumetricFlask.java deleted file mode 100644 index 2f8fd2a356..0000000000 --- a/src/main/java/gregtech/common/gui/GT_ContainerVolumetricFlask.java +++ /dev/null @@ -1,20 +0,0 @@ -package gregtech.common.gui; - -import gregtech.common.items.GT_VolumetricFlask; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; - -public final class GT_ContainerVolumetricFlask extends Container { - ItemStack flask; - - public GT_ContainerVolumetricFlask(InventoryPlayer inventoryPlayer) { - flask = inventoryPlayer.getCurrentItem(); - } - - @Override - public boolean canInteractWith(EntityPlayer p) { - return (flask != null) && (flask.stackSize > 0) && ((flask.getItem() instanceof GT_VolumetricFlask)); - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_AdvDebugStructureWriter.java b/src/main/java/gregtech/common/gui/GT_Container_AdvDebugStructureWriter.java deleted file mode 100644 index 15837364f5..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_AdvDebugStructureWriter.java +++ /dev/null @@ -1,213 +0,0 @@ -package gregtech.common.gui; - -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.common.tileentities.debug.GT_MetaTileEntity_AdvDebugStructureWriter; -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_AdvDebugStructureWriter extends GT_ContainerMetaTile_Machine { - public short[] numbers = new short[6]; - public boolean transpose; - public boolean showHighlightBox; - - public Slot printSlot; - public Slot transposeSlot; - public Slot highlightSlot; - - public GT_Container_AdvDebugStructureWriter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 63, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 81, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 99, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 63, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 81, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 99, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 63, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 81, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 99, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 63, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 81, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 99, false, false, 1)); - - printSlot = addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 12, 129, false, false, 1)); - transposeSlot = addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 33, 129, false, false, 1)); - highlightSlot = addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 54, 129, false, false, 1)); - } - - public boolean doesBindPlayerInventory() { - return false; - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); - if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { - GT_MetaTileEntity_AdvDebugStructureWriter dsw = - (GT_MetaTileEntity_AdvDebugStructureWriter) mTileEntity.getMetaTileEntity(); - if (dsw.numbers == null) { - return null; - } - switch (aSlotIndex) { - case 0: - dsw.numbers[0] -= aShifthold == 1 ? 512 : 64; - return null; - case 1: - dsw.numbers[1] -= aShifthold == 1 ? 512 : 64; - return null; - case 2: - dsw.numbers[2] -= aShifthold == 1 ? 512 : 64; - return null; - case 3: - dsw.numbers[3] -= aShifthold == 1 ? 512 : 64; - return null; - case 4: - dsw.numbers[4] -= aShifthold == 1 ? 512 : 64; - return null; - case 5: - dsw.numbers[5] -= aShifthold == 1 ? 512 : 64; - return null; - case 6: - dsw.numbers[0] -= aShifthold == 1 ? 16 : 1; - return null; - case 7: - dsw.numbers[1] -= aShifthold == 1 ? 16 : 1; - return null; - case 8: - dsw.numbers[2] -= aShifthold == 1 ? 16 : 1; - return null; - case 9: - dsw.numbers[3] -= aShifthold == 1 ? 16 : 1; - return null; - case 10: - dsw.numbers[4] -= aShifthold == 1 ? 16 : 1; - return null; - case 11: - dsw.numbers[5] -= aShifthold == 1 ? 16 : 1; - return null; - case 12: - dsw.numbers[0] += aShifthold == 1 ? 512 : 64; - return null; - case 13: - dsw.numbers[1] += aShifthold == 1 ? 512 : 64; - return null; - case 14: - dsw.numbers[2] += aShifthold == 1 ? 512 : 64; - return null; - case 15: - dsw.numbers[3] += aShifthold == 1 ? 512 : 64; - return null; - case 16: - dsw.numbers[4] += aShifthold == 1 ? 512 : 64; - return null; - case 17: - dsw.numbers[5] += aShifthold == 1 ? 512 : 64; - return null; - case 18: - dsw.numbers[0] += aShifthold == 1 ? 16 : 1; - return null; - case 19: - dsw.numbers[1] += aShifthold == 1 ? 16 : 1; - return null; - case 20: - dsw.numbers[2] += aShifthold == 1 ? 16 : 1; - return null; - case 21: - dsw.numbers[3] += aShifthold == 1 ? 16 : 1; - return null; - case 22: - dsw.numbers[4] += aShifthold == 1 ? 16 : 1; - return null; - case 23: - dsw.numbers[5] += aShifthold == 1 ? 16 : 1; - return null; - - case 24: - if (dsw.getBaseMetaTileEntity().isServerSide()) { - dsw.printStructure(aPlayer); - } - return null; - case 25: - dsw.transpose = !dsw.transpose; - return null; - case 26: - dsw.showHighlightBox = !dsw.showHighlightBox; - return null; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - GT_MetaTileEntity_AdvDebugStructureWriter dsw = - (GT_MetaTileEntity_AdvDebugStructureWriter) mTileEntity.getMetaTileEntity(); - if (numbers != null) { - System.arraycopy(dsw.numbers, 0, numbers, 0, dsw.numbers.length); - } - - transpose = dsw.transpose; - showHighlightBox = dsw.showHighlightBox; - - for (Object crafter : crafters) { - ICrafting var1 = (ICrafting) crafter; - if (numbers != null) { - var1.sendProgressBarUpdate(this, 100, numbers[0]); - var1.sendProgressBarUpdate(this, 101, numbers[1]); - var1.sendProgressBarUpdate(this, 102, numbers[2]); - var1.sendProgressBarUpdate(this, 103, numbers[3]); - var1.sendProgressBarUpdate(this, 104, numbers[4]); - var1.sendProgressBarUpdate(this, 105, numbers[5]); - var1.sendProgressBarUpdate(this, 106, transpose ? 1 : 0); - var1.sendProgressBarUpdate(this, 107, showHighlightBox ? 1 : 0); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - if (par1 == 106) { - transpose = par2 > 0; - } else if (par1 == 107) { - showHighlightBox = par2 > 0; - } else { - if (numbers != null && par1 >= 100 && par1 <= 105) { - numbers[par1 - 100] = (short) par2; - } - } - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_Boiler.java b/src/main/java/gregtech/common/gui/GT_Container_Boiler.java deleted file mode 100644 index a29e732f07..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_Boiler.java +++ /dev/null @@ -1,99 +0,0 @@ -package gregtech.common.gui; - -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 gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -public class GT_Container_Boiler extends GT_ContainerMetaTile_Machine { - public int mWaterAmount = 0; - public int mSteamAmount = 0; - public int mProcessingEnergy = 0; - public int mTemperature = 2; - - public GT_Container_Boiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - 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)); - addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); - } - - @Override - public int getSlotCount() { - return 4; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - - // GT_MetaTileEntity_Boiler.getCapacity() is used for both water and steam capacity. - int capacity = ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).getCapacity(); - - this.mTemperature = ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mTemperature; - this.mProcessingEnergy = ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - this.mSteamAmount = (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mSteam == null - ? 0 - : ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mSteam.amount); - this.mWaterAmount = (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mFluid == null - ? 0 - : ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mFluid.amount); - - this.mTemperature = Math.min( - 54, - Math.max( - 0, - this.mTemperature - * 54 - / (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - - 10))); - this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (capacity - 100))); - this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / (capacity - 100))); - this.mProcessingEnergy = - Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); - - for (Object crafter : this.crafters) { - ICrafting player = (ICrafting) crafter; - player.sendProgressBarUpdate(this, 100, this.mTemperature); - player.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); - player.sendProgressBarUpdate(this, 102, this.mSteamAmount); - player.sendProgressBarUpdate(this, 103, this.mWaterAmount); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) { - super.updateProgressBar(id, value); - switch (id) { - case 100: - this.mTemperature = value; - break; - case 101: - this.mProcessingEnergy = value; - break; - case 102: - this.mSteamAmount = value; - break; - case 103: - this.mWaterAmount = value; - } - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_BronzeBlastFurnace.java b/src/main/java/gregtech/common/gui/GT_Container_BronzeBlastFurnace.java deleted file mode 100644 index ac2f18f561..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_BronzeBlastFurnace.java +++ /dev/null @@ -1,31 +0,0 @@ -package gregtech.common.gui; - -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 GT_Container_BronzeBlastFurnace extends GT_ContainerMetaTile_Machine { - public GT_Container_BronzeBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); - addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); - } - - @Override - public int getSlotCount() { - return 4; - } - - @Override - public int getShiftClickSlotCount() { - return 2; - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java deleted file mode 100644 index afa22a738b..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java +++ /dev/null @@ -1,102 +0,0 @@ -package gregtech.common.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.automation.GT_MetaTileEntity_ChestBuffer; -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_ChestBuffer extends GT_ContainerMetaTile_Machine { - public GT_Container_ChestBuffer(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - for (int y = 0; y < 3; y++) { - for (int x = 0; x < 9; x++) { - addSlotToContainer(new Slot(this.mTileEntity, x + y * 9, 8 + x * 18, 5 + y * 18)); - } - } - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 62, 63, false, true, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 27) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (this.mTileEntity.getMetaTileEntity() == null) { - return null; - } - if (aSlotIndex == 27) { - ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bOutput = - (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bOutput); - if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bOutput) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116", "Emit Energy to Outputside")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117", "Don't emit Energy")); - } - return null; - } - if (aSlotIndex == 28) { - ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = - (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); - if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("118", "Emit Redstone if no Slot is free")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("119", "Don't emit Redstone")); - } - return null; - } - if (aSlotIndex == 29) { - ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bInvert = - (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bInvert); - if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bInvert) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120", "Invert Redstone")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121", "Don't invert Redstone")); - } - return null; - } - if (aSlotIndex == 30) { - ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = - (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode); - if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) { - GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans( - "217", - "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); - } else { - GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans( - "218", - "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); - } - return null; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public int getSlotCount() { - return 27; - } - - @Override - public int getShiftClickSlotCount() { - return 27; - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_Filter.java b/src/main/java/gregtech/common/gui/GT_Container_Filter.java deleted file mode 100644 index d4aabe0cb4..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_Filter.java +++ /dev/null @@ -1,138 +0,0 @@ -package gregtech.common.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.automation.GT_MetaTileEntity_Filter; -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_Filter extends GT_ContainerMetaTile_Machine { - public GT_Container_Filter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(this.mTileEntity, 0, 98, 5)); - addSlotToContainer(new Slot(this.mTileEntity, 1, 116, 5)); - addSlotToContainer(new Slot(this.mTileEntity, 2, 134, 5)); - addSlotToContainer(new Slot(this.mTileEntity, 3, 98, 23)); - addSlotToContainer(new Slot(this.mTileEntity, 4, 116, 23)); - addSlotToContainer(new Slot(this.mTileEntity, 5, 134, 23)); - addSlotToContainer(new Slot(this.mTileEntity, 6, 98, 41)); - addSlotToContainer(new Slot(this.mTileEntity, 7, 116, 41)); - addSlotToContainer(new Slot(this.mTileEntity, 8, 134, 41)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 9, 18, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 35, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 11, 52, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 12, 18, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 13, 35, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 14, 52, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 15, 18, 40, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 16, 35, 40, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 17, 52, 40, false, true, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 18, 8, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 18, 26, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 18, 44, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 18, 62, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 18, 80, 63, false, true, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 9) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (this.mTileEntity.getMetaTileEntity() == null) { - return null; - } - if (aSlotIndex < 18) { - ItemStack tStack = aPlayer.inventory.getItemStack(); - if (tStack == null) { - tStack = tSlot.getStack(); - if (aMouseclick == 0) { - tSlot.putStack(null); - } else if (tStack != null) { - tStack = GT_Utility.copyAmountAndMetaData(tStack.stackSize, 32767, tStack); - if (GT_Utility.isStackInvalid(tStack)) { - tStack = null; - } - } - } else { - tSlot.putStack(GT_Utility.copyAmount(1L, new Object[] {tStack})); - } - return null; - } - if (aSlotIndex == 18) { - ((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bOutput = - (!((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bOutput); - if (((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bOutput) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116", "Emit Energy to Outputside")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117", "Don't emit Energy")); - } - return null; - } - if (aSlotIndex == 19) { - ((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = - (!((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); - if (((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { - GT_Utility.sendChatToPlayer( - aPlayer, GT_Utility.trans("122", "Emit Redstone if slots contain something")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("123", "Don't emit Redstone")); - } - return null; - } - if (aSlotIndex == 20) { - ((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bInvert = - (!((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bInvert); - if (((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bInvert) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120", "Invert Redstone")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121", "Don't invert Redstone")); - } - return null; - } - if (aSlotIndex == 21) { - ((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bInvertFilter = - (!((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bInvertFilter); - if (((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bInvertFilter) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("124", "Invert Filter")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("125", "Don't invert Filter")); - } - return null; - } - if (aSlotIndex == 22) { - ((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bIgnoreNBT = - (!((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bIgnoreNBT); - if (((GT_MetaTileEntity_Filter) this.mTileEntity.getMetaTileEntity()).bIgnoreNBT) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("126", "Ignore NBT")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("127", "NBT has to match")); - } - return null; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public int getSlotCount() { - return 9; - } - - @Override - public int getShiftClickSlotCount() { - return 9; - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_IndustrialApiary.java b/src/main/java/gregtech/common/gui/GT_Container_IndustrialApiary.java deleted file mode 100644 index 18cbee5d9c..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_IndustrialApiary.java +++ /dev/null @@ -1,249 +0,0 @@ -package gregtech.common.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.ForestryAPI; -import forestry.api.core.IErrorState; -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_ApiaryUpgrade; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_IndustrialApiary; -import java.util.ArrayList; -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; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; - -public class GT_Container_IndustrialApiary extends GT_ContainerMetaTile_Machine { - - GT_Slot_Holo slotItemTransferToggle; - GT_Slot_Holo slotSpeedToggle; - GT_Slot_Holo slotCancelProcess; - Slot slotBattery; - Slot slotSpecial; - ArrayList slotUpgrade; - - boolean mItemTransfer; - boolean mStuttering; - - int mSpeed = 0; // scale 0 - 8 - boolean mLockedSpeed = true; - - ArrayList mErrorStates = new ArrayList<>(50); - - public GT_Container_IndustrialApiary(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(slotItemTransferToggle = new GT_Slot_Holo(mTileEntity, 0, 8, 63, false, true, 1)); - addSlotToContainer(slotSpeedToggle = new GT_Slot_Holo(mTileEntity, 0, 26, 63, false, true, 1)); - addSlotToContainer(slotCancelProcess = new GT_Slot_Holo(mTileEntity, 0, 8, 27, false, true, 1)); - int tStartIndex = 5; - - addSlotToContainer(new ApiarySlot(this.mTileEntity, tStartIndex++, 37, 22)); - addSlotToContainer(new ApiarySlot(this.mTileEntity, tStartIndex++, 37, 42)); - - slotUpgrade = new ArrayList<>(4); - slotUpgrade.add(addSlotToContainer(new ApiarySlot(this.mTileEntity, tStartIndex++, 62, 24))); - slotUpgrade.add(addSlotToContainer(new ApiarySlot(this.mTileEntity, tStartIndex++, 80, 24))); - slotUpgrade.add(addSlotToContainer(new ApiarySlot(this.mTileEntity, tStartIndex++, 62, 42))); - slotUpgrade.add(addSlotToContainer(new ApiarySlot(this.mTileEntity, tStartIndex++, 80, 42))); - - for (int i = 107; i <= 143; i += 18) - for (int j = 6; j <= 42; j += 18) - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, tStartIndex++, i, j)); - - addSlotToContainer(slotBattery = new Slot(mTileEntity, 1, 80, 63)); - addSlotToContainer(slotSpecial = new Slot(mTileEntity, 3, 125, 63)); - } - - @Override - public ItemStack slotClick(int aSlotNumber, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (mTileEntity.getMetaTileEntity() == null) return null; - GT_MetaTileEntity_IndustrialApiary machine = getMachine(); - if (machine == null) return null; - switch (aSlotNumber) { - case 0: - machine.mItemTransfer = !machine.mItemTransfer; - return null; - case 1: - if (aMouseclick == 0) { - if (machine.mLockedSpeed) return null; - if (aShifthold == 0) { - machine.mSpeed++; - if (machine.mSpeed > machine.getMaxSpeed()) machine.mSpeed = 0; - } else if (aShifthold == 1) { - machine.mSpeed--; - if (machine.mSpeed < 0) machine.mSpeed = machine.getMaxSpeed(); - } - } else if (aMouseclick == 1) { - machine.mLockedSpeed = !machine.mLockedSpeed; - if (machine.mLockedSpeed) machine.mSpeed = machine.getMaxSpeed(); - } - return null; - case 2: - machine.cancelProcess(); - detectAndSendChanges(); - return null; - } - - if (!(aSlotNumber >= getSlotStartIndex() + 2 && aSlotNumber < getSlotStartIndex() + 2 + 4)) - return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - if (aShifthold == 5) return null; - if (aShifthold != 0) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - if (aMouseclick > 1) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - ItemStack s = aPlayer.inventory.getItemStack(); - if (s == null) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - Slot slot = getSlot(aSlotNumber); - ItemStack slotstack = slot.getStack(); - if (slotstack != null && !GT_Utility.areStacksEqual(slotstack, s)) return null; // super would replace item - if (slotstack == null && !slot.isItemValid(s)) - return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - if (!GT_ApiaryUpgrade.isUpgrade(s)) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - int max = GT_ApiaryUpgrade.getUpgrade(s).getMaxNumber(); - if (slotstack != null) max = Math.max(0, max - slotstack.stackSize); - max = Math.min(max, s.stackSize); - if (max == 0) return null; - if (aMouseclick == 1) max = 1; - if (max == s.stackSize) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - ItemStack newstack = s.splitStack(s.stackSize - max); - ItemStack result = super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - aPlayer.inventory.setItemStack(newstack); - return result; - } - - @Override - public int getSlotStartIndex() { - return 3; - } - - @Override - public int getSlotCount() { - return 6 + 9 + 2; - } - - @Override - public int getShiftClickSlotCount() { - return 6; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - - this.mSpeed = getMachine().mSpeed; - this.mItemTransfer = getMachine().mItemTransfer; - this.mStuttering = getMachine().mStuttering; - this.mLockedSpeed = getMachine().mLockedSpeed; - - for (Object crafter : this.crafters) { - ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 100, this.mSpeed); - var1.sendProgressBarUpdate(this, 101, this.mItemTransfer ? 1 : 0); - var1.sendProgressBarUpdate(this, 102, 0); - for (IErrorState s : getMachine().mErrorStates) var1.sendProgressBarUpdate(this, 103, s.getID()); - var1.sendProgressBarUpdate(this, 104, this.mStuttering ? 1 : 0); - var1.sendProgressBarUpdate(this, 105, this.mLockedSpeed ? 1 : 0); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mSpeed = par2; - break; - case 101: - this.mItemTransfer = par2 == 1; - break; - case 102: - this.mErrorStates.clear(); - break; - case 103: - this.mErrorStates.add(EnumChatFormatting.RED - + StatCollector.translateToLocal("for." - + ForestryAPI.errorStateRegistry - .getErrorState((short) par2) - .getDescription())); - break; - case 104: - this.mStuttering = par2 == 1; - break; - case 105: - this.mLockedSpeed = par2 == 1; - break; - } - } - - public GT_MetaTileEntity_IndustrialApiary getMachine() { - return (GT_MetaTileEntity_IndustrialApiary) mTileEntity.getMetaTileEntity(); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer aPlayer, int aSlotIndex) { - Slot s = getSlot(aSlotIndex); - if (s == null) return super.transferStackInSlot(aPlayer, aSlotIndex); - if (!(s.inventory instanceof InventoryPlayer)) return super.transferStackInSlot(aPlayer, aSlotIndex); - ItemStack aStack = s.getStack(); - if (aStack == null) return super.transferStackInSlot(aPlayer, aSlotIndex); - if (!GT_ApiaryUpgrade.isUpgrade(aStack)) return super.transferStackInSlot(aPlayer, aSlotIndex); - for (int i = getSlotStartIndex() + 2; i < getSlotStartIndex() + 2 + 4; i++) { - Slot iSlot = getSlot(i); - ItemStack iStack = iSlot.getStack(); - if (iStack == null) { - if (!iSlot.isItemValid(aStack)) continue; - } else { - if (!GT_Utility.areStacksEqual(aStack, iStack)) continue; - } - int max = GT_ApiaryUpgrade.getUpgrade(aStack).getMaxNumber(); - if (iStack == null) { - max = Math.min(max, aStack.stackSize); - ItemStack newstack = aStack.splitStack(max); - iSlot.putStack(newstack); - } else { - max = Math.max(0, max - iStack.stackSize); - max = Math.min(max, aStack.stackSize); - iStack.stackSize += max; - aStack.stackSize -= max; - iSlot.onSlotChanged(); - } - if (aStack.stackSize == 0) s.putStack(null); - else s.onSlotChanged(); - break; - } - return null; - } - - private static class ApiarySlot extends Slot { - - public ApiarySlot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { - super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_); - } - - @Override - public boolean isItemValid(ItemStack p_75214_1_) { - return this.inventory.isItemValidForSlot(this.getSlotIndex(), p_75214_1_); - } - - @Override - public void onSlotChanged() { - super.onSlotChanged(); - ((GT_MetaTileEntity_IndustrialApiary) ((IGregTechTileEntity) this.inventory).getMetaTileEntity()) - .onInventoryUpdate(this.getSlotIndex()); - } - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_InputBus_ME.java b/src/main/java/gregtech/common/gui/GT_Container_InputBus_ME.java deleted file mode 100644 index 58aff9ad08..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_InputBus_ME.java +++ /dev/null @@ -1,121 +0,0 @@ -package gregtech.common.gui; - -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_Holo_ME; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_InputBus_ME; -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_InputBus_ME extends GT_ContainerMetaTile_Machine { - private static final int LEFT_OFFSET = 8; - private static final int TOP_OFFSET = 10; - private static final int SLOT_SIZE = 18; - public static final int CIRCUIT_SLOT = 32; - - public GT_Container_InputBus_ME(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - for (int y = 0; y < 4; ++y) - for (int x = 0; x < 4; ++x) - addSlotToContainer(new GT_Slot_Holo( - this.mTileEntity, - x + y * 4, - LEFT_OFFSET + x * SLOT_SIZE, - TOP_OFFSET + y * SLOT_SIZE, - false, - true, - 1)); - for (int y = 0; y < 4; ++y) - for (int x = 0; x < 4; ++x) { - GT_Slot_Holo_ME slot = new GT_Slot_Holo_ME( - this.mTileEntity, - x + y * 4 + 16, - LEFT_OFFSET + x * SLOT_SIZE + 90, - TOP_OFFSET + y * SLOT_SIZE, - false, - true); - addSlotToContainer(slot); - } - super.addSlots(aInventoryPlayer); - } - - private boolean containsSuchStack(ItemStack tStack) { - for (int i = 0; i < 16; ++i) { - Slot tSlot = (Slot) this.inventorySlots.get(i); - if (tSlot != null && GT_Utility.areStacksEqual(tSlot.getStack(), tStack, false)) return true; - } - return false; - } - - private static final int PROGRESS_PACKET_INDEX_OFFSET = 200; - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - for (Object crafter : this.crafters) { - ICrafting player = (ICrafting) crafter; - for (int i = 0; i < 16; ++i) { - ItemStack s = ((Slot) this.inventorySlots.get(i + 16)).getStack(); - if (s == null) continue; - player.sendProgressBarUpdate(this, PROGRESS_PACKET_INDEX_OFFSET + 2 * i, s.stackSize & 65535); - player.sendProgressBarUpdate(this, PROGRESS_PACKET_INDEX_OFFSET + 2 * i + 1, s.stackSize >>> 16); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) { - super.updateProgressBar(id, value); - if (id >= PROGRESS_PACKET_INDEX_OFFSET && id < (PROGRESS_PACKET_INDEX_OFFSET + 32)) { - int index = (id - PROGRESS_PACKET_INDEX_OFFSET) / 2; - ItemStack s = ((Slot) this.inventorySlots.get(index + 16)).getStack(); - if (s != null) { - if ((id - PROGRESS_PACKET_INDEX_OFFSET) % 2 == 0) { - s.stackSize &= 0xFFFF0000; - s.stackSize += (value & 0xFFFF); - } else { - s.stackSize &= 0xFFFF; - s.stackSize += value << 16; - } - } - } - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex >= 0 && aSlotIndex < 16) { - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (this.mTileEntity.getMetaTileEntity() == null) return null; - ItemStack tStack = aPlayer.inventory.getItemStack(); - if (tStack == null) { - tSlot.putStack(null); - } else { - if (containsSuchStack(tStack)) return null; - tSlot.putStack(GT_Utility.copyAmount(1L, tStack)); - } - if (mTileEntity.isServerSide()) { - ItemStack newInfo = ((GT_MetaTileEntity_Hatch_InputBus_ME) mTileEntity.getMetaTileEntity()) - .updateInformationSlot(aSlotIndex, tStack); - ((Slot) this.inventorySlots.get(aSlotIndex + 16)).putStack(newInfo); - detectAndSendChanges(); - } - return null; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java b/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java deleted file mode 100644 index 2de68c9752..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java +++ /dev/null @@ -1,83 +0,0 @@ -package gregtech.common.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.automation.GT_MetaTileEntity_ItemDistributor; -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_ItemDistributor extends GT_ContainerMetaTile_Machine { - public GT_Container_ItemDistributor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - for (int y = 0; y < 3; y++) { - for (int x = 0; x < 9; x++) { - addSlotToContainer(new Slot(this.mTileEntity, x + y * 9, 8 + x * 18, 5 + y * 18)); - } - } - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 27) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (this.mTileEntity.getMetaTileEntity() == null) { - return null; - } - if (aSlotIndex == 27) { - ((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bOutput = - (!((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bOutput); - if (((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bOutput) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116", "Emit Energy to Outputside")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117", "Don't emit Energy")); - } - return null; - } - if (aSlotIndex == 28) { - ((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = - (!((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); - if (((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("118", "Emit Redstone if no Slot is free")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("119", "Don't emit Redstone")); - } - return null; - } - if (aSlotIndex == 29) { - ((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bInvert = - (!((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bInvert); - if (((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bInvert) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120", "Invert Redstone")); - } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121", "Don't invert Redstone")); - } - return null; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public int getSlotCount() { - return 27; - } - - @Override - public int getShiftClickSlotCount() { - return 27; - } -} diff --git a/src/main/java/gregtech/common/gui/GT_Container_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/gui/GT_Container_MicrowaveEnergyTransmitter.java deleted file mode 100644 index bd6b917f1f..0000000000 --- a/src/main/java/gregtech/common/gui/GT_Container_MicrowaveEnergyTransmitter.java +++ /dev/null @@ -1,188 +0,0 @@ -package gregtech.common.gui; - -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.common.tileentities.machines.basic.GT_MetaTileEntity_MicrowaveEnergyTransmitter; -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_MicrowaveEnergyTransmitter extends GT_ContainerMetaTile_Machine { - public int mEgg = 0; - public int mTargetD = 0; - public int mTargetZ = 0; - public int mTargetY = 0; - public int mTargetX = 0; - - public GT_Container_MicrowaveEnergyTransmitter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, fals