001 package net.minecraft.block;
002
003 import java.util.List;
004 import java.util.Random;
005 import net.minecraft.block.material.Material;
006 import net.minecraft.entity.Entity;
007 import net.minecraft.entity.EntityLiving;
008 import net.minecraft.util.AxisAlignedBB;
009 import net.minecraft.util.MathHelper;
010 import net.minecraft.world.World;
011
012 public class BlockEndPortalFrame extends Block
013 {
014 public BlockEndPortalFrame(int par1)
015 {
016 super(par1, 159, Material.rock);
017 }
018
019 /**
020 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
021 */
022 public int getBlockTextureFromSideAndMetadata(int par1, int par2)
023 {
024 return par1 == 1 ? this.blockIndexInTexture - 1 : (par1 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture);
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 * The type of render function that is called for this block
038 */
039 public int getRenderType()
040 {
041 return 26;
042 }
043
044 /**
045 * Sets the block's bounds for rendering it as an item
046 */
047 public void setBlockBoundsForItemRender()
048 {
049 this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
050 }
051
052 /**
053 * if the specified block is in the given AABB, add its collision bounding box to the given list
054 */
055 public void addCollidingBlockToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
056 {
057 this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
058 super.addCollidingBlockToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
059 int var8 = par1World.getBlockMetadata(par2, par3, par4);
060
061 if (isEnderEyeInserted(var8))
062 {
063 this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F);
064 super.addCollidingBlockToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
065 }
066
067 this.setBlockBoundsForItemRender();
068 }
069
070 /**
071 * checks if an ender eye has been inserted into the frame block. parameters: metadata
072 */
073 public static boolean isEnderEyeInserted(int par0)
074 {
075 return (par0 & 4) != 0;
076 }
077
078 /**
079 * Returns the ID of the items to drop on destruction.
080 */
081 public int idDropped(int par1, Random par2Random, int par3)
082 {
083 return 0;
084 }
085
086 /**
087 * Called when the block is placed in the world.
088 */
089 public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
090 {
091 int var6 = ((MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
092 par1World.setBlockMetadataWithNotify(par2, par3, par4, var6);
093 }
094 }