drive Factory

main
Walker Fowlkes 7 months ago
parent 555bc2ed22
commit 8cd16f5d92

@ -1,16 +1,13 @@
package net.brokenmoon.redcontrol.blockentities; package net.brokenmoon.redcontrol.blockentities;
import com.simon816.j65el02.device.ByteDiskDriver;
import com.simon816.j65el02.device.DiskDriver; import com.simon816.j65el02.device.DiskDriver;
import com.simon816.j65el02.device.FileDiskDriver;
import net.brokenmoon.redcontrol.RedControl; import net.brokenmoon.redcontrol.RedControl;
import net.brokenmoon.redcontrol.api.DriveFactory;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import java.io.IOException; import java.net.URI;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.file.Paths;
public class DriveEntity extends Peripheral{ public class DriveEntity extends Peripheral{
@ -27,7 +24,7 @@ public class DriveEntity extends Peripheral{
public DriveEntity(BlockPos pos, BlockState state) { public DriveEntity(BlockPos pos, BlockState state) {
super(RedControl.DRIVE_BLOCK_ENTITY, pos, state, 2); 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); this.buffer = ByteBuffer.allocateDirect(SECTOR_SIZE);
byte[] name = driver.getDriveName(); byte[] name = driver.getDriveName();
byte[] serial = driver.getDriveSerial(); byte[] serial = driver.getDriveSerial();
@ -115,7 +112,7 @@ public class DriveEntity extends Peripheral{
} }
} catch (Exception e) { } catch (Exception e) {
this.command = 0xff; this.command = 0xff;
e.printStackTrace(); //e.printStackTrace();
} }
} }
} }

@ -25,6 +25,7 @@ import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos import net.minecraft.util.math.BlockPos
import net.minecraft.world.World import net.minecraft.world.World
import java.io.FileNotFoundException import java.io.FileNotFoundException
import java.net.URI
import kotlin.experimental.xor import kotlin.experimental.xor
class TerminalBlock(settings: Settings) : NetworkCarrier(settings) { class TerminalBlock(settings: Settings) : NetworkCarrier(settings) {
@ -130,7 +131,6 @@ class TerminalEntity(pos: BlockPos, state: BlockState) : Peripheral(RedControl.T
markDirty() markDirty()
world?.updateListeners(pos, cachedState, cachedState, Block.NOTIFY_LISTENERS) world?.updateListeners(pos, cachedState, cachedState, Block.NOTIFY_LISTENERS)
} }
data.command = if (error) -1 else 0 data.command = if (error) -1 else 0
} }

Loading…
Cancel
Save