MrDood_Modding

BlockDropItem.java

Feb 3rd, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package com.josh.gomc.blocks;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.block.material.Material;
  7. import net.minecraft.item.Item;
  8.  
  9. public class BlockDropItem extends Block {
  10.  
  11.     private Item drop;
  12.     private int least_quantity;
  13.     private int most_quantity;
  14.  
  15.     public BlockDropItem(Material mat, Item drop, int least_quantity, int most_quantity, float hard, float res, int HL) {
  16.         super(mat);
  17.         this.drop = drop;
  18.         this.least_quantity = least_quantity;
  19.         this.most_quantity = most_quantity;
  20.         this.setHardness(hard);
  21.         this.setResistance(res);
  22.         this.setHarvestLevel("pickaxe", HL);
  23.         this.setStepSound(soundTypeStone);
  24.         // TODO Auto-generated constructor stub
  25.     }
  26.  
  27.     @Override
  28.     public Item getItemDropped(int meta, Random random, int fortune) {
  29.         return this.drop;
  30.     }
  31.  
  32.     @Override
  33.     public int quantityDropped(int meta, int fortune, Random random) {
  34.         if (this.least_quantity >= this.most_quantity)
  35.             return this.least_quantity;
  36.         return this.least_quantity + random.nextInt(this.most_quantity - this.least_quantity + fortune + 1);
  37.     }
  38.    
  39.  
  40. }
Add Comment
Please, Sign In to add comment