generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c66a85c
commit 1b103d7
Showing
35 changed files
with
223 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...rtingdeadmods/nautec/content/blockentities/multiblock/part/BioReactorPartBlockEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/com/portingdeadmods/nautec/content/blocks/BioReactorPartBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Block, BlockState> builder) { | ||
super.createBlockStateDefinition(builder.add(FACING)); | ||
} | ||
|
||
@Override | ||
protected MapCodec<? extends BaseEntityBlock> 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); | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
src/main/java/com/portingdeadmods/nautec/content/menus/BioReactorMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/main/java/com/portingdeadmods/nautec/content/multiblocks/BioReactorMultiblock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Integer, Block> 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<? extends MultiblockEntity> 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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.