90 lines
2.5 KiB
Java
90 lines
2.5 KiB
Java
package net.minecraft.block;
|
|
|
|
import java.util.Random;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.tileentity.TileEntityMobSpawner;
|
|
import net.minecraft.util.BlockRenderLayer;
|
|
import net.minecraft.util.EnumBlockRenderType;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
public class BlockMobSpawner extends BlockContainer
|
|
{
|
|
protected BlockMobSpawner()
|
|
{
|
|
super(Material.ROCK);
|
|
}
|
|
|
|
/**
|
|
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
|
*/
|
|
public TileEntity createNewTileEntity(World worldIn, int meta)
|
|
{
|
|
return new TileEntityMobSpawner();
|
|
}
|
|
|
|
/**
|
|
* Get the Item that this Block should drop when harvested.
|
|
*/
|
|
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
|
{
|
|
return Items.AIR;
|
|
}
|
|
|
|
/**
|
|
* Returns the quantity of items to drop on block destruction.
|
|
*/
|
|
public int quantityDropped(Random random)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Spawns this Block's drops into the World as EntityItems.
|
|
*/
|
|
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
|
|
{
|
|
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
|
|
}
|
|
|
|
@Override
|
|
public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
|
|
{
|
|
return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
|
|
}
|
|
|
|
/**
|
|
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
|
*/
|
|
public boolean isOpaqueCube(IBlockState state)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only,
|
|
* LIQUID for vanilla liquids, INVISIBLE to skip all rendering
|
|
*/
|
|
public EnumBlockRenderType getRenderType(IBlockState state)
|
|
{
|
|
return EnumBlockRenderType.MODEL;
|
|
}
|
|
|
|
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
|
|
{
|
|
return ItemStack.EMPTY;
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public BlockRenderLayer getBlockLayer()
|
|
{
|
|
return BlockRenderLayer.CUTOUT;
|
|
}
|
|
} |