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.client.renderer.texture.IconRegister; 009import net.minecraft.entity.Entity; 010import net.minecraft.entity.EntityLiving; 011import net.minecraft.item.ItemStack; 012import net.minecraft.util.AxisAlignedBB; 013import net.minecraft.util.Icon; 014import net.minecraft.util.MathHelper; 015import net.minecraft.world.World; 016 017public class BlockEndPortalFrame extends Block 018{ 019 @SideOnly(Side.CLIENT) 020 private Icon field_94400_a; 021 @SideOnly(Side.CLIENT) 022 private Icon field_94399_b; 023 024 public BlockEndPortalFrame(int par1) 025 { 026 super(par1, Material.rock); 027 } 028 029 @SideOnly(Side.CLIENT) 030 031 /** 032 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata 033 */ 034 public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) 035 { 036 return par1 == 1 ? this.field_94400_a : (par1 == 0 ? Block.whiteStone.getBlockTextureFromSide(par1) : this.field_94336_cN); 037 } 038 039 @SideOnly(Side.CLIENT) 040 public void func_94332_a(IconRegister par1IconRegister) 041 { 042 this.field_94336_cN = par1IconRegister.func_94245_a("endframe_side"); 043 this.field_94400_a = par1IconRegister.func_94245_a("endframe_top"); 044 this.field_94399_b = par1IconRegister.func_94245_a("endframe_eye"); 045 } 046 047 @SideOnly(Side.CLIENT) 048 public Icon func_94398_p() 049 { 050 return this.field_94399_b; 051 } 052 053 /** 054 * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two 055 * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. 056 */ 057 public boolean isOpaqueCube() 058 { 059 return false; 060 } 061 062 /** 063 * The type of render function that is called for this block 064 */ 065 public int getRenderType() 066 { 067 return 26; 068 } 069 070 /** 071 * Sets the block's bounds for rendering it as an item 072 */ 073 public void setBlockBoundsForItemRender() 074 { 075 this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); 076 } 077 078 /** 079 * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the 080 * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity 081 */ 082 public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) 083 { 084 this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); 085 super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); 086 int l = par1World.getBlockMetadata(par2, par3, par4); 087 088 if (isEnderEyeInserted(l)) 089 { 090 this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F); 091 super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); 092 } 093 094 this.setBlockBoundsForItemRender(); 095 } 096 097 /** 098 * checks if an ender eye has been inserted into the frame block. parameters: metadata 099 */ 100 public static boolean isEnderEyeInserted(int par0) 101 { 102 return (par0 & 4) != 0; 103 } 104 105 /** 106 * Returns the ID of the items to drop on destruction. 107 */ 108 public int idDropped(int par1, Random par2Random, int par3) 109 { 110 return 0; 111 } 112 113 /** 114 * Called when the block is placed in the world. 115 */ 116 public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) 117 { 118 int l = ((MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; 119 par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); 120 } 121}