summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/corechg/sparkt/BlockRegister.java31
-rw-r--r--src/main/java/net/corechg/sparkt/block/DriverMechanical.java9
-rw-r--r--src/main/java/net/corechg/sparkt/block/MachineBlock.java12
-rw-r--r--src/main/java/net/corechg/sparkt/block/MachineFurnace.java9
-rw-r--r--src/main/java/net/corechg/sparkt/block/MachineGrinder.java9
-rw-r--r--src/main/java/net/corechg/sparkt/block/entity/MachineFurnaceEntity.java102
-rw-r--r--src/main/java/net/cshift/sparkt/SparktInit.java (renamed from src/main/java/net/corechg/sparkt/SparktInit.java)7
-rw-r--r--src/main/java/net/cshift/sparkt/block/Blocks.java32
-rw-r--r--src/main/java/net/cshift/sparkt/block/DriverMechanical.java9
-rw-r--r--src/main/java/net/cshift/sparkt/block/MachineBlock.java28
-rw-r--r--src/main/java/net/cshift/sparkt/block/MachineFurnace.java9
-rw-r--r--src/main/java/net/cshift/sparkt/block/MachineGrinder.java9
-rw-r--r--src/main/java/net/cshift/sparkt/block/Wire.java (renamed from src/main/java/net/corechg/sparkt/block/Wire.java)2
-rw-r--r--src/main/java/net/cshift/sparkt/block/entity/BlockEntityTypes.java22
-rw-r--r--src/main/java/net/cshift/sparkt/block/entity/MachineFurnaceEntity.java61
-rw-r--r--src/main/java/net/cshift/sparkt/block/entity/MachineNode.java59
-rw-r--r--src/main/resources/fabric.mod.json14
17 files changed, 242 insertions, 182 deletions
diff --git a/src/main/java/net/corechg/sparkt/BlockRegister.java b/src/main/java/net/corechg/sparkt/BlockRegister.java
deleted file mode 100644
index 5833055..0000000
--- a/src/main/java/net/corechg/sparkt/BlockRegister.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.corechg.sparkt;
-
-import net.minecraft.block.Block;
-import net.minecraft.item.BlockItem;
-import net.minecraft.item.Item;
-import net.minecraft.util.Identifier;
-import net.minecraft.util.registry.Registry;
-import net.corechg.sparkt.block.*;
-
-public class BlockRegister {
-
- public static final Block MACHINE_BLOCK = new MachineBlock();
- public static final Block MACHINE_FURNACE = new MachineFurnace();
- public static final Block DRIVER_MECHANICAL = new DriverMechanical();
- public static final Block MACHINE_GRINDER = new MachineGrinder();
- //public static final Block
-
- public static void register(String modid) {
- Registry.register(Registry.BLOCK, new Identifier(modid, "machine_block"), MACHINE_BLOCK);
- Registry.register(Registry.ITEM, new Identifier(modid, "machine_block"), new BlockItem(MACHINE_BLOCK, new Item.Settings()));
-
- Registry.register(Registry.BLOCK, new Identifier(modid, "machine_furnace"), MACHINE_FURNACE);
- Registry.register(Registry.ITEM, new Identifier(modid, "machine_furnace"), new BlockItem(MACHINE_FURNACE, new Item.Settings()));
-
- Registry.register(Registry.BLOCK, new Identifier(modid, "driver_mechanical"), DRIVER_MECHANICAL);
- Registry.register(Registry.ITEM, new Identifier(modid, "driver_mechanical"), new BlockItem(DRIVER_MECHANICAL, new Item.Settings()));
-
- Registry.register(Registry.BLOCK, new Identifier(modid, "machine_grinder"), MACHINE_GRINDER);
- Registry.register(Registry.ITEM, new Identifier(modid, "machine_grinder"), new BlockItem(MACHINE_GRINDER, new Item.Settings()));
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/block/DriverMechanical.java b/src/main/java/net/corechg/sparkt/block/DriverMechanical.java
deleted file mode 100644
index 3198120..0000000
--- a/src/main/java/net/corechg/sparkt/block/DriverMechanical.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.corechg.sparkt.block;
-
-public class DriverMechanical extends MachineBlock{
-
- public DriverMechanical() {
- super();
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/block/MachineBlock.java b/src/main/java/net/corechg/sparkt/block/MachineBlock.java
deleted file mode 100644
index 7e0c7bb..0000000
--- a/src/main/java/net/corechg/sparkt/block/MachineBlock.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.corechg.sparkt.block;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.Material;
-
-public class MachineBlock extends Block{
-
- public MachineBlock() {
- super(Settings.of(Material.METAL));
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/block/MachineFurnace.java b/src/main/java/net/corechg/sparkt/block/MachineFurnace.java
deleted file mode 100644
index f7556ca..0000000
--- a/src/main/java/net/corechg/sparkt/block/MachineFurnace.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.corechg.sparkt.block;
-
-public class MachineFurnace extends MachineBlock{
-
- public MachineFurnace() {
- super();
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/block/MachineGrinder.java b/src/main/java/net/corechg/sparkt/block/MachineGrinder.java
deleted file mode 100644
index 49c877d..0000000
--- a/src/main/java/net/corechg/sparkt/block/MachineGrinder.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.corechg.sparkt.block;
-
-public class MachineGrinder extends MachineBlock{
-
- public MachineGrinder() {
- super();
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/block/entity/MachineFurnaceEntity.java b/src/main/java/net/corechg/sparkt/block/entity/MachineFurnaceEntity.java
deleted file mode 100644
index edde32b..0000000
--- a/src/main/java/net/corechg/sparkt/block/entity/MachineFurnaceEntity.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package net.corechg.sparkt.block.entity;
-
-import net.minecraft.block.entity.BlockEntity;
-import net.minecraft.block.entity.BlockEntityType;
-import net.minecraft.util.Tickable;
-
-import java.util.ArrayList;
-
-import net.corechg.transit.network.packet.IStaticPacket;
-import net.corechg.transit.network.system.INode;
-import net.corechg.transit.network.system.ISystem;
-import net.corechg.transit.network.system.swap.IAcceptorNode;
-
-public class MachineFurnaceEntity extends BlockEntity implements IAcceptorNode, Tickable {
-
- private static final String[] GROUPS = { "ENERGY" };
- private int energyCap = 20000;
- private int energyStored = 0;
- private ArrayList<INode> connected = new ArrayList<INode>(0);
-
- public MachineFurnaceEntity(BlockEntityType<?> type) {
- super(type);
- }
-
- @Override
- public String[] groupsProvided() {
- return GROUPS;
- }
-
- @Override
- public ISystem getSystem() {
- return null;
- }
-
- @Override
- public Object getData(String groupID) {
- if (groupID == "ENERGY") {
- return energyStored;
- }
- return null;
- }
-
- @Override
- public void setData(Object dat, String groupID) {
- if (groupID == "ENERGY") {
- int tmp = (int) dat;
-
- energyStored = tmp > energyCap ? energyCap : tmp;
- }
-
- }
-
- @Override
- public INode[] getConnections() {
- return (INode[]) connected.toArray();
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public boolean linkProvider(INode requester, String group) {
- if (group == "ENERGY") {
- connected.add(requester);
- }
- return false;
- }
-
- @Override
- public boolean unlinkProvider(INode toUnlink) {
- for(int i = 0; i < connected.size(); i++) {
- if(toUnlink.equals(connected.get(i))) {
- connected.remove(i);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public INode[] getProviders() {
- return getConnections();
- }
-
- @Override
- public <T> boolean accept(IStaticPacket<T> packet, String group) {
- if (group == "ENERGY") {
- int add = (int) packet.getType().toBase(packet, group);
- if(add + energyStored > energyCap) {
- return false;
- }
- else {
- energyStored += add;
- return true;
- }
- }
- return false;
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/SparktInit.java b/src/main/java/net/cshift/sparkt/SparktInit.java
index 2d2d557..0b85404 100644
--- a/src/main/java/net/corechg/sparkt/SparktInit.java
+++ b/src/main/java/net/cshift/sparkt/SparktInit.java
@@ -1,8 +1,10 @@
-package net.corechg.sparkt;
+package net.cshift.sparkt;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import net.cshift.sparkt.block.Blocks;
+import net.cshift.sparkt.block.entity.BlockEntityTypes;
import net.fabricmc.api.ModInitializer;
public class SparktInit implements ModInitializer {
@@ -13,7 +15,8 @@ public class SparktInit implements ModInitializer {
@Override
public void onInitialize() {
LOG.info("Preparing to spark a reaction!");
- BlockRegister.register(MODID);
+ Blocks.register();
+ BlockEntityTypes.register();
}
} \ No newline at end of file
diff --git a/src/main/java/net/cshift/sparkt/block/Blocks.java b/src/main/java/net/cshift/sparkt/block/Blocks.java
new file mode 100644
index 0000000..3aab1e2
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/Blocks.java
@@ -0,0 +1,32 @@
+package net.cshift.sparkt.block;
+
+import net.cshift.sparkt.SparktInit;
+import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
+import net.minecraft.block.Block;
+import net.minecraft.item.BlockItem;
+import net.minecraft.item.Item;
+import net.minecraft.util.Identifier;
+import net.minecraft.registry.*;
+
+public class Blocks {
+
+ public static final Block MACHINE_BLOCK = new MachineBlock(FabricBlockSettings.create().strength(1, 1));
+ public static final Block MACHINE_FURNACE = new MachineFurnace(FabricBlockSettings.create().strength(1, 1));
+ public static final Block DRIVER_MECHANICAL = new DriverMechanical(FabricBlockSettings.create().strength(1, 1));
+ public static final Block MACHINE_GRINDER = new MachineGrinder(FabricBlockSettings.create().strength(1, 1));
+ //public static final Block
+
+ public static void register() {
+ Registry.register(Registries.BLOCK, new Identifier(SparktInit.MODID, "machine_block"), MACHINE_BLOCK);
+ Registry.register(Registries.ITEM, new Identifier(SparktInit.MODID, "machine_block"), new BlockItem(MACHINE_BLOCK, new Item.Settings()));
+
+ Registry.register(Registries.BLOCK, new Identifier(SparktInit.MODID, "machine_furnace"), MACHINE_FURNACE);
+ Registry.register(Registries.ITEM, new Identifier(SparktInit.MODID, "machine_furnace"), new BlockItem(MACHINE_FURNACE, new Item.Settings()));
+
+ Registry.register(Registries.BLOCK, new Identifier(SparktInit.MODID, "driver_mechanical"), DRIVER_MECHANICAL);
+ Registry.register(Registries.ITEM, new Identifier(SparktInit.MODID, "driver_mechanical"), new BlockItem(DRIVER_MECHANICAL, new Item.Settings()));
+
+ Registry.register(Registries.BLOCK, new Identifier(SparktInit.MODID, "machine_grinder"), MACHINE_GRINDER);
+ Registry.register(Registries.ITEM, new Identifier(SparktInit.MODID, "machine_grinder"), new BlockItem(MACHINE_GRINDER, new Item.Settings()));
+ }
+} \ No newline at end of file
diff --git a/src/main/java/net/cshift/sparkt/block/DriverMechanical.java b/src/main/java/net/cshift/sparkt/block/DriverMechanical.java
new file mode 100644
index 0000000..a0f690e
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/DriverMechanical.java
@@ -0,0 +1,9 @@
+package net.cshift.sparkt.block;
+
+public class DriverMechanical extends MachineBlock{
+
+ public DriverMechanical(Settings settings) {
+ super(settings);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/cshift/sparkt/block/MachineBlock.java b/src/main/java/net/cshift/sparkt/block/MachineBlock.java
new file mode 100644
index 0000000..875f295
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/MachineBlock.java
@@ -0,0 +1,28 @@
+package net.cshift.sparkt.block;
+
+import net.cshift.sparkt.block.entity.MachineNode;
+import net.minecraft.block.BlockState;
+import net.minecraft.block.BlockWithEntity;
+import net.minecraft.block.entity.BlockEntity;
+import net.minecraft.entity.LivingEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+public class MachineBlock extends BlockWithEntity {
+
+ public MachineBlock(Settings settings) {
+ super(settings);
+ }
+
+ @Override
+ public BlockEntity createBlockEntity(BlockPos var1, BlockState var2) {
+ return new MachineNode(var1, var2);
+ }
+
+ @Override
+ public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
+ super.onPlaced(world, pos, state, placer, itemStack);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/cshift/sparkt/block/MachineFurnace.java b/src/main/java/net/cshift/sparkt/block/MachineFurnace.java
new file mode 100644
index 0000000..2c815ce
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/MachineFurnace.java
@@ -0,0 +1,9 @@
+package net.cshift.sparkt.block;
+
+public class MachineFurnace extends MachineBlock{
+
+ public MachineFurnace(Settings settings) {
+ super(settings);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/cshift/sparkt/block/MachineGrinder.java b/src/main/java/net/cshift/sparkt/block/MachineGrinder.java
new file mode 100644
index 0000000..890fa7e
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/MachineGrinder.java
@@ -0,0 +1,9 @@
+package net.cshift.sparkt.block;
+
+public class MachineGrinder extends MachineBlock{
+
+ public MachineGrinder(Settings settings) {
+ super(settings);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/corechg/sparkt/block/Wire.java b/src/main/java/net/cshift/sparkt/block/Wire.java
index 51f9178..fa0da3d 100644
--- a/src/main/java/net/corechg/sparkt/block/Wire.java
+++ b/src/main/java/net/cshift/sparkt/block/Wire.java
@@ -1,4 +1,4 @@
-package net.corechg.sparkt.block;
+package net.cshift.sparkt.block;
import net.minecraft.block.Block;
diff --git a/src/main/java/net/cshift/sparkt/block/entity/BlockEntityTypes.java b/src/main/java/net/cshift/sparkt/block/entity/BlockEntityTypes.java
new file mode 100644
index 0000000..f4b1379
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/entity/BlockEntityTypes.java
@@ -0,0 +1,22 @@
+package net.cshift.sparkt.block.entity;
+
+import net.cshift.sparkt.SparktInit;
+import net.cshift.sparkt.block.Blocks;
+import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
+import net.minecraft.block.entity.BlockEntityType;
+import net.minecraft.registry.Registries;
+import net.minecraft.registry.Registry;
+import net.minecraft.util.Identifier;
+
+public class BlockEntityTypes {
+
+ public static BlockEntityType<MachineNode> MACHINE_NODE;
+
+ public static void register() {
+ MACHINE_NODE = Registry.register(
+ Registries.BLOCK_ENTITY_TYPE,
+ new Identifier(SparktInit.MODID, "machine_block_entity"),
+ FabricBlockEntityTypeBuilder.<MachineNode>create(MachineNode::new, Blocks.MACHINE_BLOCK).build()
+ );
+ }
+}
diff --git a/src/main/java/net/cshift/sparkt/block/entity/MachineFurnaceEntity.java b/src/main/java/net/cshift/sparkt/block/entity/MachineFurnaceEntity.java
new file mode 100644
index 0000000..d45938c
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/entity/MachineFurnaceEntity.java
@@ -0,0 +1,61 @@
+package net.cshift.sparkt.block.entity;
+
+import net.minecraft.block.BlockState;
+import net.minecraft.block.entity.BlockEntity;
+import net.minecraft.block.entity.BlockEntityType;
+import net.minecraft.util.math.BlockPos;
+
+import net.cshift.api.transit.network.*;
+import net.cshift.api.transit.network.packet.*;
+
+public class MachineFurnaceEntity extends BlockEntity implements INode {
+
+ public MachineFurnaceEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
+ super(type, pos, state);
+ //TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public IStaticPacket accept(IStaticPacket arg0, Channel<?> arg1) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'accept'");
+ }
+
+ @Override
+ public <T> Channel<T> connect(int arg0, String arg1, INode arg2) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'connect'");
+ }
+
+ @Override
+ public <T> Channel<T> connectDefault(String arg0, INode arg1) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'connectDefault'");
+ }
+
+ @Override
+ public PoolManifest getManifest() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getManifest'");
+ }
+
+ @Override
+ public <T> Number getPressure(Channel<T> arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getPressure'");
+ }
+
+ @Override
+ public <T> Number getRate(Channel<T> arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getRate'");
+ }
+
+ @Override
+ public <T> void onTerminate(Channel<T> arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'onTerminate'");
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/net/cshift/sparkt/block/entity/MachineNode.java b/src/main/java/net/cshift/sparkt/block/entity/MachineNode.java
new file mode 100644
index 0000000..111d8cc
--- /dev/null
+++ b/src/main/java/net/cshift/sparkt/block/entity/MachineNode.java
@@ -0,0 +1,59 @@
+package net.cshift.sparkt.block.entity;
+
+import net.cshift.api.transit.network.*;
+import net.cshift.api.transit.network.packet.IStaticPacket;
+import net.minecraft.block.BlockState;
+import net.minecraft.block.entity.BlockEntity;
+import net.minecraft.util.math.BlockPos;
+
+public class MachineNode extends BlockEntity implements INode {
+
+ public MachineNode(BlockPos pos, BlockState state) {
+ super(BlockEntityTypes.MACHINE_NODE, pos, state);
+ }
+
+ @Override
+ public IStaticPacket accept(IStaticPacket arg0, Channel<?> arg1) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'accept'");
+ }
+
+ @Override
+ public <T> Channel<T> connect(int arg0, String arg1, INode arg2) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'connect'");
+ }
+
+ @Override
+ public <T> Channel<T> connectDefault(String arg0, INode arg1) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'connectDefault'");
+ }
+
+ @Override
+ public PoolManifest getManifest() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getManifest'");
+ }
+
+ @Override
+ public <T> Number getPressure(Channel<T> arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getPressure'");
+ }
+
+ @Override
+ public <T> Number getRate(Channel<T> arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getRate'");
+ }
+
+ @Override
+ public <T> void onTerminate(Channel<T> arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'onTerminate'");
+ }
+
+
+
+}
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 898a95f..69935ee 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -1,15 +1,15 @@
{
"schemaVersion": 1,
"id": "sparkt",
- "version": "0.0.1",
+ "version": "0.0.2",
"name": "Sparkt",
"description": "Wires and whatnot!",
"authors": [
- "CCGKyle"
+ "CSKyle"
],
"contact": {
- "sources": "https://github.com/CoreChg/Sparkt"
+ "sources": "https://git.cshift.net/CircleShift/Sparkt"
},
"license": "MIT",
@@ -18,15 +18,15 @@
"environment": "*",
"entrypoints": {
"main": [
- "net.corechg.sparkt.SparktInit"
+ "net.cshift.sparkt.SparktInit"
]
},
"depends": {
- "fabricloader": ">=0.7.4",
+ "fabricloader": ">=0.8.0",
"fabric": "*",
- "minecraft": "1.15.x",
+ "minecraft": "1.20.x",
- "transit-api": ">=0.10.2"
+ "transit-api": "=3.0.0-alpha-2"
}
}