BlockDeadBush .java

net.minecraft.block.BlockDeadBush (class): members: canPlaceBlockOn, isReplaceable, harvestBlock, getMapColor, getItemDropped. imports: StatList, MapColor.

net.minecraft.blockclass71 linescommonextends BlockBush2.1 KB

API Surface (5)

MapColor getMapColor(IBlockState state)
boolean canPlaceBlockOn(Block ground)
boolean isReplaceable(World worldIn, BlockPos pos)
Item getItemDropped(IBlockState state, Random rand, int fortune)
void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)

Full Source

BlockDeadBush.java71 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.Random;
4
import net.minecraft.block.material.MapColor;
5
import net.minecraft.block.material.Material;
6
import net.minecraft.block.state.IBlockState;
7
import net.minecraft.entity.player.EntityPlayer;
8
import net.minecraft.init.Blocks;
9
import net.minecraft.init.Items;
10
import net.minecraft.item.Item;
11
import net.minecraft.item.ItemStack;
12
import net.minecraft.stats.StatList;
13
import net.minecraft.tileentity.TileEntity;
14
import net.minecraft.util.BlockPos;
15
import net.minecraft.world.World;
16
17
public class BlockDeadBush extends BlockBush
18
{
19
    protected BlockDeadBush()
20
    {
21
        super(Material.vine);
22
        float f = 0.4F;
23
        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
24
    }
25
26
    /**
27
     * Get the MapColor for this Block and the given BlockState
28
     */
29
    public MapColor getMapColor(IBlockState state)
30
    {
31
        return MapColor.woodColor;
32
    }
33
34
    /**
35
     * is the block grass, dirt or farmland
36
     */
37
    protected boolean canPlaceBlockOn(Block ground)
38
    {
39
        return ground == Blocks.sand || ground == Blocks.hardened_clay || ground == Blocks.stained_hardened_clay || ground == Blocks.dirt;
40
    }
41
42
    /**
43
     * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
44
     */
45
    public boolean isReplaceable(World worldIn, BlockPos pos)
46
    {
47
        return true;
48
    }
49
50
    /**
51
     * Get the Item that this Block should drop when harvested.
52
     */
53
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
54
    {
55
        return null;
56
    }
57
58
    public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
59
    {
60
        if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
61
        {
62
            player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
63
            spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
64
        }
65
        else
66
        {
67
            super.harvestBlock(worldIn, player, pos, state, te);
68
        }
69
    }
70
}
71

Deobfuscated MCP 1.8.9 source of BlockDeadBush from Marcelektro/MavenMCP-1.8.9 (net/minecraft/block/BlockDeadBush.java), stored verbatim.