2013-04-16 08:19:59 +00:00
|
|
|
package biomesoplenty.blocks;
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
2013-04-19 09:35:26 +00:00
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-04-16 06:43:45 +00:00
|
|
|
|
2013-03-28 19:03:53 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
2013-03-30 17:14:03 +00:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-04-02 06:49:16 +00:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
2013-03-31 07:44:08 +00:00
|
|
|
import net.minecraft.util.Icon;
|
2013-03-28 19:03:53 +00:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public class BlockSmolderingGrass extends Block
|
|
|
|
{
|
2013-03-31 07:44:08 +00:00
|
|
|
private Icon[] blockIcon = new Icon[6];
|
|
|
|
|
2013-03-28 19:03:53 +00:00
|
|
|
public BlockSmolderingGrass(int par1)
|
|
|
|
{
|
|
|
|
super(par1, Material.grass);
|
|
|
|
this.setTickRandomly(true);
|
2013-04-19 09:35:26 +00:00
|
|
|
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
2013-03-28 19:03:53 +00:00
|
|
|
}
|
2013-03-30 17:14:03 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
|
|
{
|
2013-04-25 16:28:57 +00:00
|
|
|
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:smolderinggrass_bottom");
|
|
|
|
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:smolderinggrass_top");
|
|
|
|
this.blockIcon[2] = par1IconRegister.registerIcon("BiomesOPlenty:smolderinggrass_side");
|
|
|
|
this.blockIcon[3] = par1IconRegister.registerIcon("BiomesOPlenty:smolderinggrass_side");
|
|
|
|
this.blockIcon[4] = par1IconRegister.registerIcon("BiomesOPlenty:smolderinggrass_side");
|
|
|
|
this.blockIcon[5] = par1IconRegister.registerIcon("BiomesOPlenty:smolderinggrass_side");
|
2013-03-30 17:14:03 +00:00
|
|
|
}
|
2013-03-31 07:44:08 +00:00
|
|
|
|
2013-04-17 00:09:59 +00:00
|
|
|
@Override
|
|
|
|
public Icon getIcon(int par1, int par2)
|
2013-03-31 07:44:08 +00:00
|
|
|
{
|
|
|
|
return blockIcon[par1];
|
|
|
|
}
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
|
|
|
|
*/
|
2013-03-30 17:14:03 +00:00
|
|
|
/*public int getBlockTextureFromSideAndMetadata(int par1, int par2)
|
2013-03-28 19:03:53 +00:00
|
|
|
{
|
|
|
|
return par1 == 1 ? 122 : (par1 == 0 ? 124 : 123);
|
2013-03-30 17:14:03 +00:00
|
|
|
}*/
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
|
|
|
*/
|
2013-03-30 17:14:03 +00:00
|
|
|
/*public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
2013-03-28 19:03:53 +00:00
|
|
|
{
|
|
|
|
if (par5 == 1)
|
|
|
|
{
|
|
|
|
return 122;
|
|
|
|
}
|
|
|
|
else if (par5 == 0)
|
|
|
|
{
|
|
|
|
return 124;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3 + 1, par4);
|
|
|
|
return var6 != Material.snow && var6 != Material.craftedSnow ? 123 : 123;
|
|
|
|
}
|
2013-03-30 17:14:03 +00:00
|
|
|
}*/
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A randomly called display update to be able to add particles or other items for display
|
|
|
|
*/
|
|
|
|
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
|
|
|
{
|
|
|
|
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
|
|
|
|
|
|
|
|
if (par5Random.nextInt(4) == 0)
|
|
|
|
{
|
|
|
|
par1World.spawnParticle("smoke", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 1.1F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D);
|
|
|
|
}
|
|
|
|
if (par5Random.nextInt(6) == 0)
|
|
|
|
{
|
|
|
|
par1World.spawnParticle("flame", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 1.1F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D);
|
|
|
|
}
|
|
|
|
}
|
2013-04-02 06:49:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
|
|
|
|
* cleared to be reused)
|
|
|
|
*/
|
|
|
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
float f = 0.02F;
|
|
|
|
return AxisAlignedBB.getAABBPool().getAABB((double)par2, (double)par3, (double)par4, (double)(par2 + 1), (double)((float)(par3 + 1) - f), (double)(par4 + 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
|
|
|
|
*/
|
|
|
|
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
|
|
|
|
{
|
|
|
|
par5Entity.setFire(2);
|
|
|
|
}
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the ID of the items to drop on destruction.
|
|
|
|
*/
|
|
|
|
public int idDropped(int par1, Random par2Random, int par3)
|
|
|
|
{
|
2013-04-02 06:49:16 +00:00
|
|
|
return Block.dirt.blockID;
|
2013-03-28 19:03:53 +00:00
|
|
|
}
|
|
|
|
}
|