NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/BlockBlastFurnaceBooster.java

54 lines
2.2 KiB
Java
Raw Normal View History

2020-01-26 02:20:08 +01:00
package de.ellpeck.naturesaura.blocks;
2021-12-04 15:40:09 +01:00
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityBlastFurnaceBooster;
2020-01-29 00:40:28 +01:00
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
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.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
2020-01-26 02:20:08 +01:00
2020-01-29 00:40:28 +01:00
public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICustomBlockState {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
2021-12-04 15:40:09 +01:00
private static final VoxelShape SHAPE = Shapes.create(1 / 16F, 0, 1 / 16F, 15 / 16F, 1, 15 / 16F);
2020-01-26 15:52:16 +01:00
2020-01-26 02:20:08 +01:00
public BlockBlastFurnaceBooster() {
2021-12-19 15:32:45 +01:00
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster.class, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
2020-01-26 02:20:08 +01:00
}
2020-01-26 15:52:16 +01:00
@Override
protected boolean hasWaterlogging() {
return true;
}
2020-01-26 17:59:58 +01:00
@Override
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
2022-06-27 15:24:04 +02:00
return BlockBlastFurnaceBooster.SHAPE;
2020-01-26 17:59:58 +01:00
}
2020-01-26 15:52:16 +01:00
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
2022-06-27 15:24:04 +02:00
builder.add(BlockBlastFurnaceBooster.FACING);
2020-01-26 15:52:16 +01:00
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
2022-06-27 15:24:04 +02:00
return super.getStateForPlacement(context).setValue(BlockBlastFurnaceBooster.FACING, context.getHorizontalDirection().getOpposite());
2020-01-26 15:52:16 +01:00
}
2020-01-29 00:40:28 +01:00
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
2020-01-29 01:34:58 +01:00
generator.horizontalBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
2020-01-29 00:40:28 +01:00
}
2020-01-26 02:20:08 +01:00
}