aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/blocks
diff options
context:
space:
mode:
authorquerns <33518699+querns@users.noreply.github.com>2024-09-19 08:53:17 -0500
committerGitHub <noreply@github.com>2024-09-19 15:53:17 +0200
commit7ba0fc903e5d14928d2b894b00a7b7dfc65eee18 (patch)
treeebb230105b63eee5cf116cf48d5827f7542a5c8b /src/main/java/gregtech/common/blocks
parentc24b78060631ea1868c06aeb3b45fd81218d379e (diff)
downloadGT5-Unofficial-7ba0fc903e5d14928d2b894b00a7b7dfc65eee18.tar.gz
GT5-Unofficial-7ba0fc903e5d14928d2b894b00a7b7dfc65eee18.tar.bz2
GT5-Unofficial-7ba0fc903e5d14928d2b894b00a7b7dfc65eee18.zip
Infinite Spraycan Additions (#3226)
Co-authored-by: Caedis <Caedis@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/common/blocks')
-rw-r--r--src/main/java/gregtech/common/blocks/BlockMachines.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/gregtech/common/blocks/BlockMachines.java b/src/main/java/gregtech/common/blocks/BlockMachines.java
index 1db6f51730..4c392f8cf5 100644
--- a/src/main/java/gregtech/common/blocks/BlockMachines.java
+++ b/src/main/java/gregtech/common/blocks/BlockMachines.java
@@ -42,6 +42,7 @@ import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IDebugableTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GTGenericBlock;
+import gregtech.api.items.MetaBaseItem;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.BaseTileEntity;
@@ -358,14 +359,28 @@ public class BlockMachines extends GTGenericBlock implements IDebugableBlock, IT
if (tTileEntity == null) {
return false;
}
+
+ final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+
if (aPlayer.isSneaking()) {
- final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
if (tCurrentItem != null && !GTUtility.isStackInList(tCurrentItem, GregTechAPI.sScrewdriverList)
&& !GTUtility.isStackInList(tCurrentItem, GregTechAPI.sWrenchList)
&& !GTUtility.isStackInList(tCurrentItem, GregTechAPI.sWireCutterList)
&& !GTUtility.isStackInList(tCurrentItem, GregTechAPI.sSolderingToolList)
&& !GTUtility.isStackInList(tCurrentItem, GregTechAPI.sJackhammerList)) return false;
}
+
+ final ForgeDirection side = ForgeDirection.getOrientation(ordinalSide);
+
+ // Used for Ring of Loki support
+ if (tCurrentItem != null && tCurrentItem.getItem() instanceof MetaBaseItem mbItem) {
+ if (mbItem.forEachBehavior(
+ tCurrentItem,
+ behavior -> behavior.shouldInterruptBlockActivation(aPlayer, tTileEntity, side))) {
+ return false;
+ }
+ }
+
if (tTileEntity instanceof IGregTechTileEntity gtTE) {
if (gtTE.getTimer() < 1L) {
return false;
@@ -373,8 +388,7 @@ public class BlockMachines extends GTGenericBlock implements IDebugableBlock, IT
if ((!aWorld.isRemote) && !gtTE.isUseableByPlayer(aPlayer)) {
return true;
}
- return ((IGregTechTileEntity) tTileEntity)
- .onRightclick(aPlayer, ForgeDirection.getOrientation(ordinalSide), aOffsetX, aOffsetY, aOffsetZ);
+ return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, side, aOffsetX, aOffsetY, aOffsetZ);
}
return false;
}