From f6ecfac78b963a694a13891df06413df104b19fb Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 17 Nov 2023 01:20:36 -0500 Subject: Update for 1.20 --- src/main/java/net/cshift/sparkt/SparktInit.java | 22 ++++++++ src/main/java/net/cshift/sparkt/block/Blocks.java | 32 ++++++++++++ .../net/cshift/sparkt/block/DriverMechanical.java | 9 ++++ .../java/net/cshift/sparkt/block/MachineBlock.java | 28 ++++++++++ .../net/cshift/sparkt/block/MachineFurnace.java | 9 ++++ .../net/cshift/sparkt/block/MachineGrinder.java | 9 ++++ src/main/java/net/cshift/sparkt/block/Wire.java | 11 ++++ .../sparkt/block/entity/BlockEntityTypes.java | 22 ++++++++ .../sparkt/block/entity/MachineFurnaceEntity.java | 61 ++++++++++++++++++++++ .../cshift/sparkt/block/entity/MachineNode.java | 59 +++++++++++++++++++++ 10 files changed, 262 insertions(+) create mode 100644 src/main/java/net/cshift/sparkt/SparktInit.java create mode 100644 src/main/java/net/cshift/sparkt/block/Blocks.java create mode 100644 src/main/java/net/cshift/sparkt/block/DriverMechanical.java create mode 100644 src/main/java/net/cshift/sparkt/block/MachineBlock.java create mode 100644 src/main/java/net/cshift/sparkt/block/MachineFurnace.java create mode 100644 src/main/java/net/cshift/sparkt/block/MachineGrinder.java create mode 100644 src/main/java/net/cshift/sparkt/block/Wire.java create mode 100644 src/main/java/net/cshift/sparkt/block/entity/BlockEntityTypes.java create mode 100644 src/main/java/net/cshift/sparkt/block/entity/MachineFurnaceEntity.java create mode 100644 src/main/java/net/cshift/sparkt/block/entity/MachineNode.java (limited to 'src/main/java/net/cshift') diff --git a/src/main/java/net/cshift/sparkt/SparktInit.java b/src/main/java/net/cshift/sparkt/SparktInit.java new file mode 100644 index 0000000..0b85404 --- /dev/null +++ b/src/main/java/net/cshift/sparkt/SparktInit.java @@ -0,0 +1,22 @@ +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 { + + 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!"); + 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/cshift/sparkt/block/Wire.java b/src/main/java/net/cshift/sparkt/block/Wire.java new file mode 100644 index 0000000..fa0da3d --- /dev/null +++ b/src/main/java/net/cshift/sparkt/block/Wire.java @@ -0,0 +1,11 @@ +package net.cshift.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/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 MACHINE_NODE; + + public static void register() { + MACHINE_NODE = Registry.register( + Registries.BLOCK_ENTITY_TYPE, + new Identifier(SparktInit.MODID, "machine_block_entity"), + FabricBlockEntityTypeBuilder.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 Channel connect(int arg0, String arg1, INode arg2) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'connect'"); + } + + @Override + public Channel 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 Number getPressure(Channel arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getPressure'"); + } + + @Override + public Number getRate(Channel arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getRate'"); + } + + @Override + public void onTerminate(Channel 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 Channel connect(int arg0, String arg1, INode arg2) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'connect'"); + } + + @Override + public Channel 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 Number getPressure(Channel arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getPressure'"); + } + + @Override + public Number getRate(Channel arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getRate'"); + } + + @Override + public void onTerminate(Channel arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'onTerminate'"); + } + + + +} -- cgit v1.2.3