diff --git a/src/main/java/com/portingdeadmods/nautec/api/multiblocks/Multiblock.java b/src/main/java/com/portingdeadmods/nautec/api/multiblocks/Multiblock.java index ee4f09e7..54759693 100644 --- a/src/main/java/com/portingdeadmods/nautec/api/multiblocks/Multiblock.java +++ b/src/main/java/com/portingdeadmods/nautec/api/multiblocks/Multiblock.java @@ -2,7 +2,6 @@ import com.portingdeadmods.nautec.api.blockentities.multiblock.MultiblockEntity; import com.portingdeadmods.nautec.api.utils.HorizontalDirection; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.IntIntPair; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; @@ -16,6 +15,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; public interface Multiblock { BooleanProperty FORMED = BooleanProperty.create("formed"); @@ -82,9 +82,10 @@ public interface Multiblock { *
*
* Example: {@link com.indref.industrial_reforged.registries.multiblocks.BlastFurnaceMultiblock#getDefinition() BlastFurnaceMultiblock.getDefintion()} + * * @return The integer to block map that provides the integer keys and their block values */ - Int2ObjectMap getDefinition(); + Map getDefinition(); /** * This method provides the block entity resource for the controller of your multiblock. diff --git a/src/main/java/com/portingdeadmods/nautec/client/screen/BioReactorScreen.java b/src/main/java/com/portingdeadmods/nautec/client/screen/BioReactorScreen.java index 46dca844..6d691e10 100644 --- a/src/main/java/com/portingdeadmods/nautec/client/screen/BioReactorScreen.java +++ b/src/main/java/com/portingdeadmods/nautec/client/screen/BioReactorScreen.java @@ -3,8 +3,7 @@ import com.portingdeadmods.nautec.Nautec; import com.portingdeadmods.nautec.api.client.screen.NTAbstractContainerScreen; import com.portingdeadmods.nautec.api.menu.NTAbstractContainerMenu; -import com.portingdeadmods.nautec.content.blockentities.BioReactorBlockEntity; -import com.portingdeadmods.nautec.content.blockentities.multiblock.part.AugmentationStationExtensionBlockEntity; +import com.portingdeadmods.nautec.content.blockentities.multiblock.controller.BioReactorBlockEntity; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; diff --git a/src/main/java/com/portingdeadmods/nautec/content/blockentities/BioReactorBlockEntity.java b/src/main/java/com/portingdeadmods/nautec/content/blockentities/multiblock/controller/BioReactorBlockEntity.java similarity index 61% rename from src/main/java/com/portingdeadmods/nautec/content/blockentities/BioReactorBlockEntity.java rename to src/main/java/com/portingdeadmods/nautec/content/blockentities/multiblock/controller/BioReactorBlockEntity.java index 253e7309..d3a14dea 100644 --- a/src/main/java/com/portingdeadmods/nautec/content/blockentities/BioReactorBlockEntity.java +++ b/src/main/java/com/portingdeadmods/nautec/content/blockentities/multiblock/controller/BioReactorBlockEntity.java @@ -1,14 +1,17 @@ -package com.portingdeadmods.nautec.content.blockentities; +package com.portingdeadmods.nautec.content.blockentities.multiblock.controller; import com.portingdeadmods.nautec.api.blockentities.LaserBlockEntity; +import com.portingdeadmods.nautec.api.blockentities.multiblock.MultiblockEntity; +import com.portingdeadmods.nautec.api.multiblocks.MultiblockData; import com.portingdeadmods.nautec.capabilities.IOActions; -import com.portingdeadmods.nautec.content.menus.AugmentationStationExtensionMenu; import com.portingdeadmods.nautec.content.menus.BioReactorMenu; import com.portingdeadmods.nautec.registries.NTBlockEntityTypes; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.objects.ObjectSet; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.player.Inventory; @@ -16,12 +19,13 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.capabilities.BlockCapability; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Map; -public class BioReactorBlockEntity extends LaserBlockEntity implements MenuProvider { - +public class BioReactorBlockEntity extends LaserBlockEntity implements MenuProvider, MultiblockEntity { + private MultiblockData multiblockData; public BioReactorBlockEntity(BlockPos blockPos, BlockState blockState) { super(NTBlockEntityTypes.BIO_REACTOR.get(), blockPos, blockState); @@ -44,7 +48,7 @@ public Map> getSidedInteractions(BlockCapa } @Override - public Component getDisplayName() { + public @NotNull Component getDisplayName() { return Component.literal("Bio Reactor"); } @@ -52,4 +56,26 @@ public Component getDisplayName() { public @Nullable AbstractContainerMenu createMenu(int containerId, Inventory playerInventory, Player player) { return new BioReactorMenu(containerId, playerInventory, this); } + + @Override + public MultiblockData getMultiblockData() { + return this.multiblockData; + } + + @Override + public void setMultiblockData(MultiblockData data) { + this.multiblockData = data; + } + + @Override + protected void saveData(CompoundTag tag, HolderLookup.Provider provider) { + super.saveData(tag, provider); + tag.put("multiblockData", saveMBData()); + } + + @Override + protected void loadData(CompoundTag tag, HolderLookup.Provider provider) { + super.loadData(tag, provider); + this.multiblockData = loadMBData(tag.getCompound("multiblockData")); + } } diff --git a/src/main/java/com/portingdeadmods/nautec/content/blockentities/multiblock/part/BioReactorPartBlockEntity.java b/src/main/java/com/portingdeadmods/nautec/content/blockentities/multiblock/part/BioReactorPartBlockEntity.java new file mode 100644 index 00000000..8a831ea8 --- /dev/null +++ b/src/main/java/com/portingdeadmods/nautec/content/blockentities/multiblock/part/BioReactorPartBlockEntity.java @@ -0,0 +1,26 @@ +package com.portingdeadmods.nautec.content.blockentities.multiblock.part; + +import com.portingdeadmods.nautec.api.blockentities.multiblock.MultiblockPartEntity; +import com.portingdeadmods.nautec.registries.NTBlockEntityTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +public class BioReactorPartBlockEntity extends BlockEntity implements MultiblockPartEntity { + private BlockPos controllerPos; + + public BioReactorPartBlockEntity(BlockPos pos, BlockState blockState) { + super(NTBlockEntityTypes, pos, blockState); + } + + @Override + public BlockPos getControllerPos() { + return this.controllerPos; + } + + @Override + public void setControllerPos(BlockPos blockPos) { + this.controllerPos = blockPos; + } +} diff --git a/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorBlock.java b/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorBlock.java index 5522dbb4..6860ea6f 100644 --- a/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorBlock.java +++ b/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorBlock.java @@ -4,8 +4,12 @@ import com.portingdeadmods.nautec.api.blockentities.ContainerBlockEntity; import com.portingdeadmods.nautec.api.blocks.blockentities.LaserBlock; import com.portingdeadmods.nautec.registries.NTBlockEntityTypes; +import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -13,6 +17,8 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.phys.BlockHitResult; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class BioReactorBlock extends LaserBlock { @@ -43,4 +49,9 @@ protected MapCodec codec() { BlockState state = super.getStateForPlacement(context); return state != null ? state.setValue(FACING, context.getHorizontalDirection()) : null; } + + @Override + protected @NotNull InteractionResult useWithoutItem(BlockState p_60503_, Level p_60504_, BlockPos p_60505_, Player p_60506_, BlockHitResult p_60508_) { + return InteractionResult.FAIL; + } } diff --git a/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorPartBlock.java b/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorPartBlock.java new file mode 100644 index 00000000..11921e36 --- /dev/null +++ b/src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorPartBlock.java @@ -0,0 +1,54 @@ +package com.portingdeadmods.nautec.content.blocks; + +import com.mojang.serialization.MapCodec; +import com.portingdeadmods.nautec.api.blockentities.ContainerBlockEntity; +import com.portingdeadmods.nautec.api.blocks.blockentities.LaserBlock; +import com.portingdeadmods.nautec.content.blockentities.multiblock.part.BioReactorPartBlockEntity; +import com.portingdeadmods.nautec.registries.NTBlockEntityTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.phys.BlockHitResult; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class BioReactorPartBlock extends BaseEntityBlock { + public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + + public BioReactorPartBlock(Properties properties) { + super(properties); + registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH)); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder.add(FACING)); + } + + @Override + protected MapCodec codec() { + return simpleCodec(BioReactorBlock::new); + } + + @Override + public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) { + BlockState state = super.getStateForPlacement(context); + return state != null ? state.setValue(FACING, context.getHorizontalDirection()) : null; + } + + @Override + public @Nullable BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new BioReactorPartBlockEntity(pos, state); + } +} \ No newline at end of file diff --git a/src/main/java/com/portingdeadmods/nautec/content/menus/BioReactorMenu.java b/src/main/java/com/portingdeadmods/nautec/content/menus/BioReactorMenu.java index 5f9a811c..b7f9580f 100644 --- a/src/main/java/com/portingdeadmods/nautec/content/menus/BioReactorMenu.java +++ b/src/main/java/com/portingdeadmods/nautec/content/menus/BioReactorMenu.java @@ -1,8 +1,7 @@ package com.portingdeadmods.nautec.content.menus; import com.portingdeadmods.nautec.api.menu.NTAbstractContainerMenu; -import com.portingdeadmods.nautec.content.blockentities.BioReactorBlockEntity; -import com.portingdeadmods.nautec.content.blockentities.IncubatorBlockEntity; +import com.portingdeadmods.nautec.content.blockentities.multiblock.controller.BioReactorBlockEntity; import com.portingdeadmods.nautec.registries.NTMenuTypes; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; diff --git a/src/main/java/com/portingdeadmods/nautec/content/multiblocks/AugmentationStationMultiblock.java b/src/main/java/com/portingdeadmods/nautec/content/multiblocks/AugmentationStationMultiblock.java index 6936e4b1..f12bc20e 100644 --- a/src/main/java/com/portingdeadmods/nautec/content/multiblocks/AugmentationStationMultiblock.java +++ b/src/main/java/com/portingdeadmods/nautec/content/multiblocks/AugmentationStationMultiblock.java @@ -1,6 +1,5 @@ package com.portingdeadmods.nautec.content.multiblocks; -import com.portingdeadmods.nautec.Nautec; import com.portingdeadmods.nautec.api.blockentities.multiblock.MultiblockEntity; import com.portingdeadmods.nautec.api.multiblocks.Multiblock; import com.portingdeadmods.nautec.api.multiblocks.MultiblockData; @@ -15,13 +14,14 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import org.jetbrains.annotations.Nullable; +import java.util.Map; + public class AugmentationStationMultiblock implements Multiblock { public static final IntegerProperty AS_PART = IntegerProperty.create("as_part", 0, 8); @@ -52,7 +52,7 @@ public MultiblockLayer[] getLayout() { } @Override - public Int2ObjectMap getDefinition() { + public Map getDefinition() { Int2ObjectMap def = new Int2ObjectOpenHashMap<>(); def.put(0, null); def.put(1, getUnformedController()); @@ -79,7 +79,7 @@ public void onStartUnforming(Level level, BlockPos firstPos, BlockPos controller @Override public void iterBlock(Level level, BlockPos blockPos, BlockPos controllerPos, int layerIndex, int layoutIndex, MultiblockData data, boolean forming) { - Int2ObjectMap def = getDefinition(); + Map def = getDefinition(); int[] curLayer = getLayout()[0].layer(); Block block = def.get(curLayer[layerIndex]); if (block == getUnformedController() @@ -91,7 +91,7 @@ public void iterBlock(Level level, BlockPos blockPos, BlockPos controllerPos, in @Override public @Nullable BlockState formBlock(Level level, BlockPos blockPos, BlockPos controllerPos, int layerIndex, int layoutIndex, MultiblockData multiblockData, @Nullable Player player) { - Int2ObjectMap def = getDefinition(); + Map def = getDefinition(); int[] curLayer = getLayout()[0].layer(); Block block = def.get(curLayer[layerIndex]); if (block == getUnformedController() diff --git a/src/main/java/com/portingdeadmods/nautec/content/multiblocks/BioReactorMultiblock.java b/src/main/java/com/portingdeadmods/nautec/content/multiblocks/BioReactorMultiblock.java new file mode 100644 index 00000000..3fd8a467 --- /dev/null +++ b/src/main/java/com/portingdeadmods/nautec/content/multiblocks/BioReactorMultiblock.java @@ -0,0 +1,75 @@ +package com.portingdeadmods.nautec.content.multiblocks; + +import com.portingdeadmods.nautec.api.blockentities.multiblock.MultiblockEntity; +import com.portingdeadmods.nautec.api.multiblocks.Multiblock; +import com.portingdeadmods.nautec.api.multiblocks.MultiblockData; +import com.portingdeadmods.nautec.api.multiblocks.MultiblockLayer; +import com.portingdeadmods.nautec.registries.NTBlockEntityTypes; +import com.portingdeadmods.nautec.registries.NTBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +public class BioReactorMultiblock implements Multiblock { + @Override + public Block getUnformedController() { + return NTBlocks.BIO_REACTOR.get(); + } + + @Override + public Block getFormedController() { + return NTBlocks.BIO_REACTOR.get(); + } + + @Override + public MultiblockLayer[] getLayout() { + return new MultiblockLayer[]{ + layer( + 2, 1, 2, + 1, 3, 1, + 2, 1, 2 + ), + layer( + 2, 1, 2, + 1, 0, 1, + 2, 1, 2 + ), + }; + } + + @Override + public Map getDefinition() { + return Map.of( + 0, getUnformedController(), + 1, NTBlocks.BACTERIAL_CONTAINMENT_SHIELD.get(), + 2, NTBlocks.DARK_PRISMARINE_PILLAR.get(), + 3, NTBlocks.POLISHED_PRISMARINE.get() + ); + } + + @Override + public BlockEntityType getMultiBlockEntityType() { + return NTBlockEntityTypes.BIO_REACTOR.get(); + } + + @Override + public @Nullable BlockState formBlock(Level level, BlockPos blockPos, BlockPos controllerPos, int layerIndex, int layoutIndex, MultiblockData multiblockData, @Nullable Player player) { + return switch (layerIndex) { + case 4 -> Blocks.BARREL.defaultBlockState(); + default -> Blocks.BAMBOO_PLANKS.defaultBlockState(); + }; + } + + @Override + public boolean isFormed(Level level, BlockPos blockPos) { + BlockState block = level.getBlockState(blockPos); + return block.hasProperty(FORMED) && block.getValue(FORMED); + } +} diff --git a/src/main/java/com/portingdeadmods/nautec/content/multiblocks/DrainMultiblock.java b/src/main/java/com/portingdeadmods/nautec/content/multiblocks/DrainMultiblock.java index 0f9d2af2..10b42d91 100644 --- a/src/main/java/com/portingdeadmods/nautec/content/multiblocks/DrainMultiblock.java +++ b/src/main/java/com/portingdeadmods/nautec/content/multiblocks/DrainMultiblock.java @@ -23,6 +23,8 @@ import net.minecraft.world.level.block.state.properties.IntegerProperty; import org.jetbrains.annotations.Nullable; +import java.util.Map; + public class DrainMultiblock implements Multiblock { public static final IntegerProperty DRAIN_PART = IntegerProperty.create("drain_part", 0, 8); @@ -48,7 +50,7 @@ public MultiblockLayer[] getLayout() { } @Override - public Int2ObjectMap getDefinition() { + public Map getDefinition() { Int2ObjectMap def = new Int2ObjectOpenHashMap<>(); def.put(0, NTBlocks.DRAIN_WALL.get()); def.put(1, getUnformedController()); diff --git a/src/main/java/com/portingdeadmods/nautec/registries/NTBlockEntityTypes.java b/src/main/java/com/portingdeadmods/nautec/registries/NTBlockEntityTypes.java index db44e12f..4393adeb 100644 --- a/src/main/java/com/portingdeadmods/nautec/registries/NTBlockEntityTypes.java +++ b/src/main/java/com/portingdeadmods/nautec/registries/NTBlockEntityTypes.java @@ -3,13 +3,14 @@ import com.portingdeadmods.nautec.Nautec; import com.portingdeadmods.nautec.content.blockentities.*; import com.portingdeadmods.nautec.content.blockentities.multiblock.controller.AugmentationStationBlockEntity; +import com.portingdeadmods.nautec.content.blockentities.multiblock.controller.BioReactorBlockEntity; import com.portingdeadmods.nautec.content.blockentities.multiblock.controller.DrainBlockEntity; import com.portingdeadmods.nautec.content.blockentities.multiblock.part.AugmentationStationExtensionBlockEntity; import com.portingdeadmods.nautec.content.blockentities.multiblock.part.AugmentationStationPartBlockEntity; +import com.portingdeadmods.nautec.content.blockentities.multiblock.part.BioReactorPartBlockEntity; import com.portingdeadmods.nautec.content.blockentities.multiblock.part.DrainPartBlockEntity; import com.portingdeadmods.nautec.content.blockentities.multiblock.semi.PrismarineCrystalBlockEntity; import com.portingdeadmods.nautec.content.blockentities.multiblock.semi.PrismarineCrystalPartBlockEntity; -import com.portingdeadmods.nautec.content.blocks.multiblock.semi.PrismarineCrystalPartBlock; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.neoforge.registries.DeferredRegister; @@ -60,6 +61,9 @@ public final class NTBlockEntityTypes { public static final Supplier> BIO_REACTOR = BLOCK_ENTITIES.register("bio_reactor", () -> BlockEntityType.Builder.of(BioReactorBlockEntity::new, NTBlocks.BIO_REACTOR.get()).build(null)); + public static final Supplier> BIO_REACTOR_PART = BLOCK_ENTITIES.register("bio_reactor_part", + () -> BlockEntityType.Builder.of(BioReactorPartBlockEntity::new, + NTBlocks.BIO_REACTOR_PART.get()).build(null)); public static final Supplier> BACTERIAL_ANALYZER = BLOCK_ENTITIES.register("bacterial_analyzer", () -> BlockEntityType.Builder.of(BacterialAnalyzerBlockEntity::new, NTBlocks.BACTERIAL_ANALYZER.get()).build(null)); diff --git a/src/main/java/com/portingdeadmods/nautec/registries/NTBlocks.java b/src/main/java/com/portingdeadmods/nautec/registries/NTBlocks.java index ce9827b8..42f6cb0e 100644 --- a/src/main/java/com/portingdeadmods/nautec/registries/NTBlocks.java +++ b/src/main/java/com/portingdeadmods/nautec/registries/NTBlocks.java @@ -77,6 +77,8 @@ public final class NTBlocks { BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK)); public static final DeferredBlock BIO_REACTOR = registerBlockAndItem("bio_reactor", BioReactorBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK)); + public static final DeferredBlock BIO_REACTOR_PART = registerBlockAndItem("bio_reactor_part", BioReactorPartBlock::new, + BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK)); public static final DeferredBlock BACTERIAL_ANALYZER = registerBlockAndItem("bacterial_analyzer", BacterialAnalyzerBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK), true, false); public static final DeferredBlock BACTERIAL_ANALYZER_TOP = BLOCKS.registerBlock("bacterial_analyzer_top", BacterialAnalyzerTopBlock::new, diff --git a/src/main/java/com/portingdeadmods/nautec/registries/NTMultiblocks.java b/src/main/java/com/portingdeadmods/nautec/registries/NTMultiblocks.java index dda794c9..3bb443f3 100644 --- a/src/main/java/com/portingdeadmods/nautec/registries/NTMultiblocks.java +++ b/src/main/java/com/portingdeadmods/nautec/registries/NTMultiblocks.java @@ -4,6 +4,7 @@ import com.portingdeadmods.nautec.Nautec; import com.portingdeadmods.nautec.api.multiblocks.Multiblock; import com.portingdeadmods.nautec.content.multiblocks.AugmentationStationMultiblock; +import com.portingdeadmods.nautec.content.multiblocks.BioReactorMultiblock; import com.portingdeadmods.nautec.content.multiblocks.DrainMultiblock; import net.neoforged.neoforge.registries.DeferredRegister; @@ -16,4 +17,6 @@ public final class NTMultiblocks { DrainMultiblock::new); public static final Supplier AUGMENTATION_STATION = MULTIBLOCKS.register("augmentation_station", AugmentationStationMultiblock::new); + public static final Supplier BIO_REACTOR = MULTIBLOCKS.register("bio_reactor", + BioReactorMultiblock::new); } diff --git a/src/main/java/com/portingdeadmods/nautec/utils/MultiblockHelper.java b/src/main/java/com/portingdeadmods/nautec/utils/MultiblockHelper.java index 814e27ec..5dcb3157 100644 --- a/src/main/java/com/portingdeadmods/nautec/utils/MultiblockHelper.java +++ b/src/main/java/com/portingdeadmods/nautec/utils/MultiblockHelper.java @@ -224,8 +224,8 @@ public static BlockPos getFirstBlockPos(HorizontalDirection direction, BlockPos */ public static Vec3i getRelativeControllerPos(Multiblock multiblock) { Object2IntMap revDef = new Object2IntOpenHashMap<>(); - for (var entry : multiblock.getDefinition().int2ObjectEntrySet()) { - revDef.put(entry.getValue(), entry.getIntKey()); + for (var entry : multiblock.getDefinition().entrySet()) { + revDef.put(entry.getValue(), entry.getKey()); } MultiblockLayer[] layout = multiblock.getLayout(); @@ -299,7 +299,7 @@ private static void formBlocks(Multiblock multiblock, MultiblockData multiblockD Vec3i relativeControllerPos = getRelativeControllerPos(multiblock); // Calculate block pos of the first block in the multi (multiblock.getLayout().get(0)) BlockPos firstBlockPos = getFirstBlockPos(direction, controllerPos, relativeControllerPos); - Int2ObjectMap def = multiblock.getDefinition(); + Map def = multiblock.getDefinition(); Nautec.LOGGER.debug("first: {}", firstBlockPos); multiblock.onStartForming(level, firstBlockPos, controllerPos); diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/side.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/side.png new file mode 100644 index 00000000..993d728e Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/side.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/side_bottom.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/side_bottom.png new file mode 100644 index 00000000..fb440db0 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/side_bottom.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/top.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/top.png new file mode 100644 index 00000000..2f1c65aa Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/original/top.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side.png deleted file mode 100644 index 07e66a77..00000000 Binary files a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side.png and /dev/null differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_0.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_0.png new file mode 100644 index 00000000..b003be36 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_0.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_1.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_1.png new file mode 100644 index 00000000..ced62468 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_1.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_2.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_2.png new file mode 100644 index 00000000..9cea5fdd Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_bottom_2.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_0.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_0.png new file mode 100644 index 00000000..79fbe8cc Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_0.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_1.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_1.png new file mode 100644 index 00000000..1647639a Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_1.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_2.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_2.png new file mode 100644 index 00000000..99608c4b Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/side_top_2.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top.png deleted file mode 100644 index f5aa5509..00000000 Binary files a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top.png and /dev/null differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_0.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_0.png new file mode 100644 index 00000000..a9f4ec50 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_0.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_1.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_1.png new file mode 100644 index 00000000..ae6eb4a2 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_1.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_2.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_2.png new file mode 100644 index 00000000..de6b735d Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_2.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_3.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_3.png new file mode 100644 index 00000000..a8a02cca Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_3.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_4.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_4.png new file mode 100644 index 00000000..ed30c94a Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_4.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_5.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_5.png new file mode 100644 index 00000000..6f68817f Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_5.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_6.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_6.png new file mode 100644 index 00000000..49a12ffe Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_6.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_7.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_7.png new file mode 100644 index 00000000..63837653 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_7.png differ diff --git a/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_8.png b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_8.png new file mode 100644 index 00000000..0cf99ff0 Binary files /dev/null and b/src/main/resources/assets/nautec/textures/block/multiblock/bio_reactor/top_8.png differ diff --git a/src/main/resources/assets/nautec/textures/example/test.png b/src/main/resources/assets/nautec/textures/example/test.png deleted file mode 100644 index 952ca850..00000000 Binary files a/src/main/resources/assets/nautec/textures/example/test.png and /dev/null differ