001package net.minecraft.block;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import java.util.List;
006import java.util.Random;
007import net.minecraft.block.material.Material;
008import net.minecraft.entity.Entity;
009import net.minecraft.tileentity.TileEntity;
010import net.minecraft.tileentity.TileEntityEndPortal;
011import net.minecraft.util.AxisAlignedBB;
012import net.minecraft.world.IBlockAccess;
013import net.minecraft.world.World;
014
015public class BlockEndPortal extends BlockContainer
016{
017    /**
018     * true if the enderdragon has been killed - allows end portal blocks to be created in the end
019     */
020    public static boolean bossDefeated = false;
021
022    protected BlockEndPortal(int par1, Material par2Material)
023    {
024        super(par1, 0, par2Material);
025        this.setLightValue(1.0F);
026    }
027
028    /**
029     * Returns a new instance of a block's tile entity class. Called on placing the block.
030     */
031    public TileEntity createNewTileEntity(World par1World)
032    {
033        return new TileEntityEndPortal();
034    }
035
036    /**
037     * Updates the blocks bounds based on its current state. Args: world, x, y, z
038     */
039    public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
040    {
041        float var5 = 0.0625F;
042        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var5, 1.0F);
043    }
044
045    @SideOnly(Side.CLIENT)
046
047    /**
048     * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
049     * coordinates.  Args: blockAccess, x, y, z, side
050     */
051    public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
052    {
053        return par5 != 0 ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
054    }
055
056    /**
057     * if the specified block is in the given AABB, add its collision bounding box to the given list
058     */
059    public void addCollidingBlockToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {}
060
061    /**
062     * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
063     * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
064     */
065    public boolean isOpaqueCube()
066    {
067        return false;
068    }
069
070    /**
071     * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
072     */
073    public boolean renderAsNormalBlock()
074    {
075        return false;
076    }
077
078    /**
079     * Returns the quantity of items to drop on block destruction.
080     */
081    public int quantityDropped(Random par1Random)
082    {
083        return 0;
084    }
085
086    /**
087     * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
088     */
089    public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
090    {
091        if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null && !par1World.isRemote)
092        {
093            par5Entity.travelToDimension(1);
094        }
095    }
096
097    @SideOnly(Side.CLIENT)
098
099    /**
100     * A randomly called display update to be able to add particles or other items for display
101     */
102    public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
103    {
104        double var6 = (double)((float)par2 + par5Random.nextFloat());
105        double var8 = (double)((float)par3 + 0.8F);
106        double var10 = (double)((float)par4 + par5Random.nextFloat());
107        double var12 = 0.0D;
108        double var14 = 0.0D;
109        double var16 = 0.0D;
110        par1World.spawnParticle("smoke", var6, var8, var10, var12, var14, var16);
111    }
112
113    /**
114     * The type of render function that is called for this block
115     */
116    public int getRenderType()
117    {
118        return -1;
119    }
120
121    /**
122     * Called whenever the block is added into the world. Args: world, x, y, z
123     */
124    public void onBlockAdded(World par1World, int par2, int par3, int par4)
125    {
126        if (!bossDefeated)
127        {
128            if (par1World.provider.dimensionId != 0)
129            {
130                par1World.setBlockWithNotify(par2, par3, par4, 0);
131            }
132        }
133    }
134
135    @SideOnly(Side.CLIENT)
136
137    /**
138     * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
139     */
140    public int idPicked(World par1World, int par2, int par3, int par4)
141    {
142        return 0;
143    }
144}