From 5b27ed603f63c89e7c5b0536c8fe0fa58891aeee Mon Sep 17 00:00:00 2001 From: Walker Fowlkes Date: Fri, 12 Apr 2024 11:29:42 -0700 Subject: [PATCH] fix the buttons --- .../net/brokenmoon/redcontrol/RedControl.java | 15 +++++++++------ .../redcontrol/blocks/NetworkCarrier.java | 1 + .../redcontrol/mixin/MemoryAccessor.java | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/brokenmoon/redcontrol/RedControl.java b/src/main/java/net/brokenmoon/redcontrol/RedControl.java index c080bba..ec7aae0 100644 --- a/src/main/java/net/brokenmoon/redcontrol/RedControl.java +++ b/src/main/java/net/brokenmoon/redcontrol/RedControl.java @@ -90,25 +90,28 @@ public class RedControl implements ModInitializer { //Packets ServerPlayNetworking.registerGlobalReceiver(RedControlNetworking.CPU_START, ((server, player, handler, buf, responseSender) -> { server.execute(() -> { - CpuEntity cpu = (CpuEntity) player.getWorld().getBlockEntity(buf.readBlockPos()); + BlockPos blockPos = buf.readBlockPos(); + CpuEntity cpu = (CpuEntity) player.getWorld().getBlockEntity(blockPos); cpu.start(); - LOGGER.info("Starting cpu at " + buf.readBlockPos()); + LOGGER.info("Starting cpu at {}",blockPos); }); })); ServerPlayNetworking.registerGlobalReceiver(RedControlNetworking.CPU_STOP, ((server, player, handler, buf, responseSender) -> { server.execute(() -> { - CpuEntity cpu = (CpuEntity) player.getWorld().getBlockEntity(buf.readBlockPos()); + BlockPos blockPos = buf.readBlockPos(); + CpuEntity cpu = (CpuEntity) player.getWorld().getBlockEntity(blockPos); cpu.stop(); - LOGGER.info("Stopping cpu at " + buf.readBlockPos()); + LOGGER.info("Stopping cpu at {}",blockPos); }); })); ServerPlayNetworking.registerGlobalReceiver(RedControlNetworking.CPU_RESET, ((server, player, handler, buf, responseSender) -> { server.execute(() -> { - CpuEntity cpu = (CpuEntity) player.getWorld().getBlockEntity(buf.readBlockPos()); + BlockPos blockPos = buf.readBlockPos(); + CpuEntity cpu = (CpuEntity) player.getWorld().getBlockEntity(blockPos); cpu.reset(); - LOGGER.info("Resetting cpu at " + buf.readBlockPos()); + LOGGER.info("Resetting cpu at {}", blockPos); }); })); diff --git a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java index 77f0e94..7ffbacf 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java +++ b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java @@ -38,6 +38,7 @@ public abstract class NetworkCarrier extends BlockWithEntity implements BlockEnt } @Override + @SuppressWarnings("uses or overrides a deprecated API.") public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { if(state.hasBlockEntity() && world.getBlockEntity(pos) instanceof Peripheral){ if(((Peripheral) world.getBlockEntity(pos)).getBus() != null) diff --git a/src/main/java/net/brokenmoon/redcontrol/mixin/MemoryAccessor.java b/src/main/java/net/brokenmoon/redcontrol/mixin/MemoryAccessor.java index e5893be..55fa670 100644 --- a/src/main/java/net/brokenmoon/redcontrol/mixin/MemoryAccessor.java +++ b/src/main/java/net/brokenmoon/redcontrol/mixin/MemoryAccessor.java @@ -6,8 +6,8 @@ import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(Memory.class) public interface MemoryAccessor { - @Accessor("mem") + @Accessor(value = "mem",remap = false) byte[] getMem(); - @Accessor("mem") + @Accessor(value = "mem",remap = false) void setMem(byte[] mem); }