BlockMobSpawner .java

net.minecraft.block.BlockMobSpawner (class, 80 lines): members: dropBlockAsItemWithChance, createNewTileEntity, getRenderType, quantityDropped, getItem.

net.minecraft.blockclass80 linescommonextends BlockContainer2.0 KB

API Surface (8)

TileEntity createNewTileEntity(World worldIn, int meta)
Item getItemDropped(IBlockState state, Random rand, int fortune)
int quantityDropped(Random random)
void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
boolean isOpaqueCube()
int getRenderType()
EnumWorldBlockLayer getBlockLayer()
Item getItem(World worldIn, BlockPos pos)

Full Source

BlockMobSpawner.java80 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.Random;
4
import net.minecraft.block.material.Material;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.item.Item;
7
import net.minecraft.tileentity.TileEntity;
8
import net.minecraft.tileentity.TileEntityMobSpawner;
9
import net.minecraft.util.BlockPos;
10
import net.minecraft.util.EnumWorldBlockLayer;
11
import net.minecraft.world.World;
12
13
public class BlockMobSpawner extends BlockContainer
14
{
15
    protected BlockMobSpawner()
16
    {
17
        super(Material.rock);
18
    }
19
20
    /**
21
     * Returns a new instance of a block's tile entity class. Called on placing the block.
22
     */
23
    public TileEntity createNewTileEntity(World worldIn, int meta)
24
    {
25
        return new TileEntityMobSpawner();
26
    }
27
28
    /**
29
     * Get the Item that this Block should drop when harvested.
30
     */
31
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
32
    {
33
        return null;
34
    }
35
36
    /**
37
     * Returns the quantity of items to drop on block destruction.
38
     */
39
    public int quantityDropped(Random random)
40
    {
41
        return 0;
42
    }
43
44
    /**
45
     * Spawns this Block's drops into the World as EntityItems.
46
     */
47
    public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
48
    {
49
        super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
50
        int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15);
51
        this.dropXpOnBlockBreak(worldIn, pos, i);
52
    }
53
54
    /**
55
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
56
     */
57
    public boolean isOpaqueCube()
58
    {
59
        return false;
60
    }
61
62
    /**
63
     * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
64
     */
65
    public int getRenderType()
66
    {
67
        return 3;
68
    }
69
70
    public EnumWorldBlockLayer getBlockLayer()
71
    {
72
        return EnumWorldBlockLayer.CUTOUT;
73
    }
74
75
    public Item getItem(World worldIn, BlockPos pos)
76
    {
77
        return null;
78
    }
79
}
80

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