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