From fa7039a04a224385a6e7a0e49a95eb5b7585697d Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 27 Sep 2021 12:49:45 +0200 Subject: [PATCH] Patient Stalling - Items on belts now stall under empty-handed Deployers targeting them --- .../deployer/BeltDeployerCallbacks.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java index dfe84ba54..6499eaf02 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java @@ -45,6 +45,11 @@ public class BeltDeployerCallbacks { if (deployerTileEntity.redstoneLocked) return ProcessingResult.PASS; + DeployerFakePlayer player = deployerTileEntity.getPlayer(); + ItemStack held = player == null ? ItemStack.EMPTY : player.getMainHandItem(); + + if (held.isEmpty()) + return ProcessingResult.HOLD; if (deployerTileEntity.getRecipe(s.stack) == null) return ProcessingResult.PASS; @@ -60,6 +65,12 @@ public class BeltDeployerCallbacks { BlockState blockState = deployerTileEntity.getBlockState(); if (!blockState.hasProperty(FACING) || blockState.getValue(FACING) != Direction.DOWN) return ProcessingResult.PASS; + + DeployerFakePlayer player = deployerTileEntity.getPlayer(); + ItemStack held = player == null ? ItemStack.EMPTY : player.getMainHandItem(); + if (held.isEmpty()) + return ProcessingResult.HOLD; + IRecipe recipe = deployerTileEntity.getRecipe(s.stack); if (recipe == null) return ProcessingResult.PASS; @@ -68,10 +79,10 @@ public class BeltDeployerCallbacks { activate(s, i, deployerTileEntity, recipe); return ProcessingResult.HOLD; } - + if (deployerTileEntity.state == State.WAITING) { if (deployerTileEntity.redstoneLocked) - return ProcessingResult.PASS; + return ProcessingResult.PASS; deployerTileEntity.start(); } @@ -92,6 +103,10 @@ public class BeltDeployerCallbacks { copy.angle = centered ? 180 : Create.RANDOM.nextInt(360); return copy; }) + .map(t -> { + t.locked = false; + return t; + }) .collect(Collectors.toList()); TransportedItemStack left = transported.copy();