001 package net.minecraft.block;
002
003 import cpw.mods.fml.relauncher.Side;
004 import cpw.mods.fml.relauncher.SideOnly;
005 import java.util.List;
006 import net.minecraft.block.material.Material;
007 import net.minecraft.creativetab.CreativeTabs;
008 import net.minecraft.entity.Entity;
009 import net.minecraft.entity.item.EntityBoat;
010 import net.minecraft.util.AxisAlignedBB;
011 import net.minecraft.world.IBlockAccess;
012 import net.minecraft.world.World;
013
014 public class BlockLilyPad extends BlockFlower
015 {
016 protected BlockLilyPad(int par1, int par2)
017 {
018 super(par1, par2);
019 float var3 = 0.5F;
020 float var4 = 0.015625F;
021 this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3);
022 this.setCreativeTab(CreativeTabs.tabDecorations);
023 }
024
025 /**
026 * The type of render function that is called for this block
027 */
028 public int getRenderType()
029 {
030 return 23;
031 }
032
033 /**
034 * if the specified block is in the given AABB, add its collision bounding box to the given list
035 */
036 public void addCollidingBlockToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
037 {
038 if (par7Entity == null || !(par7Entity instanceof EntityBoat))
039 {
040 super.addCollidingBlockToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
041 }
042 }
043
044 /**
045 * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
046 * cleared to be reused)
047 */
048 public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
049 {
050 return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ);
051 }
052
053 @SideOnly(Side.CLIENT)
054 public int getBlockColor()
055 {
056 return 2129968;
057 }
058
059 @SideOnly(Side.CLIENT)
060
061 /**
062 * Returns the color this block should be rendered. Used by leaves.
063 */
064 public int getRenderColor(int par1)
065 {
066 return 2129968;
067 }
068
069 @SideOnly(Side.CLIENT)
070
071 /**
072 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
073 * when first determining what to render.
074 */
075 public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
076 {
077 return 2129968;
078 }
079
080 /**
081 * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
082 * blockID passed in. Args: blockID
083 */
084 protected boolean canThisPlantGrowOnThisBlockID(int par1)
085 {
086 return par1 == Block.waterStill.blockID;
087 }
088
089 /**
090 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
091 */
092 public boolean canBlockStay(World par1World, int par2, int par3, int par4)
093 {
094 return par3 >= 0 && par3 < 256 ? par1World.getBlockMaterial(par2, par3 - 1, par4) == Material.water && par1World.getBlockMetadata(par2, par3 - 1, par4) == 0 : false;
095 }
096 }