daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Mar 8th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.minecraft.src;
  2.  
  3. // Example: ObsidianHammer = (new ItemHammer(606, EnumToolMaterial.EMERALD, new Item[] { Item.shovelDiamond, Item.axeDiamond, Item.pickaxeDiamond })).setIconIndex(itemsSlot.requestFreeSlot("/mod/ObsidianHammer.png")).setMaxDamage(0);
  4.  
  5. public class ItemHammer extends ItemTool {
  6.    
  7.     private Item[] mergedToolList;
  8.  
  9.     public ItemHammer(int var1, EnumToolMaterial var3, Item[] mergedToolList) {
  10.         super(var1, 5, var3, blocksEffectiveAgainst);
  11.         this.mergedToolList = mergedToolList;
  12.         setMaxDamage(getMaxDamage() * 2);
  13.     }
  14.    
  15.     public float getStrVsBlock(ItemStack var1, Block var2) {
  16.         float result = super.getStrVsBlock(var1, var2);
  17.         for(int i = 0; i < mergedToolList.length; i++) {
  18.             float toolStr = mergedToolList[i].getStrVsBlock(var1, var2);
  19.             if (toolStr > result) result = toolStr;
  20.         }
  21.         return result;
  22.     }
  23.    
  24.     public boolean canHarvestBlock(Block var1) {
  25.         for(int i = 0; i < blocksEffectiveAgainst.length; i++)
  26.             if (var1 == blocksEffectiveAgainst[i])
  27.                 return toolMaterial.getHarvestLevel() >= minimalQualityHarvest[i];
  28.         for(int i = 0; i < mergedToolList.length; i++)
  29.             if (mergedToolList[i].canHarvestBlock(var1))
  30.                 return true;
  31.         return false;
  32.     }
  33.    
  34.     private static Block[] blocksEffectiveAgainst = {
  35.         Block.obsidian, Block.oreRedstone, Block.oreRedstoneGlowing, Block.mobSpawner, Block.brick, Block.dispenser, Block.field_40206_bB };
  36.    
  37.     private static int[] minimalQualityHarvest = {
  38.         3, 2, 2, 0, 0, 0, 0 };
  39.    
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top