diff options
| author | kstvr32 <109012629+kstvr32@users.noreply.github.com> | 2023-05-03 15:14:52 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-03 21:14:52 +0200 | 
| commit | 848a361a4f735bbd98307180b88df9c855051a83 (patch) | |
| tree | 874bf4f5189e6ff57a001e84bdbee8f67341dccd | |
| parent | da8c43bcd3a8ff78973eb8830bd1c99fbc56d4ac (diff) | |
| download | GT5-Unofficial-848a361a4f735bbd98307180b88df9c855051a83.tar.gz GT5-Unofficial-848a361a4f735bbd98307180b88df9c855051a83.tar.bz2 GT5-Unofficial-848a361a4f735bbd98307180b88df9c855051a83.zip | |
Adds 1 manual slot to Stocking Input Bus for lenses/molds (#1946)
* Adds 1 manual slot to Stocking Input Bus for lenses/molds
* Replace SlotGroup with SlotWidget
Co-authored-by: miozune <miozune@gmail.com>
* cleaned up code
---------
Co-authored-by: miozune <miozune@gmail.com>
| -rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java | 28 | 
1 files changed, 19 insertions, 9 deletions
| diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java index cb689065fc..5fed27a86c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java @@ -78,7 +78,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch              aName,              aNameRegional,              1, -            SLOT_COUNT * 2 + 1, +            SLOT_COUNT * 2 + 2,              new String[] { "Advanced item input for Multiblocks", "Retrieves directly from ME",                  "Keeps 16 item types in stock",                  "Auto-Pull from ME mode will automatically stock the first 16 items in the ME system, updated every 5 seconds.", @@ -90,7 +90,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch      public GT_MetaTileEntity_Hatch_InputBus_ME(String aName, int aTier, String[] aDescription,          ITexture[][][] aTextures) { -        super(aName, aTier, SLOT_COUNT * 2 + 1, aDescription, aTextures); +        super(aName, aTier, SLOT_COUNT * 2 + 2, aDescription, aTextures);          disableSort = true;      } @@ -239,7 +239,10 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch      }      @Override -    public void updateSlots() {} +    public void updateSlots() { +        if (mInventory[getManualSlot()] != null && mInventory[getManualSlot()].stackSize <= 0) +            mInventory[getManualSlot()] = null; +    }      @Override      public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, @@ -295,6 +298,10 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch          aPlayer.addChatMessage(new ChatComponentText("Saved Config to Data Stick"));      } +    private int getManualSlot() { +        return SLOT_COUNT * 2 + 1; +    } +      @Override      public int getCircuitSlot() {          return SLOT_COUNT * 2; @@ -307,12 +314,12 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch      @Override      public int getCircuitSlotY() { -        return 63; +        return 64;      }      @Override      public boolean setStackToZeroInsteadOfNull(int aIndex) { -        return true; +        return aIndex != getManualSlot();      }      @Override @@ -322,7 +329,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch          if (aIndex >= SLOT_COUNT && aIndex < SLOT_COUNT * 2)              // Display slots              return null; -        if (aIndex == getCircuitSlot()) return mInventory[aIndex]; +        if (aIndex == getCircuitSlot() || aIndex == getManualSlot()) return mInventory[aIndex];          if (GregTech_API.mAE2 && mInventory[aIndex] != null) {              AENetworkProxy proxy = getProxy();              if (proxy == null) { @@ -455,7 +462,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch      @Override      public boolean isValidSlot(int aIndex) { -        return false; +        return aIndex == getManualSlot();      }      @Override @@ -508,7 +515,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch                      .setPos(97, 9))              .widget(                  new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_DOUBLE) -                    .setPos(82, 40) +                    .setPos(82, 30)                      .setSize(12, 12))              .widget(new ButtonWidget().setOnClick((clickData, widget) -> {                  if (clickData.mouseButton == 0) { @@ -532,7 +539,10 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch                          "Right-Click to edit minimum stack size for item pulling."))                  .setSize(16, 16)                  .setPos(80, 10)) -            .widget(new FakeSyncWidget.BooleanSyncer(() -> autoPullItemList, this::setAutoPullItemList)); +            .widget(new FakeSyncWidget.BooleanSyncer(() -> autoPullItemList, this::setAutoPullItemList)) +            .widget( +                new SlotWidget(inventoryHandler, getManualSlot()).setBackground(getGUITextureSet().getItemSlot()) +                    .setPos(79, 45));      }      protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer player) { | 
