BlockMelon .java

net.minecraft.block.BlockMelon (class): members: quantityDroppedWithBonus, quantityDropped, getItemDropped. imports: MapColor, CreativeTabs, Items.

net.minecraft.blockclass43 linescommonextends Block1.1 KB

API Surface (3)

Item getItemDropped(IBlockState state, Random rand, int fortune)
int quantityDropped(Random random)
int quantityDroppedWithBonus(int fortune, Random random)

Code Graph: Dependencies (7)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BlockMelon.java43 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.creativetab.CreativeTabs;
8
import net.minecraft.init.Items;
9
import net.minecraft.item.Item;
10
11
public class BlockMelon extends Block
12
{
13
    protected BlockMelon()
14
    {
15
        super(Material.gourd, MapColor.limeColor);
16
        this.setCreativeTab(CreativeTabs.tabBlock);
17
    }
18
19
    /**
20
     * Get the Item that this Block should drop when harvested.
21
     */
22
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
23
    {
24
        return Items.melon;
25
    }
26
27
    /**
28
     * Returns the quantity of items to drop on block destruction.
29
     */
30
    public int quantityDropped(Random random)
31
    {
32
        return 3 + random.nextInt(5);
33
    }
34
35
    /**
36
     * Get the quantity dropped based on the given fortune level
37
     */
38
    public int quantityDroppedWithBonus(int fortune, Random random)
39
    {
40
        return Math.min(9, this.quantityDropped(random) + random.nextInt(1 + fortune));
41
    }
42
}
43

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