SHARE
TWEET

Untitled

a guest Sep 20th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Random;
  2.  
  3. import com.jmanz7.FarmingandMiningUpdate.Main;
  4. import com.jmanz7.FarmingandMiningUpdate.init.ModItems;
  5.  
  6. import net.minecraft.entity.EntityLivingBase;
  7. import net.minecraft.item.ItemStack;
  8. import net.minecraft.item.ItemSword;
  9. import net.minecraft.util.DamageSource;
  10. import net.minecraftforge.event.entity.player.AttackEntityEvent;
  11.  
  12. public class ToolTreeSword extends ItemSword
  13. {
  14.  
  15.     //private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);
  16.      //private static final float[]  = new float[] {(float) Math.random() * 90-1};
  17.    
  18.     public ToolTreeSword(String name, ToolMaterial material)
  19.     {
  20.         super(material);
  21.         setUnlocalizedName(name);
  22.         setRegistryName(name);
  23.         setCreativeTab(Main.CAVETAB);
  24.         ModItems.ITEMS.add(this);
  25.     }
  26.      @Override
  27.         public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) {
  28.             Random rand = new Random();
  29.             int min = 1;
  30.             int max = 6;
  31.             this.setDamage(stack, rand.nextInt((max-min)+1) + min);
  32.             return super.onEntitySwing(entityLiving, stack);
  33.         }
  34. }
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