Only do NetworkCarrier if Squeaky Hammer in hand

main
Astoria 7 months ago
parent 9d744ad0d0
commit 44b600a835

@ -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);
}
}
}
}

Loading…
Cancel
Save