package minestrapteam.mods.minestrappolation.block; import minestrapteam.mods.minestrappolation.lib.MBlocks; import net.minecraft.block.IGrowable; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; public class BlockDeadBranch extends MBlock implements IGrowable, net.minecraftforge.common.IShearable { public BlockDeadBranch(Material materialIn, MapColor mapColorIn) { super(materialIn, mapColorIn); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isPassable(IBlockAccess worldIn, BlockPos pos) { return false; } @Override public boolean isReplaceable(World worldIn, BlockPos pos) { return false; } @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public boolean isFullCube() { return false; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Items.stick; } @Override public int quantityDropped(Random random) { return random.nextInt(5); } @Override protected boolean canSilkHarvest() { return true; } @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) { return true; } @Override public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { List<ItemStack> ret = new java.util.ArrayList<ItemStack>(); ret.add(new ItemStack(MBlocks.dead_branch, 1)); return ret; } @Override public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { return false; } @Override public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { return false; } @Override public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) { this.dropBlockAsItem(worldIn, pos, this.getDefaultState(), 1); super.onEntityCollidedWithBlock(worldIn, pos, entityIn); worldIn.setBlockState(pos, Blocks.air.getDefaultState()); } @Override public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) { return 1200; } }