From 245beddeb456b296d133211a976fbec449a402c4 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Fri, 7 Jun 2024 14:12:09 +0200 Subject: Allow the controller slots of multiblocks to be automated (#2639) Allow multiblock controllers to mark internal slots as automatable, and mark the controller slot of PA, AAL and CAL as such --- .../multis/GT_TileEntity_CircuitAssemblyLine.java | 5 +++++ .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 15 ++++++++++++--- .../machines/multi/GT_MetaTileEntity_ProcessingArray.java | 5 +++++ src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java | 5 +++++ 4 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java index 9094d9faaa..06b80e1028 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java @@ -573,6 +573,11 @@ public class GT_TileEntity_CircuitAssemblyLine extends return true; } + @Override + protected boolean supportsSlotAutomation(int aSlot) { + return aSlot == getControllerSlotIndex(); + } + @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 32ea708773..29f24fa685 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -1822,13 +1822,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return false; + return supportsSlotAutomation(aIndex); } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return false; + return supportsSlotAutomation(aIndex); } protected ItemStack[] getCompactedInputs() { @@ -2088,7 +2088,16 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } public ItemStack getControllerSlot() { - return mInventory[1]; + return mInventory[getControllerSlotIndex()]; + } + + public final int getControllerSlotIndex() { + return 1; + } + + // True if the slot with index aSlot may be interacted with through automation + protected boolean supportsSlotAutomation(int aSlot) { + return false; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index 5f818c075b..abb0605df7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -497,6 +497,11 @@ public class GT_MetaTileEntity_ProcessingArray extends return true; } + @Override + protected boolean supportsSlotAutomation(int aSlot) { + return aSlot == getControllerSlotIndex(); + } + @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { super.addUIWidgets(builder, buildContext); diff --git a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java index 3bc891e572..244f5e8aed 100644 --- a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java +++ b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java @@ -931,6 +931,11 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas return false; } + @Override + protected boolean supportsSlotAutomation(int aSlot) { + return aSlot == getControllerSlotIndex(); + } + @Override public void getWailaBody(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { -- cgit