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/SparktInit.java19
-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/Wire.java11
-rw-r--r--src/main/java/net/corechg/sparkt/block/entity/MachineFurnaceEntity.java102
-rw-r--r--src/main/resources/assets/sparkt/blockstates/driver_mechanical.json5
-rw-r--r--src/main/resources/assets/sparkt/blockstates/machine_block.json5
-rw-r--r--src/main/resources/assets/sparkt/blockstates/machine_furnace.json5
-rw-r--r--src/main/resources/assets/sparkt/blockstates/machine_grinder.json5
-rw-r--r--src/main/resources/assets/sparkt/icon.pngbin0 -> 115794 bytes
-rw-r--r--src/main/resources/assets/sparkt/lang/en_us.json8
-rw-r--r--src/main/resources/assets/sparkt/models/block/driver_mechanical.json9
-rw-r--r--src/main/resources/assets/sparkt/models/block/machine.json9
-rw-r--r--src/main/resources/assets/sparkt/models/block/machine_block.json6
-rw-r--r--src/main/resources/assets/sparkt/models/block/machine_furnace.json6
-rw-r--r--src/main/resources/assets/sparkt/models/block/machine_grinder.json6
-rw-r--r--src/main/resources/assets/sparkt/models/item/driver_mechanical.json3
-rw-r--r--src/main/resources/assets/sparkt/models/item/machine_block.json3
-rw-r--r--src/main/resources/assets/sparkt/models/item/machine_furnace.json3
-rw-r--r--src/main/resources/assets/sparkt/models/item/machine_grinder.json3
-rw-r--r--src/main/resources/assets/sparkt/textures/block/driver_side.pngbin0 -> 356 bytes
-rw-r--r--src/main/resources/assets/sparkt/textures/block/driver_top.pngbin0 -> 247 bytes
-rw-r--r--src/main/resources/assets/sparkt/textures/block/furnace_side.pngbin0 -> 272 bytes
-rw-r--r--src/main/resources/assets/sparkt/textures/block/grinder_side.pngbin0 -> 283 bytes
-rw-r--r--src/main/resources/assets/sparkt/textures/block/machine_bottom.pngbin0 -> 196 bytes
-rw-r--r--src/main/resources/assets/sparkt/textures/block/machine_side.pngbin0 -> 207 bytes
-rw-r--r--src/main/resources/assets/sparkt/textures/block/machine_top.pngbin0 -> 196 bytes
-rw-r--r--src/main/resources/data/sparkt/loot_tables/block/machine_block.json19
-rw-r--r--src/main/resources/fabric.mod.json32
32 files changed, 329 insertions, 0 deletions
diff --git a/src/main/java/net/corechg/sparkt/BlockRegister.java b/src/main/java/net/corechg/sparkt/BlockRegister.java
new file mode 100644
index 0000000..5833055
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/BlockRegister.java
@@ -0,0 +1,31 @@
+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/SparktInit.java b/src/main/java/net/corechg/sparkt/SparktInit.java
new file mode 100644
index 0000000..2d2d557
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/SparktInit.java
@@ -0,0 +1,19 @@
+package net.corechg.sparkt;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import net.fabricmc.api.ModInitializer;
+
+public class SparktInit implements ModInitializer {
+
+ public static final Logger LOG = LogManager.getFormatterLogger("Sparkt|Init");
+ public static final String MODID = "sparkt";
+
+ @Override
+ public void onInitialize() {
+ LOG.info("Preparing to spark a reaction!");
+ BlockRegister.register(MODID);
+ }
+
+} \ 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
new file mode 100644
index 0000000..3198120
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/block/DriverMechanical.java
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 0000000..7e0c7bb
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/block/MachineBlock.java
@@ -0,0 +1,12 @@
+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
new file mode 100644
index 0000000..f7556ca
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/block/MachineFurnace.java
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 0000000..49c877d
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/block/MachineGrinder.java
@@ -0,0 +1,9 @@
+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/Wire.java b/src/main/java/net/corechg/sparkt/block/Wire.java
new file mode 100644
index 0000000..51f9178
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/block/Wire.java
@@ -0,0 +1,11 @@
+package net.corechg.sparkt.block;
+
+import net.minecraft.block.Block;
+
+public class Wire extends Block{
+
+ public Wire(Settings settings) {
+ super(settings);
+ }
+
+} \ 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
new file mode 100644
index 0000000..edde32b
--- /dev/null
+++ b/src/main/java/net/corechg/sparkt/block/entity/MachineFurnaceEntity.java
@@ -0,0 +1,102 @@
+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/resources/assets/sparkt/blockstates/driver_mechanical.json b/src/main/resources/assets/sparkt/blockstates/driver_mechanical.json
new file mode 100644
index 0000000..f01b009
--- /dev/null
+++ b/src/main/resources/assets/sparkt/blockstates/driver_mechanical.json
@@ -0,0 +1,5 @@
+{
+ "variants": {
+ "": { "model": "sparkt:block/driver_mechanical" }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/blockstates/machine_block.json b/src/main/resources/assets/sparkt/blockstates/machine_block.json
new file mode 100644
index 0000000..c58ab84
--- /dev/null
+++ b/src/main/resources/assets/sparkt/blockstates/machine_block.json
@@ -0,0 +1,5 @@
+{
+ "variants": {
+ "": { "model": "sparkt:block/machine_block" }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/blockstates/machine_furnace.json b/src/main/resources/assets/sparkt/blockstates/machine_furnace.json
new file mode 100644
index 0000000..2c115f2
--- /dev/null
+++ b/src/main/resources/assets/sparkt/blockstates/machine_furnace.json
@@ -0,0 +1,5 @@
+{
+ "variants": {
+ "": { "model": "sparkt:block/machine_furnace" }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/blockstates/machine_grinder.json b/src/main/resources/assets/sparkt/blockstates/machine_grinder.json
new file mode 100644
index 0000000..5e233bf
--- /dev/null
+++ b/src/main/resources/assets/sparkt/blockstates/machine_grinder.json
@@ -0,0 +1,5 @@
+{
+ "variants": {
+ "": { "model": "sparkt:block/machine_grinder" }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/icon.png b/src/main/resources/assets/sparkt/icon.png
new file mode 100644
index 0000000..b8bb552
--- /dev/null
+++ b/src/main/resources/assets/sparkt/icon.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/lang/en_us.json b/src/main/resources/assets/sparkt/lang/en_us.json
new file mode 100644
index 0000000..28005eb
--- /dev/null
+++ b/src/main/resources/assets/sparkt/lang/en_us.json
@@ -0,0 +1,8 @@
+{
+ "block.sparkt.machine_block": "Machine Block",
+ "block.sparkt.machine_furnace": "Electric Furnace",
+ "block.sparkt.wire": "Wire",
+ "block.sparkt.machine_grinder": "Electric Crusher",
+ "block.sparkt.driver_mechanical": "Mechanical Driver",
+ "block.sparkt.driver_thermal": "Thermal Driver"
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/block/driver_mechanical.json b/src/main/resources/assets/sparkt/models/block/driver_mechanical.json
new file mode 100644
index 0000000..f3bdf7b
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/block/driver_mechanical.json
@@ -0,0 +1,9 @@
+{
+ "parent": "block/orientable_with_bottom",
+ "textures": {
+ "top": "sparkt:block/driver_top",
+ "side": "sparkt:block/driver_side",
+ "front": "sparkt:block/driver_side",
+ "bottom": "sparkt:block/machine_bottom"
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/block/machine.json b/src/main/resources/assets/sparkt/models/block/machine.json
new file mode 100644
index 0000000..27cab61
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/block/machine.json
@@ -0,0 +1,9 @@
+{
+ "parent": "block/orientable_with_bottom",
+ "textures": {
+ "top": "sparkt:block/machine_top",
+ "side": "sparkt:block/machine_side",
+ "front": "#front",
+ "bottom": "sparkt:block/machine_bottom"
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/block/machine_block.json b/src/main/resources/assets/sparkt/models/block/machine_block.json
new file mode 100644
index 0000000..679b548
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/block/machine_block.json
@@ -0,0 +1,6 @@
+{
+ "parent": "sparkt:block/machine",
+ "textures": {
+ "front": "sparkt:block/machine_side"
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/block/machine_furnace.json b/src/main/resources/assets/sparkt/models/block/machine_furnace.json
new file mode 100644
index 0000000..e35099f
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/block/machine_furnace.json
@@ -0,0 +1,6 @@
+{
+ "parent": "sparkt:block/machine",
+ "textures": {
+ "front": "sparkt:block/furnace_side"
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/block/machine_grinder.json b/src/main/resources/assets/sparkt/models/block/machine_grinder.json
new file mode 100644
index 0000000..de72365
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/block/machine_grinder.json
@@ -0,0 +1,6 @@
+{
+ "parent": "sparkt:block/machine",
+ "textures": {
+ "front": "sparkt:block/grinder_side"
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/item/driver_mechanical.json b/src/main/resources/assets/sparkt/models/item/driver_mechanical.json
new file mode 100644
index 0000000..19ecb75
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/item/driver_mechanical.json
@@ -0,0 +1,3 @@
+{
+ "parent": "sparkt:block/driver_mechanical"
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/item/machine_block.json b/src/main/resources/assets/sparkt/models/item/machine_block.json
new file mode 100644
index 0000000..a405f71
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/item/machine_block.json
@@ -0,0 +1,3 @@
+{
+ "parent": "sparkt:block/machine_block"
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/item/machine_furnace.json b/src/main/resources/assets/sparkt/models/item/machine_furnace.json
new file mode 100644
index 0000000..ed00d41
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/item/machine_furnace.json
@@ -0,0 +1,3 @@
+{
+ "parent": "sparkt:block/machine_furnace"
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/models/item/machine_grinder.json b/src/main/resources/assets/sparkt/models/item/machine_grinder.json
new file mode 100644
index 0000000..16fa3e9
--- /dev/null
+++ b/src/main/resources/assets/sparkt/models/item/machine_grinder.json
@@ -0,0 +1,3 @@
+{
+ "parent": "sparkt:block/machine_grinder"
+} \ No newline at end of file
diff --git a/src/main/resources/assets/sparkt/textures/block/driver_side.png b/src/main/resources/assets/sparkt/textures/block/driver_side.png
new file mode 100644
index 0000000..51d0c2c
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/driver_side.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/textures/block/driver_top.png b/src/main/resources/assets/sparkt/textures/block/driver_top.png
new file mode 100644
index 0000000..2e85d33
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/driver_top.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/textures/block/furnace_side.png b/src/main/resources/assets/sparkt/textures/block/furnace_side.png
new file mode 100644
index 0000000..e7ba9c2
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/furnace_side.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/textures/block/grinder_side.png b/src/main/resources/assets/sparkt/textures/block/grinder_side.png
new file mode 100644
index 0000000..1f384f8
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/grinder_side.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/textures/block/machine_bottom.png b/src/main/resources/assets/sparkt/textures/block/machine_bottom.png
new file mode 100644
index 0000000..48d3f40
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/machine_bottom.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/textures/block/machine_side.png b/src/main/resources/assets/sparkt/textures/block/machine_side.png
new file mode 100644
index 0000000..6e1fb14
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/machine_side.png
Binary files differ
diff --git a/src/main/resources/assets/sparkt/textures/block/machine_top.png b/src/main/resources/assets/sparkt/textures/block/machine_top.png
new file mode 100644
index 0000000..7d4463f
--- /dev/null
+++ b/src/main/resources/assets/sparkt/textures/block/machine_top.png
Binary files differ
diff --git a/src/main/resources/data/sparkt/loot_tables/block/machine_block.json b/src/main/resources/data/sparkt/loot_tables/block/machine_block.json
new file mode 100644
index 0000000..5c6db56
--- /dev/null
+++ b/src/main/resources/data/sparkt/loot_tables/block/machine_block.json
@@ -0,0 +1,19 @@
+{
+ "type": "minecraft:block",
+ "pools": [
+ {
+ "rolls": 1,
+ "entries": [
+ {
+ "type": "minecraft:item",
+ "name": "sparkt:machine_block"
+ }
+ ],
+ "conditions": [
+ {
+ "condition": "minecraft:survives_explosion"
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
new file mode 100644
index 0000000..898a95f
--- /dev/null
+++ b/src/main/resources/fabric.mod.json
@@ -0,0 +1,32 @@
+{
+ "schemaVersion": 1,
+ "id": "sparkt",
+ "version": "0.0.1",
+
+ "name": "Sparkt",
+ "description": "Wires and whatnot!",
+ "authors": [
+ "CCGKyle"
+ ],
+ "contact": {
+ "sources": "https://github.com/CoreChg/Sparkt"
+ },
+
+ "license": "MIT",
+ "icon": "assets/sparkt/icon.png",
+
+ "environment": "*",
+ "entrypoints": {
+ "main": [
+ "net.corechg.sparkt.SparktInit"
+ ]
+ },
+
+ "depends": {
+ "fabricloader": ">=0.7.4",
+ "fabric": "*",
+ "minecraft": "1.15.x",
+
+ "transit-api": ">=0.10.2"
+ }
+}