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