eddef226e0
it.
111 lines
3.2 KiB
Java
111 lines
3.2 KiB
Java
package biomesoplenty.blocks;
|
|
|
|
import java.util.Random;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockFlower;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
import net.minecraft.world.ColorizerFoliage;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.common.EnumPlantType;
|
|
|
|
@Deprecated
|
|
public class BlockAlgae extends BlockFlower
|
|
{
|
|
public BlockAlgae(int par1)
|
|
{
|
|
super(par1);
|
|
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;
|
|
}
|
|
|
|
@Override
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
{
|
|
this.blockIcon = par1IconRegister.registerIcon("BiomesOPlenty:algae");
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|