BiomesOPlenty/src/minecraft/biomesoplenty/blocks/BlockAsh.java

99 lines
2.5 KiB
Java
Raw Normal View History

2013-05-03 13:00:44 +00:00
package biomesoplenty.blocks;
2013-05-04 23:50:42 +00:00
import static net.minecraftforge.common.ForgeDirection.UP;
2013-05-03 13:00:44 +00:00
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
2013-05-04 23:50:42 +00:00
import net.minecraftforge.common.ForgeDirection;
2013-05-03 13:00:44 +00:00
import biomesoplenty.BiomesOPlenty;
2013-05-04 23:50:42 +00:00
import biomesoplenty.api.Blocks;
2013-05-03 13:00:44 +00:00
import biomesoplenty.api.Items;
public class BlockAsh extends Block
{
2013-05-31 10:34:02 +00:00
public BlockAsh(int par1)
{
super(par1, Material.sand);
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
2013-05-03 13:00:44 +00:00
@Override
public void registerIcons(IconRegister par1IconRegister)
{
2013-05-31 10:34:02 +00:00
blockIcon = par1IconRegister.registerIcon("BiomesOPlenty:ashblock");
}
/**
* 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)
*/
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
float var5 = 0.125F;
return AxisAlignedBB.getAABBPool().getAABB(par2, par3, par4, par2 + 1, par3 + 1 - var5, par4 + 1);
}
/**
* A randomly called display update to be able to add particles or other items for display
*/
@Override
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
if (par5Random.nextInt(2) == 0)
{
par1World.spawnParticle("smoke", par2 + par5Random.nextFloat(), par3 + 1.1F, par4 + par5Random.nextFloat(), 0.0D, 0.0D, 0.0D);
}
}
@Override
public boolean isFireSource(World world, int x, int y, int z, int metadata, ForgeDirection side)
{
if (blockID == Blocks.ash.get().blockID && side == UP)
return true;
return false;
2013-05-03 13:00:44 +00:00
}
2013-05-31 10:34:02 +00:00
/**
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
*/
@Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
par5Entity.motionX *= 0.4D;
par5Entity.motionZ *= 0.4D;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return Items.miscItems.get().itemID;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
@Override
public int damageDropped(int meta)
{
return 1;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random)
{
return 4;
}
2013-05-03 13:00:44 +00:00
}