From 15dffed318932b0a8d0260d96b2a1e8921d8db2c Mon Sep 17 00:00:00 2001 From: rearth Date: Mon, 29 Jan 2024 00:16:57 +0100 Subject: [PATCH] More work on multiblocks --- .../19c08d24c255c2719fbb8ac01f9dff290b763461 | 5 +- .../oritech/blockstates/assembler_block.json | 7 ++ .../oritech/models/block/assembler_block.json | 6 + .../oritech/models/item/assembler_block.json | 3 + .../block/base/MachineBlockEntity.java | 75 +----------- .../oritech/block/base/MultiblockMachine.java | 54 +++++++++ .../block/base/MultiblockMachineEntity.java | 107 ++++++++++++++++++ .../oritech/block/custom/AssemblerBlock.java | 20 ++++ .../block/custom/MachineCoreBlock.java | 31 ++++- .../block/entity/AssemblerBlockEntity.java | 59 ++++++++++ .../oritech/client/init/ModRenderers.java | 1 + .../oritech/client/init/ModScreens.java | 2 + .../rearth/oritech/init/BlockContent.java | 2 + .../oritech/init/BlockEntitiesContent.java | 4 + .../oritech/init/datagen/ModelGenerator.java | 1 + .../oritech/init/recipes/RecipeContent.java | 1 + .../textures/block/assembler_block.png | Bin 0 -> 917 bytes .../recipes/coal_to_emerald_assembler.json | 18 +++ 18 files changed, 319 insertions(+), 77 deletions(-) create mode 100644 src/main/generated/assets/oritech/blockstates/assembler_block.json create mode 100644 src/main/generated/assets/oritech/models/block/assembler_block.json create mode 100644 src/main/generated/assets/oritech/models/item/assembler_block.json create mode 100644 src/main/java/rearth/oritech/block/base/MultiblockMachine.java create mode 100644 src/main/java/rearth/oritech/block/base/MultiblockMachineEntity.java create mode 100644 src/main/java/rearth/oritech/block/custom/AssemblerBlock.java create mode 100644 src/main/java/rearth/oritech/block/entity/AssemblerBlockEntity.java create mode 100644 src/main/resources/assets/oritech/textures/block/assembler_block.png create mode 100644 src/main/resources/data/oritech/recipes/coal_to_emerald_assembler.json diff --git a/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 b/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 index 417295b23..c80135292 100644 --- a/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 +++ b/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 @@ -1,11 +1,14 @@ -// 1.20.4 2024-01-28T18:29:04.8090958 Oritech/Model Definitions +// 1.20.4 2024-01-28T23:15:58.7343725 Oritech/Model Definitions a5a8d2e834fc121777ed1a4c0df99e85a6f23613 assets\oritech\models\block\machine_core.json 3d6f377b938592ac22aca17bd64561a6579ad217 assets\oritech\blockstates\grinder_block.json +f29468ff950a191567ab35557334666099ccd7cc assets\oritech\blockstates\assembler_block.json 964457f56e25b66dfef2160c8618bcaba2b640aa assets\oritech\blockstates\pulverizer_block.json 5462a2453fcdd2f8b99129894aec60f282d29ca9 assets\oritech\models\item\pulverizer_block.json eafe84c787830ab2a866e0878e9ed718d58659f5 assets\oritech\blockstates\banana_block.json 25864df3cd7786f2bf4fe6fa9855b3cf366c28ca assets\oritech\models\item\banana.json +339d54da2345c657c8ecff8e8dbda1734fd88d8d assets\oritech\models\block\assembler_block.json 469ea8a66c529fe26bc029c21092e7f062ed0e40 assets\oritech\models\block\banana_block.json +d35ecef5df9198b12dc04267780c727c144b1959 assets\oritech\models\item\assembler_block.json 3bd3ce424e506dbbd4a45a0081e0f04b914abb27 assets\oritech\models\item\machine_core.json c48da59250e22665d33524132de2dfd27f0c574f assets\oritech\models\block\grinder_block.json 746b98d721e5ae0d96dd769e71b786afa8c2d142 assets\oritech\models\item\banana_block.json diff --git a/src/main/generated/assets/oritech/blockstates/assembler_block.json b/src/main/generated/assets/oritech/blockstates/assembler_block.json new file mode 100644 index 000000000..bb800b537 --- /dev/null +++ b/src/main/generated/assets/oritech/blockstates/assembler_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "oritech:block/assembler_block" + } + } +} \ No newline at end of file diff --git a/src/main/generated/assets/oritech/models/block/assembler_block.json b/src/main/generated/assets/oritech/models/block/assembler_block.json new file mode 100644 index 000000000..d01e37fa5 --- /dev/null +++ b/src/main/generated/assets/oritech/models/block/assembler_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "oritech:block/assembler_block" + } +} \ No newline at end of file diff --git a/src/main/generated/assets/oritech/models/item/assembler_block.json b/src/main/generated/assets/oritech/models/item/assembler_block.json new file mode 100644 index 000000000..44eee47b5 --- /dev/null +++ b/src/main/generated/assets/oritech/models/item/assembler_block.json @@ -0,0 +1,3 @@ +{ + "parent": "oritech:block/assembler_block" +} \ No newline at end of file diff --git a/src/main/java/rearth/oritech/block/base/MachineBlockEntity.java b/src/main/java/rearth/oritech/block/base/MachineBlockEntity.java index 0872798b3..7021cc2d3 100644 --- a/src/main/java/rearth/oritech/block/base/MachineBlockEntity.java +++ b/src/main/java/rearth/oritech/block/base/MachineBlockEntity.java @@ -403,10 +403,9 @@ public AnimatableInstanceCache getAnimatableInstanceCache() { public void writeScreenOpeningData(ServerPlayerEntity player, PacketByteBuf buf) { buf.writeBlockPos(this.getPos()); sendNetworkEntry(); - initMultiblock(); } - private Direction getFacing() { + protected Direction getFacing() { return Objects.requireNonNull(world).getBlockState(getPos()).get(Properties.HORIZONTAL_FACING); } @@ -477,76 +476,4 @@ public InventoryInputMode getInventoryInputMode() { public abstract int getInventorySize(); - // positive x = forward - // positive y = up - // positive z = right? - public List getCorePositions() { - return List.of( - new Vec3i(1, 0,0), - new Vec3i(2, 0,0), - new Vec3i(0, 1, 0) - ); - } - - private boolean assembled = false; - - public void initMultiblock() { - - // check if multiblock is already created, if so cancel - // call method the get a list of relative positions - // check all positions if the blocks there extend MachineCoreBlock - // if so, add them to list of used blocks - // if not (e.g. block wrong type or air), draw a small particle to indicate the missing position - // when all blocks are valid, multiblock is active - // update all multiblocks state to USED=true, write controller position to block state - - if (assembled) return; - - var ownFacing = getFacing(); - - var targetPositions = getCorePositions(); - var coreBlocks = new ArrayList(targetPositions.size()); - - for (var targetPosition : targetPositions) { - var rotatedPos = rotatePosition(targetPosition, ownFacing); //todo - var checkPos = pos.add(rotatedPos); - var checkState = Objects.requireNonNull(world).getBlockState(checkPos); - - var blockType = checkState.getBlock(); - if (blockType instanceof MachineCoreBlock coreBlock) { - coreBlocks.add(new MultiBlockElement(checkState, coreBlock, checkPos)); - } else { - highlightBlock(checkPos); - } - } - - if (targetPositions.size() == coreBlocks.size()) { - // valid - assembled = true; - for (var core : coreBlocks) { - world.setBlockState(core.pos, core.state.with(MachineCoreBlock.USED, true)); - System.out.println("multiblock valid"); - } - } else { - // invalid - System.out.println("multiblock invalid"); - } - - } - - private void highlightBlock(BlockPos block) { - ParticleContent.HIGHLIGHT_BLOCK.spawn(world, Vec3d.of(block), null); - } - - private Vec3i rotatePosition(Vec3i relativePos, Direction facing) { - return switch (facing) { - case NORTH -> new BlockPos(relativePos.getZ(), relativePos.getY(), relativePos.getX()); - case EAST -> new BlockPos(-relativePos.getX(), relativePos.getY(), -relativePos.getZ()); - case SOUTH -> new BlockPos(-relativePos.getZ(), relativePos.getY(), -relativePos.getX()); - case WEST -> new BlockPos(relativePos.getX(), relativePos.getY(), relativePos.getZ()); - default -> relativePos; - }; - } - - private static record MultiBlockElement(BlockState state, MachineCoreBlock coreBlock, BlockPos pos) {} } diff --git a/src/main/java/rearth/oritech/block/base/MultiblockMachine.java b/src/main/java/rearth/oritech/block/base/MultiblockMachine.java new file mode 100644 index 000000000..1d903335d --- /dev/null +++ b/src/main/java/rearth/oritech/block/base/MultiblockMachine.java @@ -0,0 +1,54 @@ +package rearth.oritech.block.base; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.IntProperty; +import net.minecraft.state.property.Properties; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; + +public abstract class MultiblockMachine extends MachineBlock { + + public static final BooleanProperty ASSEMBLED = BooleanProperty.of("machine_assembled"); + + public MultiblockMachine(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(ASSEMBLED, false)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder); + builder.add(ASSEMBLED); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + + if (!world.isClient) { + + var entity = world.getBlockEntity(pos); + if (!(entity instanceof MultiblockMachineEntity machineEntity)) { + return ActionResult.FAIL; + } + + var isAssembled = machineEntity.initMultiblock(state); + + if (!isAssembled) { + player.sendMessage(Text.literal("Machine is not assembled")); + return ActionResult.FAIL; + } + + } + + return super.onUse(state, world, pos, player, hand, hit); + } +} diff --git a/src/main/java/rearth/oritech/block/base/MultiblockMachineEntity.java b/src/main/java/rearth/oritech/block/base/MultiblockMachineEntity.java new file mode 100644 index 000000000..3a047901b --- /dev/null +++ b/src/main/java/rearth/oritech/block/base/MultiblockMachineEntity.java @@ -0,0 +1,107 @@ +package rearth.oritech.block.base; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; +import rearth.oritech.block.custom.MachineCoreBlock; +import rearth.oritech.client.init.ParticleContent; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public abstract class MultiblockMachineEntity extends MachineBlockEntity { + + public MultiblockMachineEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + + // positive x = forward + // positive y = up + // positive z = right? + public abstract List getCorePositions(); + + public boolean initMultiblock(BlockState state) { + + // check if multiblock is already created, if so cancel + // call method the get a list of relative positions + // check all positions if the blocks there extend MachineCoreBlock + // if so, add them to list of used blocks + // if not (e.g. block wrong type or air), draw a small particle to indicate the missing position + // when all blocks are valid, multiblock is active + // update all multiblocks state to USED=true, write controller position to block state + + if (state.get(MultiblockMachine.ASSEMBLED)) return true; + + var ownFacing = getFacing(); + + var targetPositions = getCorePositions(); + var coreBlocks = new ArrayList(targetPositions.size()); + + for (var targetPosition : targetPositions) { + var rotatedPos = rotatePosition(targetPosition, ownFacing); + var checkPos = pos.add(rotatedPos); + var checkState = Objects.requireNonNull(world).getBlockState(checkPos); + + var blockType = checkState.getBlock(); + if (blockType instanceof MachineCoreBlock coreBlock) { + coreBlocks.add(new MultiBlockElement(checkState, coreBlock, checkPos)); + } else { + highlightBlock(checkPos); + } + } + + if (targetPositions.size() == coreBlocks.size()) { + // valid + for (var core : coreBlocks) { + var offset = pos.subtract(core.pos); + var newState = core.state + .with(MachineCoreBlock.USED, true) + .with(MachineCoreBlock.CONTROLLER_X, offset.getX() + 4) + .with(MachineCoreBlock.CONTROLLER_Y, offset.getY() + 4) + .with(MachineCoreBlock.CONTROLLER_Z, offset.getZ() + 4); + world.setBlockState(core.pos, newState); + } + + Objects.requireNonNull(world).setBlockState(pos, state.with(MultiblockMachine.ASSEMBLED, true)); + System.out.println("multiblock valid"); + return true; + } else { + // invalid + System.out.println("multiblock invalid"); + return false; + } + + } + + public void onCoreBroken(BlockPos corePos, BlockState coreState) { + + System.out.println("registering broken core!"); + + // set assembled to false + // go through all existing cores + // set used to false + + } + + private void highlightBlock(BlockPos block) { + ParticleContent.HIGHLIGHT_BLOCK.spawn(world, Vec3d.of(block), null); + } + + private Vec3i rotatePosition(Vec3i relativePos, Direction facing) { + return switch (facing) { + case NORTH -> new BlockPos(relativePos.getZ(), relativePos.getY(), relativePos.getX()); + case EAST -> new BlockPos(-relativePos.getX(), relativePos.getY(), -relativePos.getZ()); + case SOUTH -> new BlockPos(-relativePos.getZ(), relativePos.getY(), -relativePos.getX()); + case WEST -> new BlockPos(relativePos.getX(), relativePos.getY(), relativePos.getZ()); + default -> relativePos; + }; + } + + private record MultiBlockElement(BlockState state, MachineCoreBlock coreBlock, BlockPos pos) { + } +} diff --git a/src/main/java/rearth/oritech/block/custom/AssemblerBlock.java b/src/main/java/rearth/oritech/block/custom/AssemblerBlock.java new file mode 100644 index 000000000..f94555db8 --- /dev/null +++ b/src/main/java/rearth/oritech/block/custom/AssemblerBlock.java @@ -0,0 +1,20 @@ +package rearth.oritech.block.custom; + +import net.minecraft.block.BlockEntityProvider; +import net.minecraft.block.entity.BlockEntity; +import org.jetbrains.annotations.NotNull; +import rearth.oritech.block.base.MachineBlock; +import rearth.oritech.block.base.MultiblockMachine; +import rearth.oritech.block.entity.AssemblerBlockEntity; + +public class AssemblerBlock extends MultiblockMachine implements BlockEntityProvider { + + public AssemblerBlock(Settings settings) { + super(settings); + } + + @Override + public @NotNull Class getBlockEntityType() { + return AssemblerBlockEntity.class; + } +} diff --git a/src/main/java/rearth/oritech/block/custom/MachineCoreBlock.java b/src/main/java/rearth/oritech/block/custom/MachineCoreBlock.java index aca75db1b..77a488fc6 100644 --- a/src/main/java/rearth/oritech/block/custom/MachineCoreBlock.java +++ b/src/main/java/rearth/oritech/block/custom/MachineCoreBlock.java @@ -6,24 +6,35 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.IntProperty; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; +import rearth.oritech.block.base.MultiblockMachineEntity; public class MachineCoreBlock extends Block { public static final BooleanProperty USED = BooleanProperty.of("core_used"); + public static final IntProperty CONTROLLER_X = IntProperty.of("linked_x", 0, 7); + public static final IntProperty CONTROLLER_Y = IntProperty.of("linked_y", 0, 7); + public static final IntProperty CONTROLLER_Z = IntProperty.of("linked_z", 0, 7); public MachineCoreBlock(Settings settings) { super(settings); - this.setDefaultState(getDefaultState().with(USED, false)); + this.setDefaultState(getDefaultState() + .with(USED, false) + .with(CONTROLLER_X, 1) + .with(CONTROLLER_Y, 1) + .with(CONTROLLER_Z, 1) + ); } @Override protected void appendProperties(StateManager.Builder builder) { - builder.add(USED); + builder.add(USED, CONTROLLER_X, CONTROLLER_Y, CONTROLLER_Z); } @Override @@ -40,4 +51,20 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt return ActionResult.SUCCESS; } + + @Override + public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + + if (state.get(USED)) { + var offset = new Vec3i(state.get(CONTROLLER_X) - 4, state.get(CONTROLLER_Y) - 4, state.get(CONTROLLER_Z) - 4); + var controllerPos = pos.add(offset); + System.out.println("notifying machine controller that core has been removed"); + var controllerEntity = world.getBlockEntity(controllerPos); + if (controllerEntity instanceof MultiblockMachineEntity machineEntity) { + machineEntity.onCoreBroken(pos, state); + } + } + + return super.onBreak(world, pos, state, player); + } } diff --git a/src/main/java/rearth/oritech/block/entity/AssemblerBlockEntity.java b/src/main/java/rearth/oritech/block/entity/AssemblerBlockEntity.java new file mode 100644 index 000000000..9d233f214 --- /dev/null +++ b/src/main/java/rearth/oritech/block/entity/AssemblerBlockEntity.java @@ -0,0 +1,59 @@ +package rearth.oritech.block.entity; + +import net.minecraft.block.BlockState; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; +import rearth.oritech.block.base.MachineBlockEntity; +import rearth.oritech.block.base.MultiblockMachineEntity; +import rearth.oritech.client.init.ModScreens; +import rearth.oritech.init.BlockEntitiesContent; +import rearth.oritech.init.recipes.OritechRecipe; +import rearth.oritech.init.recipes.RecipeContent; +import rearth.oritech.util.InventorySlotAssignment; + +import java.util.List; + +public class AssemblerBlockEntity extends MultiblockMachineEntity { + + public AssemblerBlockEntity(BlockPos pos, BlockState state) { + super(BlockEntitiesContent.ASSEMBLER_ENTITY, pos, state); + } + + @Override + protected OritechRecipe.OritechRecipeType getOwnRecipeType() { + return RecipeContent.ASSEMBLER; + } + + @Override + public InventorySlotAssignment getSlots() { + return new InventorySlotAssignment(0, 2, 2, 1); + } + + @Override + public List getGuiSlots() { + return List.of( + new GuiSlot(0, 70, 11), + new GuiSlot(1, 90, 11), + new GuiSlot(2, 80, 59)); + } + + @Override + public ScreenHandlerType getScreenHandlerType() { + return ModScreens.ASSEMBLER_SCREEN; + } + + @Override + public int getInventorySize() { + return 3; + } + + @Override + public List getCorePositions() { + return List.of( + new Vec3i(1, 0,0), + new Vec3i(2, 0,0), + new Vec3i(0, 1, 0) + ); + } +} diff --git a/src/main/java/rearth/oritech/client/init/ModRenderers.java b/src/main/java/rearth/oritech/client/init/ModRenderers.java index 0f66ac5f9..423a798cf 100644 --- a/src/main/java/rearth/oritech/client/init/ModRenderers.java +++ b/src/main/java/rearth/oritech/client/init/ModRenderers.java @@ -12,6 +12,7 @@ public static void registerRenderers() { BlockEntityRendererFactories.register(BlockEntitiesContent.PULVERIZER_ENTITY, ctx -> new MachineRenderer<>("models/gem_station_anim")); BlockEntityRendererFactories.register(BlockEntitiesContent.GRINDER_ENTITY, ctx -> new MachineRenderer<>("models/grav_magnet")); + BlockEntityRendererFactories.register(BlockEntitiesContent.ASSEMBLER_ENTITY, ctx -> new MachineRenderer<>("models/gem_station_anim")); Oritech.LOGGER.info("Registering Entities Renderers for " + Oritech.MOD_ID); } diff --git a/src/main/java/rearth/oritech/client/init/ModScreens.java b/src/main/java/rearth/oritech/client/init/ModScreens.java index b18292dc6..231fac971 100644 --- a/src/main/java/rearth/oritech/client/init/ModScreens.java +++ b/src/main/java/rearth/oritech/client/init/ModScreens.java @@ -13,10 +13,12 @@ public class ModScreens implements AutoRegistryContainer> { public static final ExtendedScreenHandlerType PULVERIZER_SCREEN = new ExtendedScreenHandlerType<>(BasicMachineScreenHandler::new); public static final ExtendedScreenHandlerType GRINDER_SCREEN = new ExtendedScreenHandlerType<>(BasicMachineScreenHandler::new); + public static final ExtendedScreenHandlerType ASSEMBLER_SCREEN = new ExtendedScreenHandlerType<>(BasicMachineScreenHandler::new); public static void assignScreens() { HandledScreens.register(PULVERIZER_SCREEN, BasicMachineScreen::new); HandledScreens.register(GRINDER_SCREEN, BasicMachineScreen::new); + HandledScreens.register(ASSEMBLER_SCREEN, BasicMachineScreen::new); } @Override diff --git a/src/main/java/rearth/oritech/init/BlockContent.java b/src/main/java/rearth/oritech/init/BlockContent.java index be64a61eb..372be0956 100644 --- a/src/main/java/rearth/oritech/init/BlockContent.java +++ b/src/main/java/rearth/oritech/init/BlockContent.java @@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import rearth.oritech.block.custom.AssemblerBlock; import rearth.oritech.block.custom.GrinderBlock; import rearth.oritech.block.custom.MachineCoreBlock; import rearth.oritech.block.custom.PulverizerBlock; @@ -16,6 +17,7 @@ public class BlockContent implements BlockRegistryContainer { public static final Block BANANA_BLOCK = new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)); public static final Block PULVERIZER_BLOCK = new PulverizerBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); public static final Block GRINDER_BLOCK = new GrinderBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); + public static final Block ASSEMBLER_BLOCK = new AssemblerBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); public static final Block MACHINE_CORE = new MachineCoreBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); @Override diff --git a/src/main/java/rearth/oritech/init/BlockEntitiesContent.java b/src/main/java/rearth/oritech/init/BlockEntitiesContent.java index 5f1d09ae3..3d2351cfb 100644 --- a/src/main/java/rearth/oritech/init/BlockEntitiesContent.java +++ b/src/main/java/rearth/oritech/init/BlockEntitiesContent.java @@ -5,6 +5,7 @@ import net.minecraft.block.entity.BlockEntityType; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import rearth.oritech.block.entity.AssemblerBlockEntity; import rearth.oritech.block.entity.GrinderBlockEntity; import rearth.oritech.block.entity.PulverizerBlockEntity; import rearth.oritech.util.EnergyProvider; @@ -23,6 +24,9 @@ public class BlockEntitiesContent implements AutoRegistryContainer GRINDER_ENTITY = FabricBlockEntityTypeBuilder.create(GrinderBlockEntity::new, BlockContent.GRINDER_BLOCK).build(); + + @AssignSidedEnergy + public static final BlockEntityType ASSEMBLER_ENTITY = FabricBlockEntityTypeBuilder.create(AssemblerBlockEntity::new, BlockContent.ASSEMBLER_BLOCK).build(); @Override public Registry> getRegistry() { diff --git a/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java b/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java index 826a18d9e..fb11ac7cc 100644 --- a/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java +++ b/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java @@ -19,6 +19,7 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen blockStateModelGenerator.registerSimpleCubeAll(BlockContent.PULVERIZER_BLOCK); blockStateModelGenerator.registerSimpleCubeAll(BlockContent.GRINDER_BLOCK); blockStateModelGenerator.registerSimpleCubeAll(BlockContent.MACHINE_CORE); + blockStateModelGenerator.registerSimpleCubeAll(BlockContent.ASSEMBLER_BLOCK); } @Override diff --git a/src/main/java/rearth/oritech/init/recipes/RecipeContent.java b/src/main/java/rearth/oritech/init/recipes/RecipeContent.java index 8ed1ce6b4..2c388cfa1 100644 --- a/src/main/java/rearth/oritech/init/recipes/RecipeContent.java +++ b/src/main/java/rearth/oritech/init/recipes/RecipeContent.java @@ -9,6 +9,7 @@ public class RecipeContent { public static final OritechRecipe.OritechRecipeType PULVERIZER = register(new Identifier(Oritech.MOD_ID, "pulverizer")); public static final OritechRecipe.OritechRecipeType GRINDER = register(new Identifier(Oritech.MOD_ID, "grinder")); + public static final OritechRecipe.OritechRecipeType ASSEMBLER = register(new Identifier(Oritech.MOD_ID, "assembler")); private static OritechRecipe.OritechRecipeType register(Identifier name) { diff --git a/src/main/resources/assets/oritech/textures/block/assembler_block.png b/src/main/resources/assets/oritech/textures/block/assembler_block.png new file mode 100644 index 0000000000000000000000000000000000000000..24cf0e75c82b8fb76fa2c4a01ea7c0e84bf9372c GIT binary patch literal 917 zcmV;G18V$p0Cu3&WN-ZA)1}2Z?Al7kpts zVn#N-GTDWR5hHPWhsr{-1TvFdc{8J!5aS|=UZEJWXf{CESTsi z%U^xX?zV)cX&9exd}>s`ah-T#oucIs6;B++^$6zHW2E;p_j>B0#A3b9#3MdsWOkgd$ffY++L;@W+_?@5!ZA~vol=(eU7bMj)yiY%{y7XO@yf` zGf-hLu&}pHR#PxsdvD~RdF~cTT|&&OL~7l%J$T4DUk3n}mgljwwUf~_>cu40<&`9x zo9GU90#GI^GV^H>F|VS8LI5P2n^;P$^JU~Vz16h{RvWK$on+JFWmV6hMON_pT96eP z!^QsB4**Dc31vj{P-!pySt1M3UMW?;7yC93wc@_`Y4mLD(8G1T&NG>jl~)1 zd6kT&@&AnhL<|g+20iua0rtV-TOS3bC)ja?{oSvdjQW5hio=O`_ zY$N7XJ~(@xp9(t0_!_jeBUo*mKG{QAgQt#x!65)PJzl)AI0J)2ynkVs`T82fyvkc= z&olA;B&OLJt`3hOSZ$o??Wf9YDMfTST?h_=pQk2xyEa%_LYKIi*`X{DM2oEO*~L#w zLcf@N9MIq3$0TP}>^Jgu^Um z)zSxYR^`OzHUI;ILtOghNABPL^)VoTK1l^&#%TkNF2l{= zZV-6xMN)=Gyt(%ex!wEh?L6SGx>_pJ65I9?DqEGAVzGcpa0me0sdZyb-lMU?jI79b zV{xVnc{V*>z)hF$7~Yp&qi#QqtjMIK6mnKAK?3j`sX?|_s0()D_q7mp2&_&`V2rO( rY