Advertisement
Guest User

BlockBedrockOre.java (Block for ore generation)

a guest
Mar 27th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1. package brt.block;
  2. import java.util.Random;
  3.  
  4. import net.minecraft.block.Block;
  5. import net.minecraft.block.material.Material;
  6. import net.minecraft.block.state.IBlockState;
  7. import net.minecraft.creativetab.CreativeTabs;
  8. import net.minecraft.init.Blocks;
  9. import net.minecraft.item.EnumDyeColor;
  10. import net.minecraft.item.Item;
  11. import net.minecraft.util.BlockPos;
  12. import net.minecraft.util.MathHelper;
  13. import net.minecraft.world.IBlockAccess;
  14. import net.minecraft.world.World;
  15. import brt.BedrockTools;
  16.  
  17. public class BlockBedrockOre extends Block
  18. {
  19.     public BlockBedrockOre(Material materialIn)
  20.     {
  21.         super(materialIn);
  22.         this.setCreativeTab(BedrockTools.tabBrt);
  23.         this.setUnlocalizedName("bedrockOre");
  24.     }
  25.    
  26.     public int quantityDropped(Random random)
  27.     {
  28.         return 1;
  29.     }
  30.     public int quantityDroppedWithBonus(int fortune, Random random)
  31.     {
  32.         if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped((IBlockState)this.getBlockState().getValidStates().iterator().next(), random, fortune))
  33.         {
  34.             int j = random.nextInt(fortune + 2) - 1;
  35.  
  36.             if (j < 0)
  37.             {
  38.                 j = 0;
  39.             }
  40.  
  41.             return this.quantityDropped(random) * (j + 1);
  42.         }
  43.         else
  44.         {
  45.             return this.quantityDropped(random);
  46.         }
  47.     }
  48.     public Item getItemDropped(IBlockState state, Random rand, int forune)
  49.     {
  50.         return BedrockTools.bedrockShard;
  51.     }
  52.     public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune)
  53.     {
  54.         IBlockState state = world.getBlockState(pos);
  55.         Random rand = world instanceof World ? ((World)world).rand : new Random();
  56.         if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this))
  57.         {
  58.             return MathHelper.getRandomIntegerInRange(rand, 3, 7);
  59.         }
  60.         return 0;
  61.     }
  62.     public int damageDropped(IBlockState state)
  63.     {
  64.         return 0;
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement