From 40b92fb87f17eba41705d9f33ba9b2b7154fbc51 Mon Sep 17 00:00:00 2001 From: Astoria Date: Fri, 12 Apr 2024 13:49:18 -0500 Subject: [PATCH] Cpu gui. not done, but works! --- .../net/brokenmoon/redcontrol/blockentities/CpuEntity.java | 4 ++++ .../java/net/brokenmoon/redcontrol/blocks/CpuBlock.java | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java index 1a67bd6..7a9bfc5 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java @@ -5,6 +5,7 @@ import net.brokenmoon.redcontrol.RedControl; import net.brokenmoon.redcontrol.api.Emulator; import net.brokenmoon.redcontrol.api.RCWorldBus; import net.brokenmoon.redcontrol.blocks.NetworkCarrier; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.listener.ClientPlayPacketListener; @@ -80,18 +81,21 @@ public class CpuEntity extends Peripheral{ isResetting = true; isReset = false; resetTimer = 5; + world.updateListeners(pos, this.getCachedState(), this.getCachedState(), Block.NOTIFY_LISTENERS); } public void stop() { isRunning = false; isResetting = false; isReset = false; + world.updateListeners(pos, this.getCachedState(), this.getCachedState(), Block.NOTIFY_LISTENERS); } public void start() { isRunning = true; isResetting = false; isReset = false; + world.updateListeners(pos, this.getCachedState(), this.getCachedState(), Block.NOTIFY_LISTENERS); } public void step() { diff --git a/src/main/java/net/brokenmoon/redcontrol/blocks/CpuBlock.java b/src/main/java/net/brokenmoon/redcontrol/blocks/CpuBlock.java index 75d5d07..f22e05c 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blocks/CpuBlock.java +++ b/src/main/java/net/brokenmoon/redcontrol/blocks/CpuBlock.java @@ -49,12 +49,6 @@ public class CpuBlock extends NetworkCarrier { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { super.onUse(state,world,pos,player,hand,hit); if (!world.isClient) { - CpuEntity peripheral = (CpuEntity) world.getBlockEntity(pos); - player.sendMessage(Text.literal("Cpu Debug: "), false); - player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.getBus().hashCode())), false); - player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.core.cpu.getBus().getRedBus().hashCode())), false); - player.sendMessage(Text.literal(" " + Integer.toHexString(peripheral.i)), false); - player.sendMessage(Text.literal(" " + peripheral.core.isWaitingOnInterrupt()), false); PacketByteBuf byteBuf = PacketByteBufs.create(); byteBuf.writeBlockPos(pos); ServerPlayNetworking.send((ServerPlayerEntity) player, RedControlNetworking.CPUGUI_PACKET_ID,byteBuf);