From 8cd16f5d924f8f3adcc10fbd5b896cf6b29829ad Mon Sep 17 00:00:00 2001 From: Walker Fowlkes Date: Fri, 12 Apr 2024 20:16:05 -0700 Subject: [PATCH] drive Factory --- .../redcontrol/blockentities/DriveEntity.java | 11 ++++------- .../java/net/brokenmoon/redcontrol/blocks/Terminal.kt | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java index d5ed751..455b460 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java @@ -1,16 +1,13 @@ package net.brokenmoon.redcontrol.blockentities; -import com.simon816.j65el02.device.ByteDiskDriver; import com.simon816.j65el02.device.DiskDriver; -import com.simon816.j65el02.device.FileDiskDriver; import net.brokenmoon.redcontrol.RedControl; +import net.brokenmoon.redcontrol.api.DriveFactory; import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; import net.minecraft.util.math.BlockPos; -import java.io.IOException; +import java.net.URI; import java.nio.ByteBuffer; -import java.nio.file.Paths; public class DriveEntity extends Peripheral{ @@ -27,7 +24,7 @@ public class DriveEntity extends Peripheral{ public DriveEntity(BlockPos pos, BlockState state) { super(RedControl.DRIVE_BLOCK_ENTITY, pos, state, 2); - this.driver = new ByteDiskDriver(RedControl.images.get("basic.img"), "Forth", "FORTH"); + this.driver = DriveFactory.INSTANCE.createDriver(URI.create("img://basic.img"),"Basic","BASIC"); this.buffer = ByteBuffer.allocateDirect(SECTOR_SIZE); byte[] name = driver.getDriveName(); byte[] serial = driver.getDriveSerial(); @@ -115,7 +112,7 @@ public class DriveEntity extends Peripheral{ } } catch (Exception e) { this.command = 0xff; - e.printStackTrace(); + //e.printStackTrace(); } } } diff --git a/src/main/java/net/brokenmoon/redcontrol/blocks/Terminal.kt b/src/main/java/net/brokenmoon/redcontrol/blocks/Terminal.kt index 87d7a03..c49ed0c 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blocks/Terminal.kt +++ b/src/main/java/net/brokenmoon/redcontrol/blocks/Terminal.kt @@ -25,6 +25,7 @@ import net.minecraft.util.hit.BlockHitResult import net.minecraft.util.math.BlockPos import net.minecraft.world.World import java.io.FileNotFoundException +import java.net.URI import kotlin.experimental.xor class TerminalBlock(settings: Settings) : NetworkCarrier(settings) { @@ -130,7 +131,6 @@ class TerminalEntity(pos: BlockPos, state: BlockState) : Peripheral(RedControl.T markDirty() world?.updateListeners(pos, cachedState, cachedState, Block.NOTIFY_LISTENERS) } - data.command = if (error) -1 else 0 }