package me.km.blocks; import net.minecraft.block.Block; import net.minecraft.block.BedBlock; import net.minecraft.block.BlockRenderType; import net.minecraft.block.material.MaterialColor; import net.minecraft.block.BlockState; import net.minecraft.item.DyeColor; import net.minecraft.state.properties.BedPart; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; public abstract class BlockModBed extends BedBlock { private final VoxelShape shape; public BlockModBed(String name, Block.Properties builder, double high) { super(DyeColor.BLACK, builder); super.setRegistryName(name); shape = Block.makeCuboidShape(0.0, 0.0, 0.0, 16.0, high, 16.0); this.setDefaultState(this.stateContainer.getBaseState().with(BedBlock.PART, BedPart.FOOT).with(BedBlock.OCCUPIED, false)); } @Override public MaterialColor getMaterialColor() { return material.getColor(); } @Override public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { // no tile entity needs to be removed } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return shape; } @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } @Override public TileEntity createNewTileEntity(IBlockReader worldIn) { return null; } @Override public boolean hasTileEntity(BlockState state) { return false; } }