Cpu gui. not done, but works!

main
Astoria 3 weeks ago
parent 5b27ed603f
commit 40b92fb87f

@ -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() {

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

Loading…
Cancel
Save