package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.TileEntityBlastFurnaceBooster; import de.ellpeck.naturesaura.data.BlockStateGenerator; import de.ellpeck.naturesaura.reg.ICustomBlockState; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICustomBlockState { public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; private static final VoxelShape SHAPE = VoxelShapes.create(1 / 16F, 0, 1 / 16F, 15 / 16F, 1, 15 / 16F); public BlockBlastFurnaceBooster() { super("blast_furnace_booster", TileEntityBlastFurnaceBooster::new, Block.Properties.from(Blocks.BLAST_FURNACE).setLightLevel(s -> 0)); } @Override protected boolean hasWaterlogging() { return true; } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPE; } @Override protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); builder.add(FACING); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return super.getStateForPlacement(context).with(FACING, context.getPlacementHorizontalFacing().getOpposite()); } @Override public void generateCustomBlockState(BlockStateGenerator generator) { generator.horizontalBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); } }