Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ShadoTECH.Blocks;
- import java.util.Random;
- import ShadoTECH.ClientProxy;
- import ShadoTECH.Reference;
- import ShadoTECH.sT_Blocks;
- import ShadoTECH.sT_Items;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockOre;
- import net.minecraft.block.material.Material;
- import net.minecraft.client.renderer.texture.IIconRegister;
- import net.minecraft.init.Blocks;
- import net.minecraft.init.Items;
- import net.minecraft.item.Item;
- import net.minecraft.util.IIcon;
- import net.minecraft.util.MathHelper;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- public class Block_Ore extends BlockOre
- {
- public Block_Ore(float Hardness, float Resistance)
- {
- super();
- this.setHardness(Hardness);
- this.setResistance(Resistance);
- }
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister iconRegister)
- {
- this.blockIcon = iconRegister.registerIcon(Reference.MODID.toLowerCase() + ":" + this.getUnlocalizedName().substring(5));
- }
- public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
- {
- return this == sT_Blocks.oreUranium ? sT_Items.oreUranium : (this == sT_Blocks.oreRuby ? sT_Items.gemRuby : (this == sT_Blocks.oreSapphire ? sT_Items.gemSapphire : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this))));
- }
- public int quantityDroppedWithBonus(int p_149679_1_, Random random)
- {
- if(p_149679_1_ > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, random, p_149679_1_))
- {
- int j = random.nextInt(p_149679_1_ + 2) - 1;
- if (j < 0)
- {
- j = 0;
- }
- return this.quantityDropped(random) * (j + 1);
- }
- else
- {
- return this.quantityDropped(random);
- }
- }
- public void dropBlockAsItemWithChance(World world, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
- {
- super.dropBlockAsItemWithChance(world, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
- }
- private Random rand = new Random();
- @Override
- public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
- {
- if(this.getItemDropped(p_149690_5_, rand, p_149690_7_) != Item.getItemFromBlock(this))
- {
- int j1 = 0;
- return j1;
- }
- return 0;
- }
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
- @Override
- public int getRenderBlockPass()
- {
- return 1;
- }
- @Override
- public int getRenderType()
- {
- return ClientProxy.oreRenderID;
- }
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
- @Override
- public boolean canRenderInPass(int pass)
- {
- ClientProxy.renderPass = pass;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement