|
|
|
@ -14,6 +14,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|
|
|
|
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
|
|
|
|
|
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
|
|
|
|
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
|
|
|
|
import net.minecraft.block.entity.BlockEntity;
|
|
|
|
|
import net.minecraft.block.entity.BlockEntityType;
|
|
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
@ -109,6 +110,15 @@ public class RedControl implements ModInitializer {
|
|
|
|
|
cpu.reset();
|
|
|
|
|
LOGGER.info("Resetting cpu at {}", blockPos);
|
|
|
|
|
})));
|
|
|
|
|
|
|
|
|
|
ServerPlayNetworking.registerGlobalReceiver(RedControlNetworking.KEY_PRESS, ((server,player,handler,buf,responseSender) -> server.execute(() -> {
|
|
|
|
|
BlockPos blockPos = buf.readBlockPos();
|
|
|
|
|
byte key = buf.readByte();
|
|
|
|
|
BlockEntity term = player.getWorld().getBlockEntity(blockPos);
|
|
|
|
|
if (term instanceof TerminalEntity te) {
|
|
|
|
|
te.pushKey(key);
|
|
|
|
|
}
|
|
|
|
|
})));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Identifier modloc(String path) {return new Identifier("redcontrol",path);}
|
|
|
|
|