    001package net.minecraft.block;
    002
    003import java.util.Random;
    004import net.minecraft.block.material.Material;
    005import net.minecraft.creativetab.CreativeTabs;
    006import net.minecraft.entity.Entity;
    007import net.minecraft.item.Item;
    008import net.minecraft.util.AxisAlignedBB;
    009import net.minecraft.world.World;
    010
    011public class BlockWeb extends Block
    012{
    013    public BlockWeb(int par1, int par2)
    014    {
    015        super(par1, par2, Material.web);
    016        this.setCreativeTab(CreativeTabs.tabDecorations);
    017    }
    018
    019    /**
    020     * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
    021     */
    022    public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
    023    {
    024        par5Entity.setInWeb();
    025    }
    026
    027    /**
    028     * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
    029     * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
    030     */
    031    public boolean isOpaqueCube()
    032    {
    033        return false;
    034    }
    035
    036    /**
    037     * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
    038     * cleared to be reused)
    039     */
    040    public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
    041    {
    042        return null;
    043    }
    044
    045    /**
    046     * The type of render function that is called for this block
    047     */
    048    public int getRenderType()
    049    {
    050        return 1;
    051    }
    052
    053    /**
    054     * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
    055     */
    056    public boolean renderAsNormalBlock()
    057    {
    058        return false;
    059    }
    060
    061    /**
    062     * Returns the ID of the items to drop on destruction.
    063     */
    064    public int idDropped(int par1, Random par2Random, int par3)
    065    {
    066        return Item.silk.itemID;
    067    }
    068
    069    /**
    070     * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops.
    071     */
    072    protected boolean canSilkHarvest()
    073    {
    074        return true;
    075    }
    076}