Advertisement
Guest User

Untitled

a guest
May 7th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. package ShadoTECH.Blocks;
  2.  
  3. import java.util.Random;
  4. import ShadoTECH.ClientProxy;
  5. import ShadoTECH.Reference;
  6. import ShadoTECH.sT_Blocks;
  7. import ShadoTECH.sT_Items;
  8. import cpw.mods.fml.relauncher.Side;
  9. import cpw.mods.fml.relauncher.SideOnly;
  10. import net.minecraft.block.Block;
  11. import net.minecraft.block.BlockOre;
  12. import net.minecraft.block.material.Material;
  13. import net.minecraft.client.renderer.texture.IIconRegister;
  14. import net.minecraft.init.Blocks;
  15. import net.minecraft.init.Items;
  16. import net.minecraft.item.Item;
  17. import net.minecraft.util.IIcon;
  18. import net.minecraft.util.MathHelper;
  19. import net.minecraft.world.IBlockAccess;
  20. import net.minecraft.world.World;
  21.  
  22. public class Block_Ore extends BlockOre
  23. {
  24. public Block_Ore(float Hardness, float Resistance)
  25. {
  26. super();
  27. this.setHardness(Hardness);
  28. this.setResistance(Resistance);
  29. }
  30.  
  31. @Override
  32. @SideOnly(Side.CLIENT)
  33. public void registerBlockIcons(IIconRegister iconRegister)
  34. {
  35. this.blockIcon = iconRegister.registerIcon(Reference.MODID.toLowerCase() + ":" + this.getUnlocalizedName().substring(5));
  36. }
  37.  
  38. public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
  39. {
  40. 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))));
  41. }
  42.  
  43. public int quantityDroppedWithBonus(int p_149679_1_, Random random)
  44. {
  45. if(p_149679_1_ > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, random, p_149679_1_))
  46. {
  47. int j = random.nextInt(p_149679_1_ + 2) - 1;
  48. if (j < 0)
  49. {
  50. j = 0;
  51. }
  52. return this.quantityDropped(random) * (j + 1);
  53. }
  54. else
  55. {
  56. return this.quantityDropped(random);
  57. }
  58. }
  59.  
  60. 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_)
  61. {
  62. super.dropBlockAsItemWithChance(world, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
  63. }
  64.  
  65. private Random rand = new Random();
  66. @Override
  67. public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
  68. {
  69. if(this.getItemDropped(p_149690_5_, rand, p_149690_7_) != Item.getItemFromBlock(this))
  70. {
  71. int j1 = 0;
  72. return j1;
  73. }
  74. return 0;
  75. }
  76.  
  77. @Override
  78. public boolean renderAsNormalBlock()
  79. {
  80. return false;
  81. }
  82.  
  83. @Override
  84. public int getRenderBlockPass()
  85. {
  86. return 1;
  87. }
  88.  
  89. @Override
  90. public int getRenderType()
  91. {
  92. return ClientProxy.oreRenderID;
  93. }
  94.  
  95. @Override
  96. public boolean isOpaqueCube()
  97. {
  98. return false;
  99. }
  100.  
  101. @Override
  102. public boolean canRenderInPass(int pass)
  103. {
  104. ClientProxy.renderPass = pass;
  105. return true;
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement