Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ThornCarpet extends BlockBase implements IHasModel{
- protected static final AxisAlignedBB CARPET_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D);
- public ThornCarpet(String name, Material material) {
- super(name, material);
- setSoundType(SoundType.CLOTH);
- setHardness(0.8F);
- setHarvestLevel("shears", 0);
- setLightOpacity(1);
- }
- public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
- {
- return CARPET_AABB;
- }
- public boolean isOpaqueCube(IBlockState state)
- {
- return false;
- }
- public boolean isFullCube(IBlockState state)
- {
- return false;
- }
- public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
- {
- return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos);
- }
- public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
- {
- this.checkForDrop(worldIn, pos, state);
- }
- private boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state)
- {
- if (!this.canBlockStay(worldIn, pos))
- {
- this.dropBlockAsItem(worldIn, pos, state, 0);
- worldIn.setBlockToAir(pos);
- return false;
- }
- else
- {
- return true;
- }
- }
- private boolean canBlockStay(World worldIn, BlockPos pos)
- {
- return !worldIn.isAirBlock(pos.down());
- }
- @SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
- {
- if (side == EnumFacing.UP)
- {
- return true;
- }
- else
- {
- return blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? true : super.shouldSideBeRendered(blockState, blockAccess, pos, side);
- }
- }
- public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items)
- {
- for (int i = 0; i < 1; ++i)
- {
- items.add(new ItemStack(this, 1, i));
- }
- }
- public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
- {
- return face == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement