From 44b600a835b42ff120caebbd49b5e5c0e7a0716d Mon Sep 17 00:00:00 2001 From: Astoria Date: Fri, 12 Apr 2024 19:32:28 -0500 Subject: [PATCH] Only do NetworkCarrier if Squeaky Hammer in hand --- .../redcontrol/blocks/NetworkCarrier.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java index 7ffbacf..7e0656e 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java +++ b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java @@ -1,6 +1,7 @@ package net.brokenmoon.redcontrol.blocks; import com.simon816.j65el02.device.RedBus; +import net.brokenmoon.redcontrol.RedControl; import net.brokenmoon.redcontrol.api.RCWorldBus; import net.brokenmoon.redcontrol.blockentities.Peripheral; import net.brokenmoon.redcontrol.mixin.RedBusAccessor; @@ -87,15 +88,17 @@ public abstract class NetworkCarrier extends BlockWithEntity implements BlockEnt @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient) { - Peripheral peripheral = (Peripheral) world.getBlockEntity(pos); - player.sendMessage(Text.literal("Network Carrier Debug: "), false); - player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.getBus().hashCode())), false); - player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.getBus().getRedBus().hashCode())), false); - player.sendMessage(Text.literal(" Peripherals on RedBus: "), false); - RedBus.Peripheral[] peripherals = ((RedBusAccessor)peripheral.getBus().getRedBus()).getPeripherals(); - for (RedBus.Peripheral value : peripherals) { - if (value != null) { - player.sendMessage(Text.literal(" " + value.getClass().toString()), false); + if (player.getStackInHand(hand).getItem() == RedControl.SQUEAKY_HAMMER) { + Peripheral peripheral = (Peripheral) world.getBlockEntity(pos); + player.sendMessage(Text.literal("Network Carrier Debug: "), false); + player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.getBus().hashCode())), false); + player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.getBus().getRedBus().hashCode())), false); + player.sendMessage(Text.literal(" Peripherals on RedBus: "), false); + RedBus.Peripheral[] peripherals = ((RedBusAccessor) peripheral.getBus().getRedBus()).getPeripherals(); + for (RedBus.Peripheral value : peripherals) { + if (value != null) { + player.sendMessage(Text.literal(" " + value.getClass().toString()), false); + } } } }