fix the buttons

main
Walker Fowlkes 7 months ago
parent b90fa0e343
commit 5b27ed603f

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

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

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

Loading…
Cancel
Save