0
Files
mc-1.8.8/client/src/main/java/net/minecraft/block/BlockDeadBush.java
2022-03-24 02:47:01 +03:00

71 lines
2.1 KiB
Java

package net.minecraft.block;
import java.util.Random;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public class BlockDeadBush extends BlockBush
{
protected BlockDeadBush()
{
super(Material.vine);
float f = 0.4F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
}
/**
* Get the MapColor for this Block and the given BlockState
*/
public MapColor getMapColor(IBlockState state)
{
return MapColor.woodColor;
}
/**
* is the block grass, dirt or farmland
*/
protected boolean canPlaceBlockOn(Block ground)
{
return ground == Blocks.sand || ground == Blocks.hardened_clay || ground == Blocks.stained_hardened_clay || ground == Blocks.dirt;
}
/**
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
*/
public boolean isReplaceable(World worldIn, BlockPos pos)
{
return true;
}
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return null;
}
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
}