|
|
|
@ -17,6 +17,7 @@ import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.block.entity.BlockEntityType;
|
|
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraft.registry.Registry;
|
|
|
|
|
import net.minecraft.registry.Registries;
|
|
|
|
|
import net.minecraft.resource.Resource;
|
|
|
|
@ -46,9 +47,11 @@ public class RedControl implements ModInitializer {
|
|
|
|
|
//Items
|
|
|
|
|
|
|
|
|
|
//Block Entities
|
|
|
|
|
public static final BlockEntityType<CpuEntity> CPU_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier("redcontrol", "cpu_block_entity"), FabricBlockEntityTypeBuilder.create(CpuEntity::new, CPU).build());
|
|
|
|
|
public static final BlockEntityType<MonitorEntity> MONITOR_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier("redcontrol", "monitor_block_entity"), FabricBlockEntityTypeBuilder.create(MonitorEntity::new, MONITOR).build());
|
|
|
|
|
public static final BlockEntityType<DriveEntity> DRIVE_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier("redcontrol", "drive_block_entity"), FabricBlockEntityTypeBuilder.create(DriveEntity::new, DRIVE).build());
|
|
|
|
|
public static final BlockEntityType<CpuEntity> CPU_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, modloc("cpu_block_entity"), FabricBlockEntityTypeBuilder.create(CpuEntity::new, CPU).build());
|
|
|
|
|
public static final BlockEntityType<MonitorEntity> MONITOR_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, modloc("monitor_block_entity"), FabricBlockEntityTypeBuilder.create(MonitorEntity::new, MONITOR).build());
|
|
|
|
|
public static final BlockEntityType<DriveEntity> DRIVE_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, modloc("drive_block_entity"), FabricBlockEntityTypeBuilder.create(DriveEntity::new, DRIVE).build());
|
|
|
|
|
|
|
|
|
|
public static final Item SQUEAKY_HAMMER = new Item(new FabricItemSettings());
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onInitialize() {
|
|
|
|
@ -80,12 +83,13 @@ public class RedControl implements ModInitializer {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
LOGGER.info("Initializing RedControl!");
|
|
|
|
|
Registry.register(Registries.BLOCK, new Identifier("redcontrol", "cpu"), CPU);
|
|
|
|
|
Registry.register(Registries.BLOCK, new Identifier("redcontrol", "monitor"), MONITOR);
|
|
|
|
|
Registry.register(Registries.BLOCK, new Identifier("redcontrol", "disk_drive"), DRIVE);
|
|
|
|
|
Registry.register(Registries.ITEM, new Identifier("redcontrol", "cpu"), new BlockItem(CPU, new FabricItemSettings()));
|
|
|
|
|
Registry.register(Registries.ITEM, new Identifier("redcontrol", "monitor"), new BlockItem(MONITOR, new FabricItemSettings()));
|
|
|
|
|
Registry.register(Registries.ITEM, new Identifier("redcontrol", "disk_drive"), new BlockItem(DRIVE, new FabricItemSettings()));
|
|
|
|
|
Registry.register(Registries.BLOCK, modloc("cpu"), CPU);
|
|
|
|
|
Registry.register(Registries.BLOCK, modloc("monitor"), MONITOR);
|
|
|
|
|
Registry.register(Registries.BLOCK, modloc("disk_drive"), DRIVE);
|
|
|
|
|
Registry.register(Registries.ITEM, modloc("cpu"), new BlockItem(CPU, new FabricItemSettings()));
|
|
|
|
|
Registry.register(Registries.ITEM, modloc("monitor"), new BlockItem(MONITOR, new FabricItemSettings()));
|
|
|
|
|
Registry.register(Registries.ITEM, modloc("disk_drive"), new BlockItem(DRIVE, new FabricItemSettings()));
|
|
|
|
|
Registry.register(Registries.ITEM, modloc("squeaky_hammer"), SQUEAKY_HAMMER);
|
|
|
|
|
|
|
|
|
|
//Packets
|
|
|
|
|
ServerPlayNetworking.registerGlobalReceiver(RedControlNetworking.CPU_START, ((server, player, handler, buf, responseSender) -> {
|
|
|
|
@ -114,6 +118,7 @@ public class RedControl implements ModInitializer {
|
|
|
|
|
LOGGER.info("Resetting cpu at {}", blockPos);
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Identifier modloc(String path) {return new Identifier("redcontrol",path);}
|
|
|
|
|
}
|