diff options
author | YannickMG <yannickmg@gmail.com> | 2022-02-03 12:55:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 18:55:55 +0100 |
commit | a48a158ad76dfa0b8d74894bbbe8d2520ff760af (patch) | |
tree | ce6ac0d636c9076f15febc0e1a47efa25c83cdf6 /src/main/java/gregtech/common/gui | |
parent | b4ff9ad8d8a8003a2b0a63e0a2153f37f60cd02f (diff) | |
download | GT5-Unofficial-a48a158ad76dfa0b8d74894bbbe8d2520ff760af.tar.gz GT5-Unofficial-a48a158ad76dfa0b8d74894bbbe8d2520ff760af.tar.bz2 GT5-Unofficial-a48a158ad76dfa0b8d74894bbbe8d2520ff760af.zip |
Basic Machine NEI Power Tiers (#914)
* Add IntelliJ .shelf folder to .gitignore
* Fixing GT_GuiTooltip bug I introduced
* Deprecated superfluous String trans methods.
* Add Power class to compute and describe power usage
* trans -> GT_Utility.trans
Removed absent param from Javadoc
* Add Power to BasicMachine and use it for power calculations
* Steam BasicMachine rework
Have Bronze and Steel tier override Power with appropriate SteamPower
Make Bronze machines explicitly tier 1
Make Steel machines explicitly tier 2
Defined recipe list and bricked status for each machine
Unified checkRecipe uses machine's recipe list and Power
* Raised NEI dependency to 2.2.5
* Defining NEI transfer rect in individual UIs
Using a new interface called from GT_RectHandler
* Code cleanup & minor refactor
* Add power field to NEI Default Handler
Add method to create Power object from the recipe map
* Display power tier in NEI handler name
* User Power to draw NEI Handler description
* Enable filtering handler recipes using Power
* Repurposing aBricked parameter into aHighPressure
To fix my previous faulty method of setting mTier
* Must call getCache to get recipes properly.
* Better communicate NEI Overclock info
Diffstat (limited to 'src/main/java/gregtech/common/gui')
8 files changed, 86 insertions, 38 deletions
diff --git a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java index 64731c652f..827a7d2d10 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java +++ b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java @@ -41,36 +41,36 @@ public class GT_Container_ChestBuffer extends GT_ContainerMetaTile_Machine { 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, trans("116","Emit Energy to Outputside")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116","Emit Energy to Outputside")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("117","Don't emit Energy")); + 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, trans("118","Emit Redstone if no Slot is free")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("118","Emit Redstone if no Slot is free")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("119","Don't emit Redstone")); + 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, trans("120","Invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120","Invert Redstone")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("121","Don't invert Redstone")); + 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, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); + 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, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); + 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; } diff --git a/src/main/java/gregtech/common/gui/GT_Container_Filter.java b/src/main/java/gregtech/common/gui/GT_Container_Filter.java index cc3efaefb7..7ca72b8e3a 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_Filter.java +++ b/src/main/java/gregtech/common/gui/GT_Container_Filter.java @@ -72,45 +72,45 @@ public class GT_Container_Filter extends GT_ContainerMetaTile_Machine { 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, trans("116","Emit Energy to Outputside")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116","Emit Energy to Outputside")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("117","Don't emit Energy")); + 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, trans("122","Emit Redstone if slots contain something")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("122","Emit Redstone if slots contain something")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("123","Don't emit Redstone")); + 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, trans("120","Invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120","Invert Redstone")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("121","Don't invert Redstone")); + 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, trans("124","Invert Filter")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("124","Invert Filter")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("125","Don't invert Filter")); + 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, trans("126","Ignore NBT")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("126","Ignore NBT")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("127","NBT has to match")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("127","NBT has to match")); } return null; } diff --git a/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java b/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java index 0ee3cc1d44..6f3c8fe85c 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java +++ b/src/main/java/gregtech/common/gui/GT_Container_ItemDistributor.java @@ -40,27 +40,27 @@ public class GT_Container_ItemDistributor extends GT_ContainerMetaTile_Machine { 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, trans("116","Emit Energy to Outputside")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116","Emit Energy to Outputside")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("117","Don't emit Energy")); + 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, trans("118","Emit Redstone if no Slot is free")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("118","Emit Redstone if no Slot is free")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("119","Don't emit Redstone")); + 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, trans("120","Invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120","Invert Redstone")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("121","Don't invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121","Don't invert Redstone")); } return null; } diff --git a/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java b/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java index 6651d7875a..25179d718e 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java +++ b/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java @@ -35,12 +35,12 @@ public class GT_Container_OutputHatch extends GT_Container_BasicTank { // If player click the locker slot with empty or the same fluid cell, clear the lock fluid if (tReadyLockFluid == null || (tMode >= 8 && tReadyLockFluid.getFluid().getName().equals(tHatch.getLockedFluidName()))) { tHatch.setLockedFluidName(null); - GT_Utility.sendChatToPlayer(aPlayer, trans("300", "Fluid Lock Cleared.")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("300", "Fluid Lock Cleared.")); tHatch.mMode = 0; } else { tHatch.setLockedFluidName(tReadyLockFluid.getFluid().getName()); - GT_Utility.sendChatToPlayer(aPlayer, String.format(trans("151.4", "Sucessfully locked Fluid to %s"), tReadyLockFluid.getLocalizedName())); + GT_Utility.sendChatToPlayer(aPlayer, String.format(GT_Utility.trans("151.4", "Sucessfully locked Fluid to %s"), tReadyLockFluid.getLocalizedName())); tHatch.mMode = 9; } } diff --git a/src/main/java/gregtech/common/gui/GT_Container_Regulator.java b/src/main/java/gregtech/common/gui/GT_Container_Regulator.java index f50ac2dae3..909e1a04a5 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_Regulator.java +++ b/src/main/java/gregtech/common/gui/GT_Container_Regulator.java @@ -72,9 +72,9 @@ public class GT_Container_Regulator extends GT_ContainerMetaTile_Machine { if (aSlotIndex == 28) { ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput); if (((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput) { - GT_Utility.sendChatToPlayer(aPlayer, trans("116", "Emit Energy to Outputside")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116", "Emit Energy to Outputside")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("117", "Don't emit Energy")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117", "Don't emit Energy")); } return null; } diff --git a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java index 0b61a0910d..58df63e16a 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java +++ b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java @@ -36,36 +36,36 @@ public class GT_Container_SuperBuffer extends GT_ContainerMetaTile_Machine { if (aSlotIndex == 0) { ((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, trans("116","Emit Energy to Outputside")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116","Emit Energy to Outputside")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("117","Don't emit Energy")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117","Don't emit Energy")); } return null; } if (aSlotIndex == 1) { ((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, trans("118","Emit Redstone if no Slot is free")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("118","Emit Redstone if no Slot is free")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("119","Don't emit Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("119","Don't emit Redstone")); } return null; } if (aSlotIndex == 2) { ((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, trans("120","Invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120","Invert Redstone")); } else { - GT_Utility.sendChatToPlayer(aPlayer, trans("121","Don't invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121","Don't invert Redstone")); } return null; } if (aSlotIndex == 3) { ((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, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); + 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, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); + 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; } diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java index c1efb6ab58..9d597c7f30 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java @@ -4,11 +4,14 @@ import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; +import gregtech.nei.NEI_TransferRectHost; import net.minecraft.entity.player.InventoryPlayer; +import java.awt.Rectangle; + import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machine { +public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machine implements NEI_TransferRectHost { public String mNEI; String mName = ""; @@ -56,4 +59,24 @@ public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machi drawTexturedModalRect(x + 5, y + 156, 0, 251, Math.min(147, (int) (tScale * 148)), 5); } } + + @Override + public String getNeiTransferRectString() { + return mNEI; + } + + @Override + public String getNeiTransferRectTooltip() { + return "Recipes"; + } + + @Override + public Object[] getNeiTransferRectArgs() { + return new Object[0]; + } + + @Override + public Rectangle getNeiTransferRect() { + return new Rectangle(149, -7, 18, 18); + } } diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java index d804b3858e..08ee0d125c 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java @@ -4,9 +4,14 @@ import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.nei.NEI_TransferRectHost; import net.minecraft.entity.player.InventoryPlayer; -public class GT_GUIContainer_PrimitiveBlastFurnace extends GT_GUIContainerMetaTile_Machine { private String name; +import java.awt.*; + +public class GT_GUIContainer_PrimitiveBlastFurnace extends GT_GUIContainerMetaTile_Machine + implements NEI_TransferRectHost { + private String name; public String mNEI; private final static GT_GuiTabIconSet TAB_ICONSET = new GT_GuiTabIconSet( GT_GuiIcon.TAB_NORMAL_BRICK, @@ -43,4 +48,24 @@ public class GT_GUIContainer_PrimitiveBlastFurnace extends GT_GUIContainerMetaTi protected GT_GuiTabIconSet getTabBackground() { return TAB_ICONSET; } + + @Override + public String getNeiTransferRectString() { + return mNEI; + } + + @Override + public String getNeiTransferRectTooltip() { + return "Recipes"; + } + + @Override + public Object[] getNeiTransferRectArgs() { + return new Object[0]; + } + + @Override + public Rectangle getNeiTransferRect() { + return new Rectangle(51, 10, 24, 24); + } } |