From fe1c5205f46fa71770c9c60de2cf98c5f0529b65 Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 17:35:35 -0500 Subject: [PATCH 1/7] Load bootloader at 0x400 --- src/main/java/net/brokenmoon/redcontrol/api/Emulator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java index 4d14d66..84362c0 100644 --- a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java +++ b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java @@ -23,8 +23,8 @@ public class Emulator { cpu.setBus(new TempBus(bus)); ram = new Memory(0x0000, 0x2000 - 1, ((CpuAccessor)cpu).getRedBusState()); try { - ram.loadFromFile(Paths.get("/home/astoria/code/java/mods/RedControl/src/main/resources/assets/redcontrol/image/rpcboot.bin"),0x00, 0x400); - ram.loadFromFile(Paths.get("/home/astoria/code/java/mods/RedControl/src/main/resources/assets/redcontrol/image/redforth.img"), 0x400, 0x100); + ram.loadFromFile(Paths.get("/home/astoria/code/java/mods/RedControl/src/main/resources/assets/redcontrol/image/rpcboot.bin"),0x400, 0x100); + } catch (IOException e) { throw new RuntimeException(e); } From 5a868589f048e8e6fda9e2d29a0b19891df33035 Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 19:02:16 -0500 Subject: [PATCH 2/7] ITS WORKING FINALLYYYYY --- J65el02 | 2 +- src/main/java/net/brokenmoon/redcontrol/api/Emulator.java | 1 + .../net/brokenmoon/redcontrol/blockentities/CpuEntity.java | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/J65el02 b/J65el02 index b439ab1..f95fe5e 160000 --- a/J65el02 +++ b/J65el02 @@ -1 +1 @@ -Subproject commit b439ab12a1be69b8eb7da404c17e9c0db30f641d +Subproject commit f95fe5ec0c8afb9a179376117a0f601b35e15f99 diff --git a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java index 84362c0..ac481cc 100644 --- a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java +++ b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java @@ -33,6 +33,7 @@ public class Emulator { ram.write(0, 2, ((CpuAccessor)cpu).getRedBusState()); ram.write(1, 1, ((CpuAccessor)cpu).getRedBusState()); System.out.println("Emulator made"); + System.out.println("Current PC position: " + this.cpu.getCpuState().pc); } public RedBus getBus() { diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java index 8eb5f9e..9200c8a 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java @@ -27,10 +27,13 @@ public class CpuEntity extends Peripheral{ public static void tick(World world, BlockPos pos, BlockState state, CpuEntity be) { if(be.notTicked) { + System.out.println("Ticking pre reset, PC at " + be.core.cpu.getCpuState().pc); be.reset(); + System.out.println("Ticking post reset, PC at " + be.core.cpu.getCpuState().pc); be.notTicked = false; } for(int i = 0; i < 500; i++) + System.out.println("Stepping, PC at " + be.core.cpu.getCpuState().pc); be.step(); if(be.core.isWaitingOnInterrupt()){ be.core.setWaitingOnInterrupt(); From 30151a0b9e81d76e7777216d22a1a786f082f9e1 Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 19:38:56 -0500 Subject: [PATCH 3/7] Get rid of a whole bunch of logspam, make block breaking less janky after world reload? --- .../brokenmoon/redcontrol/api/Emulator.java | 7 ++-- .../brokenmoon/redcontrol/api/TempBus.java | 27 --------------- .../brokenmoon/redcontrol/api/TempRedBus.java | 33 ------------------- .../redcontrol/blockentities/CpuEntity.java | 10 +----- .../redcontrol/blockentities/DriveEntity.java | 1 - .../blockentities/MonitorEntity.java | 2 -- .../redcontrol/blocks/NetworkCarrier.java | 6 ++-- 7 files changed, 6 insertions(+), 80 deletions(-) delete mode 100644 src/main/java/net/brokenmoon/redcontrol/api/TempBus.java delete mode 100644 src/main/java/net/brokenmoon/redcontrol/api/TempRedBus.java diff --git a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java index ac481cc..9034f05 100644 --- a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java +++ b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java @@ -1,5 +1,6 @@ package net.brokenmoon.redcontrol.api; +import com.simon816.j65el02.Bus; import com.simon816.j65el02.Cpu; import com.simon816.j65el02.CpuState; import com.simon816.j65el02.device.Memory; @@ -20,7 +21,7 @@ public class Emulator { public Emulator(RedBus bus){ this.bus = bus; cpu = new Cpu(); - cpu.setBus(new TempBus(bus)); + cpu.setBus(new Bus(bus)); ram = new Memory(0x0000, 0x2000 - 1, ((CpuAccessor)cpu).getRedBusState()); try { ram.loadFromFile(Paths.get("/home/astoria/code/java/mods/RedControl/src/main/resources/assets/redcontrol/image/rpcboot.bin"),0x400, 0x100); @@ -32,8 +33,6 @@ public class Emulator { cpu.reset(); ram.write(0, 2, ((CpuAccessor)cpu).getRedBusState()); ram.write(1, 1, ((CpuAccessor)cpu).getRedBusState()); - System.out.println("Emulator made"); - System.out.println("Current PC position: " + this.cpu.getCpuState().pc); } public RedBus getBus() { @@ -41,7 +40,6 @@ public class Emulator { } public void setBus(RedBus bus) { - RedControl.LOGGER.info("Setting Emulator bus"); this.bus = bus; ((BusAccessor)this.cpu.getBus()).setRedBus(bus); } @@ -57,7 +55,6 @@ public class Emulator { public void step() { if(!isWaitingOnInterrupt()) { CpuState state = ((CpuAccessor)this.cpu).getState(); - System.out.println(state.toTraceEvent()); this.cpu.step(); this.cpu.getBus().update(((CpuAccessor)cpu).getRedBusState()); } diff --git a/src/main/java/net/brokenmoon/redcontrol/api/TempBus.java b/src/main/java/net/brokenmoon/redcontrol/api/TempBus.java deleted file mode 100644 index f267675..0000000 --- a/src/main/java/net/brokenmoon/redcontrol/api/TempBus.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.brokenmoon.redcontrol.api; - -import com.simon816.j65el02.Bus; -import com.simon816.j65el02.device.Device; -import com.simon816.j65el02.device.RedBus; -import com.simon816.j65el02.device.RedBusState; -import net.brokenmoon.redcontrol.RedControl; - -public class TempBus extends Bus { - public TempBus(RedBus redBus) { - super(redBus); - } - - @Override - public void write(int address, int data, RedBusState state) { - Device device = findDevice(address,state); - //RedControl.LOGGER.info("Writing to bus with device " + device + "at address " + (address - device.startAddress(state)) + " with data " + data + " with target " + state.activeDeviceId + " and redbus offset of " + state.offset); - device.write(address - device.startAddress(state) % 0x2000, data, state); - } - - @Override - public int read(int address, boolean cpuAccess, RedBusState state) { - Device device = findDevice(address,state); - //RedControl.LOGGER.info("Reading from bus with device " + device + "at address " + (address - device.startAddress(state)) + " with target " + state.activeDeviceId + " and redbus offset of " + state.offset); - return device.read(address - device.startAddress(state) % 0x2000, cpuAccess, state) & 0xff; - } -} diff --git a/src/main/java/net/brokenmoon/redcontrol/api/TempRedBus.java b/src/main/java/net/brokenmoon/redcontrol/api/TempRedBus.java deleted file mode 100644 index 5cad760..0000000 --- a/src/main/java/net/brokenmoon/redcontrol/api/TempRedBus.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.brokenmoon.redcontrol.api; - -import com.simon816.j65el02.device.RedBus; -import com.simon816.j65el02.device.RedBusState; -import net.brokenmoon.redcontrol.RedControl; - -public class TempRedBus extends RedBus { - - @Override - public void write(int address, int data, RedBusState state) { - RedControl.LOGGER.info("Writing at " + address); - if (!state.enabled) { - return; - } - Peripheral peripheral = this.peripherals[state.activeDeviceId]; - if (peripheral != null) { - peripheral.write(address, data & 0xff); - } - } - - @Override - public int read(int address, boolean cpuAccess, RedBusState state) { - RedControl.LOGGER.info("Reading at " + address); - if (!state.enabled) { - return 0; - } - Peripheral peripheral = this.peripherals[state.activeDeviceId]; - if (peripheral != null) { - return peripheral.read(address); - } - return 0; - } -} diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java index 9200c8a..6dc8652 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java @@ -4,20 +4,15 @@ import com.simon816.j65el02.device.RedBus; import net.brokenmoon.redcontrol.RedControl; import net.brokenmoon.redcontrol.api.Emulator; import net.brokenmoon.redcontrol.api.RCWorldBus; -import net.brokenmoon.redcontrol.api.TempRedBus; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; - public class CpuEntity extends Peripheral{ public int i = 0; public boolean notTicked = true; - public Emulator core = new Emulator(new TempRedBus()); + public Emulator core = new Emulator(new RedBus()); private int defaultMonitorId = 1; private int defaultDriveId = 2; @@ -27,13 +22,10 @@ public class CpuEntity extends Peripheral{ public static void tick(World world, BlockPos pos, BlockState state, CpuEntity be) { if(be.notTicked) { - System.out.println("Ticking pre reset, PC at " + be.core.cpu.getCpuState().pc); be.reset(); - System.out.println("Ticking post reset, PC at " + be.core.cpu.getCpuState().pc); be.notTicked = false; } for(int i = 0; i < 500; i++) - System.out.println("Stepping, PC at " + be.core.cpu.getCpuState().pc); be.step(); if(be.core.isWaitingOnInterrupt()){ be.core.setWaitingOnInterrupt(); diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java index b5dbff1..a53dd4a 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/DriveEntity.java @@ -60,7 +60,6 @@ public class DriveEntity extends Peripheral{ @Override public int read(int address) { - RedControl.LOGGER.info("Drive Reading"); switch (address) { case 0x80: // Sector number (lo) return this.sector & 0xff; diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/MonitorEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/MonitorEntity.java index 0c92e1f..1bfac77 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/MonitorEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/MonitorEntity.java @@ -47,7 +47,6 @@ public class MonitorEntity extends Peripheral { @Override public void write(int address, int data) { - RedControl.LOGGER.info("Monitor Writing"); switch (address) { case 0x00: this.accessRow = data; @@ -146,7 +145,6 @@ public class MonitorEntity extends Peripheral { @Override public void update() { - RedControl.LOGGER.info("MONITOR UPDATED"); int maxWidth = Math.min(WIDTH, this.blitWidth + this.blitXOffset); int maxHeight = Math.min(HEIGHT, this.blitHeight + this.blitYOffset); diff --git a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java index 8e03ac8..53db078 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java +++ b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java @@ -2,7 +2,6 @@ package net.brokenmoon.redcontrol.blocks; import com.simon816.j65el02.device.RedBus; import net.brokenmoon.redcontrol.api.RCWorldBus; -import net.brokenmoon.redcontrol.api.TempRedBus; import net.brokenmoon.redcontrol.blockentities.Peripheral; import net.brokenmoon.redcontrol.mixin.RedBusAccessor; import net.minecraft.block.*; @@ -38,7 +37,8 @@ public abstract class NetworkCarrier extends BlockWithEntity implements BlockEnt @Override public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { if(state.hasBlockEntity() && world.getBlockEntity(pos) instanceof Peripheral){ - ((Peripheral) world.getBlockEntity(pos)).getBus().setValid(false); + if(((Peripheral) world.getBlockEntity(pos)).getBus() != null) + ((Peripheral) world.getBlockEntity(pos)).getBus().setValid(false); } if (state.hasBlockEntity() && !state.isOf(newState.getBlock())) { world.removeBlockEntity(pos); @@ -56,7 +56,7 @@ public abstract class NetworkCarrier extends BlockWithEntity implements BlockEnt Block worldBlock = world.getBlockState(pos).getBlock(); if(world.getBlockEntity(pos) instanceof Peripheral){ Peripheral entityBlock = (Peripheral) world.getBlockEntity(pos); - RCWorldBus bus = new RCWorldBus(new TempRedBus(), world, pos); + RCWorldBus bus = new RCWorldBus(new RedBus(), world, pos); entityBlock.setBus(bus); entityBlock.getBus().setValid(true); floodBus(entityBlock.getBus(), world, pos); From f51f74b2fcd2ea01a516abf460ef31dd148b2bc8 Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 19:49:43 -0500 Subject: [PATCH 4/7] Final fixes --- .../java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java index 6dc8652..a5f3a13 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java +++ b/src/main/java/net/brokenmoon/redcontrol/blockentities/CpuEntity.java @@ -22,7 +22,6 @@ public class CpuEntity extends Peripheral{ public static void tick(World world, BlockPos pos, BlockState state, CpuEntity be) { if(be.notTicked) { - be.reset(); be.notTicked = false; } for(int i = 0; i < 500; i++) From 0222dd2dca9be63961f39a0bc9f9d7072db8d8bc Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 21:26:33 -0500 Subject: [PATCH 5/7] Add LogConsumer (?) --- .../java/net/brokenmoon/redcontrol/api/Emulator.java | 1 + .../net/brokenmoon/redcontrol/api/LogConsumer.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java diff --git a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java index 9034f05..a843ae7 100644 --- a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java +++ b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java @@ -21,6 +21,7 @@ public class Emulator { public Emulator(RedBus bus){ this.bus = bus; cpu = new Cpu(); + cpu.setLogCallback(new LogConsumer()); cpu.setBus(new Bus(bus)); ram = new Memory(0x0000, 0x2000 - 1, ((CpuAccessor)cpu).getRedBusState()); try { diff --git a/src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java b/src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java new file mode 100644 index 0000000..facf7ff --- /dev/null +++ b/src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java @@ -0,0 +1,12 @@ +package net.brokenmoon.redcontrol.api; + +import net.brokenmoon.redcontrol.RedControl; + +import java.util.function.IntConsumer; + +public class LogConsumer implements IntConsumer { + @Override + public void accept(int value) { + RedControl.LOGGER.info("Cpu MMU Logger: " + value); + } +} From e76ea5f6ebdb2ce932f3eaf1ac75fdd8f145f507 Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 21:26:48 -0500 Subject: [PATCH 6/7] Revert to Walksanators fork --- J65el02 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/J65el02 b/J65el02 index f95fe5e..cf118fb 160000 --- a/J65el02 +++ b/J65el02 @@ -1 +1 @@ -Subproject commit f95fe5ec0c8afb9a179376117a0f601b35e15f99 +Subproject commit cf118fb903c4036c5c6707bf55abcb5da2d4fc53 From 3834bff82603423ae6b0de542d76fc471738ec78 Mon Sep 17 00:00:00 2001 From: Astoria Date: Thu, 11 Apr 2024 10:40:05 -0500 Subject: [PATCH 7/7] Textures! Not great ones, but they exist. --- .../net/brokenmoon/redcontrol/RedControl.java | 4 +-- .../redcontrol/blocks/NetworkCarrier.java | 14 +++++++++++ .../assets/redcontrol/blockstates/cpu.json | 8 ++++++ .../redcontrol/blockstates/disk_drive.json | 8 ++++++ .../redcontrol/blockstates/monitor.json | 8 ++++++ .../assets/redcontrol/models/block/cpu.json | 23 ++++++++++++++++++ .../redcontrol/models/block/disk_drive.json | 23 ++++++++++++++++++ .../redcontrol/models/block/monitor.json | 23 ++++++++++++++++++ .../assets/redcontrol/models/item/cpu.json | 3 +++ .../redcontrol/models/item/disk_drive.json | 3 +++ .../redcontrol/models/item/monitor.json | 3 +++ .../assets/redcontrol/textures/block/cpu.ase | Bin 0 -> 418 bytes .../assets/redcontrol/textures/block/cpu.png | Bin 0 -> 231 bytes .../redcontrol/textures/block/disk_drive.ase | Bin 0 -> 411 bytes .../redcontrol/textures/block/disk_drive.png | Bin 0 -> 226 bytes .../redcontrol/textures/block/monitor.ase | Bin 0 -> 993 bytes .../redcontrol/textures/block/monitor.png | Bin 0 -> 1105 bytes .../textures/block/monitor_back.png | Bin 0 -> 297 bytes .../textures/block/monitor_bottom.png | Bin 0 -> 109 bytes .../textures/block/monitor_front.png | Bin 0 -> 276 bytes .../textures/block/monitor_left.png | Bin 0 -> 272 bytes .../textures/block/monitor_right.png | Bin 0 -> 267 bytes .../redcontrol/textures/block/monitor_top.png | Bin 0 -> 105 bytes 23 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/assets/redcontrol/blockstates/cpu.json create mode 100644 src/main/resources/assets/redcontrol/blockstates/disk_drive.json create mode 100644 src/main/resources/assets/redcontrol/blockstates/monitor.json create mode 100644 src/main/resources/assets/redcontrol/models/block/cpu.json create mode 100644 src/main/resources/assets/redcontrol/models/block/disk_drive.json create mode 100644 src/main/resources/assets/redcontrol/models/block/monitor.json create mode 100644 src/main/resources/assets/redcontrol/models/item/cpu.json create mode 100644 src/main/resources/assets/redcontrol/models/item/disk_drive.json create mode 100644 src/main/resources/assets/redcontrol/models/item/monitor.json create mode 100644 src/main/resources/assets/redcontrol/textures/block/cpu.ase create mode 100644 src/main/resources/assets/redcontrol/textures/block/cpu.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/disk_drive.ase create mode 100644 src/main/resources/assets/redcontrol/textures/block/disk_drive.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor.ase create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor_back.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor_bottom.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor_front.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor_left.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor_right.png create mode 100644 src/main/resources/assets/redcontrol/textures/block/monitor_top.png diff --git a/src/main/java/net/brokenmoon/redcontrol/RedControl.java b/src/main/java/net/brokenmoon/redcontrol/RedControl.java index 550beea..e3fd360 100644 --- a/src/main/java/net/brokenmoon/redcontrol/RedControl.java +++ b/src/main/java/net/brokenmoon/redcontrol/RedControl.java @@ -46,10 +46,10 @@ 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", "drive"), DRIVE); + 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", "drive"), new BlockItem(DRIVE, new FabricItemSettings())); + Registry.register(Registries.ITEM, new Identifier("redcontrol", "disk_drive"), new BlockItem(DRIVE, new FabricItemSettings())); } } \ No newline at end of file diff --git a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java index 53db078..6efecca 100644 --- a/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java +++ b/src/main/java/net/brokenmoon/redcontrol/blocks/NetworkCarrier.java @@ -7,7 +7,10 @@ import net.brokenmoon.redcontrol.mixin.RedBusAccessor; import net.minecraft.block.*; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.Properties; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -97,4 +100,15 @@ public abstract class NetworkCarrier extends BlockWithEntity implements BlockEnt return ActionResult.SUCCESS; } + + @Override + protected void appendProperties(StateManager.Builder builder) { + builder.add(Properties.HORIZONTAL_FACING); + } + + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return super.getPlacementState(ctx).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + } + } diff --git a/src/main/resources/assets/redcontrol/blockstates/cpu.json b/src/main/resources/assets/redcontrol/blockstates/cpu.json new file mode 100644 index 0000000..f817c96 --- /dev/null +++ b/src/main/resources/assets/redcontrol/blockstates/cpu.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "redcontrol:block/cpu", "uvlock": false }, + "facing=east": { "model": "redcontrol:block/cpu", "y": 90, "uvlock": false }, + "facing=south": { "model": "redcontrol:block/cpu", "y": 180, "uvlock": false }, + "facing=west": { "model": "redcontrol:block/cpu", "y": 270, "uvlock": false } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/blockstates/disk_drive.json b/src/main/resources/assets/redcontrol/blockstates/disk_drive.json new file mode 100644 index 0000000..cf95c47 --- /dev/null +++ b/src/main/resources/assets/redcontrol/blockstates/disk_drive.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "redcontrol:block/disk_drive", "uvlock": false }, + "facing=east": { "model": "redcontrol:block/disk_drive", "y": 90, "uvlock": false }, + "facing=south": { "model": "redcontrol:block/disk_drive", "y": 180, "uvlock": false }, + "facing=west": { "model": "redcontrol:block/disk_drive", "y": 270, "uvlock": false } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/blockstates/monitor.json b/src/main/resources/assets/redcontrol/blockstates/monitor.json new file mode 100644 index 0000000..dfa8163 --- /dev/null +++ b/src/main/resources/assets/redcontrol/blockstates/monitor.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "redcontrol:block/monitor", "uvlock": false }, + "facing=east": { "model": "redcontrol:block/monitor", "y": 90, "uvlock": false }, + "facing=south": { "model": "redcontrol:block/monitor", "y": 180, "uvlock": false }, + "facing=west": { "model": "redcontrol:block/monitor", "y": 270, "uvlock": false } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/models/block/cpu.json b/src/main/resources/assets/redcontrol/models/block/cpu.json new file mode 100644 index 0000000..64cebdb --- /dev/null +++ b/src/main/resources/assets/redcontrol/models/block/cpu.json @@ -0,0 +1,23 @@ +{ "parent": "block/block", + "textures": { + "front": "redcontrol:block/cpu", + "left": "redcontrol:block/monitor_left", + "right": "redcontrol:block/monitor_right", + "back": "redcontrol:block/monitor_back", + "top": "redcontrol:block/monitor_bottom", + "bottom": "redcontrol:block/monitor_top" + }, + "elements": [ + { "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#bottom", "cullface": "down" }, + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front", "cullface": "north" }, + "south": { "texture": "#back", "cullface": "south" }, + "west": { "texture": "#right", "cullface": "west" }, + "east": { "texture": "#left", "cullface": "east" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/models/block/disk_drive.json b/src/main/resources/assets/redcontrol/models/block/disk_drive.json new file mode 100644 index 0000000..b839bb0 --- /dev/null +++ b/src/main/resources/assets/redcontrol/models/block/disk_drive.json @@ -0,0 +1,23 @@ +{ "parent": "block/block", + "textures": { + "front": "redcontrol:block/disk_drive", + "left": "redcontrol:block/monitor_left", + "right": "redcontrol:block/monitor_right", + "back": "redcontrol:block/monitor_back", + "top": "redcontrol:block/monitor_bottom", + "bottom": "redcontrol:block/monitor_top" + }, + "elements": [ + { "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#bottom", "cullface": "down" }, + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front", "cullface": "north" }, + "south": { "texture": "#back", "cullface": "south" }, + "west": { "texture": "#right", "cullface": "west" }, + "east": { "texture": "#left", "cullface": "east" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/models/block/monitor.json b/src/main/resources/assets/redcontrol/models/block/monitor.json new file mode 100644 index 0000000..343d9d4 --- /dev/null +++ b/src/main/resources/assets/redcontrol/models/block/monitor.json @@ -0,0 +1,23 @@ +{ "parent": "block/block", + "textures": { + "front": "redcontrol:block/monitor_front", + "left": "redcontrol:block/monitor_left", + "right": "redcontrol:block/monitor_right", + "back": "redcontrol:block/monitor_back", + "top": "redcontrol:block/monitor_bottom", + "bottom": "redcontrol:block/monitor_top" + }, + "elements": [ + { "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#bottom", "cullface": "down" }, + "up": { "texture": "#top", "cullface": "up" }, + "north": { "texture": "#front", "cullface": "north" }, + "south": { "texture": "#back", "cullface": "south" }, + "west": { "texture": "#right", "cullface": "west" }, + "east": { "texture": "#left", "cullface": "east" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/models/item/cpu.json b/src/main/resources/assets/redcontrol/models/item/cpu.json new file mode 100644 index 0000000..4530cc2 --- /dev/null +++ b/src/main/resources/assets/redcontrol/models/item/cpu.json @@ -0,0 +1,3 @@ +{ + "parent": "redcontrol:block/cpu" +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/models/item/disk_drive.json b/src/main/resources/assets/redcontrol/models/item/disk_drive.json new file mode 100644 index 0000000..4125203 --- /dev/null +++ b/src/main/resources/assets/redcontrol/models/item/disk_drive.json @@ -0,0 +1,3 @@ +{ + "parent": "redcontrol:block/disk_drive" +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/models/item/monitor.json b/src/main/resources/assets/redcontrol/models/item/monitor.json new file mode 100644 index 0000000..a63f05a --- /dev/null +++ b/src/main/resources/assets/redcontrol/models/item/monitor.json @@ -0,0 +1,3 @@ +{ + "parent": "redcontrol:block/monitor" +} \ No newline at end of file diff --git a/src/main/resources/assets/redcontrol/textures/block/cpu.ase b/src/main/resources/assets/redcontrol/textures/block/cpu.ase new file mode 100644 index 0000000000000000000000000000000000000000..3da393b7ddb644a768c3a32b9819df528384e17a GIT binary patch literal 418 zcmZ3)$iVPmDItzu+j zX>VU*kkAyJ_b_?(|M;^{PT&6X|NsBlYqz)5wP$8!MTP~HId!cuGP)U_e7$;C|8%de zd;@uqO$y9F5(fSQ8SD%`iIu5E3Wmi%4yyu0>OT{Nh6GN<9Ak6SpZRti8`@@Rc}mRw zr&Ij;zg!htLfNF{59|4}-~K;l^{V8u|H|K*7ws?1xb`o9Yw5rE)KvCmA77q7&&!Zp dQntAF@&8P|yo6aYe~;XW&j<_;OXk;vd$@?2>?JRTKxb3 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redcontrol/textures/block/disk_drive.ase b/src/main/resources/assets/redcontrol/textures/block/disk_drive.ase new file mode 100644 index 0000000000000000000000000000000000000000..de5b0f988ff29ab4286ce8745f6bce5beaf5cdac GIT binary patch literal 411 zcmbQu$iVPmDI4A6dY*vH*=017dasu$4%b zWC7VMAlE4X8A=K!t{OIJmWKUd*7pn5ZZ1fBcX-zCPi8Zp24w9sFrSj=ov9z>tzu+j zX>VU*kkAyJ_b_?(|M;^{PT&6X|NsBlYqz)5wP$8!MTP~HId!cuGP)U_e7$;C|8%de zd;@uqO$y9F5(fSQ8SD%`iIu5E3WhmA4yyu0>OT{Nh6GN<9Ak6SpZRti8`@@Rc}h&L zbFJL@f0NOr2tyCP`E{bINB>WH^yt5|0{{PaB9Smc_TpeUB~+6OMS+^I(Hi Z{JTD-Ym*+9r~}=};OXk;vd$@?2>_=;Syli5 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redcontrol/textures/block/monitor.ase b/src/main/resources/assets/redcontrol/textures/block/monitor.ase new file mode 100644 index 0000000000000000000000000000000000000000..0e6b10da22eeb781f737baa7bf2a13ff9e4759dd GIT binary patch literal 993 zcmaFJ%)szqDI*DFI2m^Ano1ZS-(G-&3qb=wa>tON}hM7evr3{ zk&UIjeThLrQ*_?LRtWQ zy}I%Z;?Oq zt2Tz^B&mH=y{IBRx$BCEcg^zKW}yNH%|ohIa2<6LwGpw+$bY-?%aZT&et(>2#H~Cz zwfvs?>uts#HZ>z1f_%8iDn5Y_*z!O3$5ANRpS5d7&};pG9>H+dTW6 z<;FAi)mN6qu?1Rd3fEaRubQ7SVdLyClXdIQ7lqw{i-9hhM6@dfxWUja#-1|L;~uM8&nH75iDWuX_CJl@K3) z*@Hi)m-j7RQ=eJM8W#WiLY8jCM|a7McU$70Sc-OYqq)K^LeS@qyI}joOCWdEpNW;$!#J zw>}K7ber{Qc17K+Z>!hHNB^FFBIfum8v2sdk&X<~aZEWbSW0p7Ql2kIMJAXT$UUAOD`ev2L329K%!n z>wWE#ZPeE1C;gp0r+(_C+WHHz-*-L!|Gw_-^Ld}G_ah^p$9tE5IQ8@FkJS6obME)q z8^3W}TFA2WmD-iGe#Q1@3X^B@)%9uf{`P$uk>LLXNJz3gDGnnjq4b->EM5n-@mKmm;OJh(=_#H%>(^u(vAB=TpRb#a&MHsEx*|Q?d#)r_h-G;e_9p& F8UUqopg{lt literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redcontrol/textures/block/monitor.png b/src/main/resources/assets/redcontrol/textures/block/monitor.png new file mode 100644 index 0000000000000000000000000000000000000000..434d1965c4c8c8ae969dcb42e5a745be4f44ef55 GIT binary patch literal 1105 zcmV-X1g`suP)Px(3rR#lRA_Vs6LSht9qltIi`U~K~7%tTC3%v3d z81=#!FZ34}y)fRHNbn0UL`0)O-3B8fnpW7>v5k2#PVL9(S-YNEmh4HIzHQIx`#gQ$ z^PY1mz#|^qzf<yxcN}9_Anw;jga1fpD>dr_o|5y^%u0S>Gcac z0gb$qX8@q7qY=G*>#pJY)ted1*YGOv?aUKL?d&2EvLj(84*(-WC(ASue&NyM_nLiR zf4uzd`+~){Xubi^$rFqWo%B7W03&&V1N-9^-xdLOJz+R?vnudgC#-KGnn5d-tTwiTc)N-)KVw#*gq4;eD>^VS19T!2tTrJ6%a5Rx^XJ`?ijdEUdgj3kndQvHAS;1u<0REN6*Dt3X zx8(t*0M;B~h8se5ZEK0FCLons!otE=oIih#X(tj%iz6O0Do{xwk}}VpJx4r#kZEfI zQmG}(&d%Y`p*ZH|J|dAw+S-GI0|uvxq9DJqiPjboqoc?0^yvrf%mV47uk*23KW1m= zpeTP3jYgR^P{|MxfJRJ`Iv~q3(+-C_Y)KK)dh+>=O~ZL~^q6h`aJU15g9DId8Ir`d z6N%)%2DEBZ3kKeT3bZJnH3pH3PX~@hH+QT_Pi;niyhf^hUa;}>w4+c_>8Ci zbsvF-fS}P35HuPBf<{9?&}aw<8VvzK!}EUN=#j&o_5+_je`)LoxWMg?U;Q6wFK9%- zjGsS&-90BzEUck*M+EZ9JCuq!V6*a9V$UAF{(Ol*KJx>j(2QasgO;{VwC(JM(A4CI zD}MwO@(PND3^sDVQ7YuHW7j^EOC>*C@lT;jimYuN09pYQSGlJSLER7Hx);DLg?QC< zx8NqAy&Z@|M3jnUDC;cD=GpWd1WR8{5al3xU}SsV7R$_k;K^ X;II()?-{W400000NkvXXu0mjfRzwb` literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redcontrol/textures/block/monitor_back.png b/src/main/resources/assets/redcontrol/textures/block/monitor_back.png new file mode 100644 index 0000000000000000000000000000000000000000..18b441e562359d7d0f1801aa5e792cdfa06d5b1d GIT binary patch literal 297 zcmV+^0oMMBP)Px#<4Ht8R5*>TlTB;FKoEwXjUS0xNQsda?6sx$g8%<7c<~QZ3N<1wx@7F`COv2l zVvySPg@HNj4A0EFqu$?MYXTI76a#ddBu&$s3bodECTLU?@c8_JvpeEJ&UQ7&yArAj zfXU?ieJjDid=sf2&KmkjMlyOrbvmsCtqtr!Px#&PhZ;R5*?8lEDpvKoCVAgg_0;-4k9+P>c;why_@ICo8Z33$X!XyxRiAgNdj} zP(%;9${Hld*?*Z$cHZBgnbo|mdjn{-I~?~r(j*}{9Z2GsI@0A~y9vm$3)k#Y3zRYd z!Z08VgP%YEA?$a8@pM)jEcR+%*S!^A@AU_j@M^gzPta6Y`T}oXl$e{180%?D_NKC5(#9`|5tX?PGj#?kL*>HW|wz89C-ppNcFF zv&sg@aT~C0t58?#4LHwwgJGXZ)5E6Y{qv1vEDB~Q{5~=9@eDSbx<6AMURtWnGilN! zp73=s$4^h2KK-!CgNKLRd8(?cc>es^!y|83bKvx|$B&QlFh2>HIzd4Fgc}>fn|JBG U?rBFtfxcq!boFyt=akR{0K>CuCIA2c literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redcontrol/textures/block/monitor_right.png b/src/main/resources/assets/redcontrol/textures/block/monitor_right.png new file mode 100644 index 0000000000000000000000000000000000000000..1b960d93eb855af8b8f35adea6b5d5456e7829d8 GIT binary patch literal 267 zcmV+m0rdWfP)Px##Ysd#R5*>TkwFTAP!NW{qHWG1HzMW*qE!)r*KwuCsa2N|65LA{FmY$#3vyel z1QSigf#Lm&Vcy4lv%`M(2Jn2BF}3JB7={tLz9P>b)oa^p=A*vtA~>HejUmr>ahzkn z1prE^DvQW40)SUpj$bg;MsEvgnvo>;%E0#~(^_bAZCPg3zcnpEo9nKs5rknxnq~k5 z!S!!$5ZLybIKH9O6T>h%Gk|58bplOWvfXYdiUN`DoFw-qfry5PR=f7U`~fn1VNA58 R(h~px002ovPDHLkV1f_8ZL|OY literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redcontrol/textures/block/monitor_top.png b/src/main/resources/assets/redcontrol/textures/block/monitor_top.png new file mode 100644 index 0000000000000000000000000000000000000000..f3e98e755e756dc31b4160ae86039fcb51a021b3 GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|ls#P>Lo9le zW407Lt7qe45LTV#&MRS>aD{;-!NlBD^2Qwwh9zfMW~S->eh5^~;OXk;vd$@?2>{Ln B8=e3F literal 0 HcmV?d00001