2013-04-16 08:19:59 +00:00
|
|
|
package biomesoplenty.blocks;
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.BlockFlower;
|
|
|
|
import net.minecraft.block.material.Material;
|
2013-03-30 10:54:53 +00:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-04-13 01:58:30 +00:00
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
2013-04-10 01:14:41 +00:00
|
|
|
import net.minecraft.world.ColorizerFoliage;
|
2013-03-28 19:03:53 +00:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
2013-04-13 01:58:30 +00:00
|
|
|
import net.minecraftforge.common.EnumPlantType;
|
2013-03-28 19:03:53 +00:00
|
|
|
|
2013-04-16 22:48:15 +00:00
|
|
|
@Deprecated
|
2013-03-28 19:03:53 +00:00
|
|
|
public class BlockAlgae extends BlockFlower
|
|
|
|
{
|
2013-03-30 10:54:53 +00:00
|
|
|
public BlockAlgae(int par1)
|
2013-03-28 19:03:53 +00:00
|
|
|
{
|
2013-03-30 10:54:53 +00:00
|
|
|
super(par1);
|
2013-03-28 19:03:53 +00:00
|
|
|
float var3 = 0.5F;
|
|
|
|
float var4 = 0.015625F;
|
|
|
|
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of render function that is called for this block
|
|
|
|
*/
|
|
|
|
public int getRenderType()
|
|
|
|
{
|
|
|
|
return 23;
|
|
|
|
}
|
2013-03-30 10:54:53 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
|
|
{
|
|
|
|
this.blockIcon = par1IconRegister.registerIcon("BiomesOPlenty:algae");
|
|
|
|
}
|
2013-04-13 01:58:30 +00:00
|
|
|
|
2013-03-28 19:03:53 +00:00
|
|
|
public int getBlockColor()
|
|
|
|
{
|
|
|
|
double var1 = 0.5D;
|
|
|
|
double var3 = 1.0D;
|
|
|
|
return ColorizerFoliage.getFoliageColor(var1, var3);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the color this block should be rendered. Used by leaves.
|
|
|
|
*/
|
|
|
|
public int getRenderColor(int par1)
|
|
|
|
{
|
|
|
|
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
|
|
|
|
* when first determining what to render.
|
|
|
|
*/
|
|
|
|
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
int var6 = 0;
|
|
|
|
int var7 = 0;
|
|
|
|
int var8 = 0;
|
|
|
|
|
|
|
|
for (int var9 = -1; var9 <= 1; ++var9)
|
|
|
|
{
|
|
|
|
for (int var10 = -1; var10 <= 1; ++var10)
|
|
|
|
{
|
|
|
|
int var11 = par1IBlockAccess.getBiomeGenForCoords(par2 + var10, par4 + var9).getBiomeFoliageColor();
|
|
|
|
var6 += (var11 & 16711680) >> 16;
|
|
|
|
var7 += (var11 & 65280) >> 8;
|
|
|
|
var8 += var11 & 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the ID of the items to drop on destruction.
|
|
|
|
*/
|
|
|
|
public int idDropped(int par1, Random par2Random, int par3)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the quantity of items to drop on block destruction.
|
|
|
|
*/
|
|
|
|
public int quantityDropped(Random par1Random)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
|
|
|
|
* blockID passed in. Args: blockID
|
|
|
|
*/
|
|
|
|
protected boolean canThisPlantGrowOnThisBlockID(int par1)
|
|
|
|
{
|
|
|
|
return par1 == Block.waterStill.blockID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
|
|
|
|
*/
|
|
|
|
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
return par3 >= 0 && par3 < 256 ? par1World.getBlockMaterial(par2, par3 - 1, par4) == Material.water && par1World.getBlockMetadata(par2, par3 - 1, par4) == 0 : false;
|
|
|
|
}
|
|
|
|
}
|