diff options
author | NotAPenguin <michiel.vandeginste@gmail.com> | 2024-06-07 14:12:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 14:12:09 +0200 |
commit | 245beddeb456b296d133211a976fbec449a402c4 (patch) | |
tree | 42c2e816c33c085b62d682765b1e57e51a8271b7 /src/main/java/gregtech | |
parent | d1b422fbe45a8d2314433fd5166c12bcaa486461 (diff) | |
download | GT5-Unofficial-245beddeb456b296d133211a976fbec449a402c4.tar.gz GT5-Unofficial-245beddeb456b296d133211a976fbec449a402c4.tar.bz2 GT5-Unofficial-245beddeb456b296d133211a976fbec449a402c4.zip |
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
Diffstat (limited to 'src/main/java/gregtech')
2 files changed, 17 insertions, 3 deletions
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 @@ -498,6 +498,11 @@ public class GT_MetaTileEntity_ProcessingArray extends } @Override + protected boolean supportsSlotAutomation(int aSlot) { + return aSlot == getControllerSlotIndex(); + } + + @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { super.addUIWidgets(builder, buildContext); |