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 007 public class BlockWall extends Block 008 { 009 public static final String[] field_82539_a = new String[] {"normal", "mossy"}; 010 011 public BlockWall(int par1, Block par2Block) 012 { 013 super(par1, par2Block.blockIndexInTexture, par2Block.blockMaterial); 014 this.setHardness(par2Block.blockHardness); 015 this.setResistance(par2Block.blockResistance / 3.0F); 016 this.setStepSound(par2Block.stepSound); 017 this.setCreativeTab(CreativeTabs.tabBlock); 018 } 019 020 /** 021 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata 022 */ 023 public int getBlockTextureFromSideAndMetadata(int par1, int par2) 024 { 025 return par2 == 1 ? Block.cobblestoneMossy.blockIndexInTexture : super.getBlockTextureFromSide(par1); 026 } 027 028 /** 029 * The type of render function that is called for this block 030 */ 031 public int getRenderType() 032 { 033 return 32; 034 } 035 036 /** 037 * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) 038 */ 039 public boolean renderAsNormalBlock() 040 { 041 return false; 042 } 043 044 public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) 045 { 046 return false; 047 } 048 049 /** 050 * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two 051 * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. 052 */ 053 public boolean isOpaqueCube() 054 { 055 return false; 056 } 057 058 /** 059 * Updates the blocks bounds based on its current state. Args: world, x, y, z 060 */ 061 public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) 062 { 063 boolean var5 = this.func_82538_d(par1IBlockAccess, par2, par3, par4 - 1); 064 boolean var6 = this.func_82538_d(par1IBlockAccess, par2, par3, par4 + 1); 065 boolean var7 = this.func_82538_d(par1IBlockAccess, par2 - 1, par3, par4); 066 boolean var8 = this.func_82538_d(par1IBlockAccess, par2 + 1, par3, par4); 067 float var9 = 0.25F; 068 float var10 = 0.75F; 069 float var11 = 0.25F; 070 float var12 = 0.75F; 071 float var13 = 1.0F; 072 073 if (var5) 074 { 075 var11 = 0.0F; 076 } 077 078 if (var6) 079 { 080 var12 = 1.0F; 081 } 082 083 if (var7) 084 { 085 var9 = 0.0F; 086 } 087 088 if (var8) 089 { 090 var10 = 1.0F; 091 } 092 093 if (var5 && var6 && !var7 && !var8) 094 { 095 var13 = 0.8125F; 096 var9 = 0.3125F; 097 var10 = 0.6875F; 098 } 099 else if (!var5 && !var6 && var7 && var8) 100 { 101 var13 = 0.8125F; 102 var11 = 0.3125F; 103 var12 = 0.6875F; 104 } 105 106 this.setBlockBounds(var9, 0.0F, var11, var10, var13, var12); 107 } 108 109 /** 110 * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been 111 * cleared to be reused) 112 */ 113 public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) 114 { 115 boolean var5 = this.func_82538_d(par1World, par2, par3, par4 - 1); 116 boolean var6 = this.func_82538_d(par1World, par2, par3, par4 + 1); 117 boolean var7 = this.func_82538_d(par1World, par2 - 1, par3, par4); 118 boolean var8 = this.func_82538_d(par1World, par2 + 1, par3, par4); 119 float var9 = 0.375F; 120 float var10 = 0.625F; 121 float var11 = 0.375F; 122 float var12 = 0.625F; 123 124 if (var5) 125 { 126 var11 = 0.0F; 127 } 128 129 if (var6) 130 { 131 var12 = 1.0F; 132 } 133 134 if (var7) 135 { 136 var9 = 0.0F; 137 } 138 139 if (var8) 140 { 141 var10 = 1.0F; 142 } 143 144 return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double)((float)par2 + var9), (double)par3, (double)((float)par4 + var11), (double)((float)par2 + var10), (double)((float)par3 + 1.5F), (double)((float)par4 + var12)); 145 } 146 147 public boolean func_82538_d(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) 148 { 149 int var5 = par1IBlockAccess.getBlockId(par2, par3, par4); 150 151 if (var5 != this.blockID && var5 != Block.fenceGate.blockID) 152 { 153 Block var6 = Block.blocksList[var5]; 154 return var6 != null && var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock() ? var6.blockMaterial != Material.pumpkin : false; 155 } 156 else 157 { 158 return true; 159 } 160 } 161 162 @SideOnly(Side.CLIENT) 163 164 /** 165 * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) 166 */ 167 public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) 168 { 169 par3List.add(new ItemStack(par1, 1, 0)); 170 par3List.add(new ItemStack(par1, 1, 1)); 171 } 172 173 /** 174 * Determines the damage on the item the block drops. Used in cloth and wood. 175 */ 176 public int damageDropped(int par1) 177 { 178 return par1; 179 } 180 }