Partially complete floppies

main
Astoria 7 months ago
parent c0f1dbca6e
commit 9fcbfa755c

@ -6,7 +6,7 @@ import net.brokenmoon.redcontrol.blocks.CpuBlock;
import net.brokenmoon.redcontrol.blocks.DriveBlock;
import net.brokenmoon.redcontrol.blocks.TerminalBlock;
import net.brokenmoon.redcontrol.blocks.TerminalEntity;
import net.brokenmoon.redcontrol.item.BasicFloppy;
import net.brokenmoon.redcontrol.item.FloppyDisk;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
@ -46,7 +46,7 @@ public class RedControl implements ModInitializer {
public static final DriveBlock DRIVE = new DriveBlock(FabricBlockSettings.create().strength(4.0f));
//Items
public static final BasicFloppy BASIC_FLOPPY = new BasicFloppy(new FabricItemSettings().maxCount(1));
public static final FloppyDisk FLOPPY_ITEM = new FloppyDisk(new FabricItemSettings().maxCount(1));
//Block Entities
public static final BlockEntityType<CpuEntity> CPU_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, modloc("cpu_block_entity"), FabricBlockEntityTypeBuilder.create(CpuEntity::new, CPU).build());
@ -91,7 +91,7 @@ public class RedControl implements ModInitializer {
Registry.register(Registries.ITEM, modloc("monitor"), new BlockItem(TERMINAL, new FabricItemSettings()));
Registry.register(Registries.ITEM, modloc("disk_drive"), new BlockItem(DRIVE, new FabricItemSettings()));
Registry.register(Registries.ITEM, modloc("squeaky_hammer"), SQUEAKY_HAMMER);
Registry.register(Registries.ITEM, modloc("basic_disk"), BASIC_FLOPPY);
Registry.register(Registries.ITEM, modloc("floppy_disk"), FLOPPY_ITEM);
//Packets
ServerPlayNetworking.registerGlobalReceiver(RedControlNetworking.CPU_START, ((server, player, handler, buf, responseSender) -> server.execute(() -> {

@ -146,7 +146,8 @@ public class DriveEntity extends Peripheral{
private ActionResult loadDisk(PlayerEntity player, Hand hand) {
disk = player.getStackInHand(hand).copy();
player.setStackInHand(hand, ItemStack.EMPTY);
this.driver = DriveFactory.INSTANCE.createDriver(URI.create(String.valueOf(disk.getNbt().get("uri"))), String.valueOf(disk.getName()),disk.getNbt().getString("serial"));
RedControl.LOGGER.info("Loading with " + disk.getNbt().get("uri"));
this.driver = DriveFactory.INSTANCE.createDriver(URI.create(disk.getNbt().getString("uri")), String.valueOf(disk.getName()),disk.getNbt().getString("serial"));
this.buffer = ByteBuffer.allocateDirect(SECTOR_SIZE);
return ActionResult.SUCCESS;
}

Loading…
Cancel
Save