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

83 lines
2.2 KiB
Java
Raw Normal View History

package biomesoplenty.blocks;
2013-03-28 19:03:53 +00:00
import java.util.Random;
2013-03-28 19:03:53 +00:00
import biomesoplenty.mod_BiomesOPlenty;
import biomesoplenty.configuration.BOPItems;
2013-03-28 19:03:53 +00:00
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
2013-03-30 10:54:53 +00:00
import net.minecraft.client.renderer.texture.IconRegister;
2013-03-28 19:03:53 +00:00
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockAmethystOre extends Block
{
2013-03-30 10:54:53 +00:00
public BlockAmethystOre(int par1)
2013-03-28 19:03:53 +00:00
{
2013-03-30 10:54:53 +00:00
super(par1, Material.rock);
2013-03-28 19:03:53 +00:00
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
}
2013-03-30 10:54:53 +00:00
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("BiomesOPlenty:amethystore");
}
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)
{
return BOPItems.amethyst.itemID;
2013-03-28 19:03:53 +00:00
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random par1Random)
{
return 1 + par1Random.nextInt(2);
}
/**
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
*/
public int quantityDroppedWithBonus(int par1, Random par2Random)
{
if (par1 > 0 && this.blockID != this.idDropped(0, par2Random, par1))
{
int var3 = par2Random.nextInt(par1 + 2) - 1;
if (var3 < 0)
{
var3 = 0;
}
return this.quantityDropped(par2Random) * (var3 + 1);
}
else
{
return this.quantityDropped(par2Random);
}
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
if (this.idDropped(par5, par1World.rand, par7) != this.blockID)
{
int var8 = 0;
var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 1, 4);
this.dropXpOnBlockBreak(par1World, par2, par3, par4, var8);
}
}
}