gt22

Untitled

May 21st, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. @Override
  2.     public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
  3.         if(itemstack.getItem().equals(ItemRegistry.potionBelt))
  4.         {
  5.             ItemStack[] potions = loadStacks(itemstack);
  6.             for(int i = 0; i < potions.length; i++)
  7.             {
  8.                 if(potions[i] != null)
  9.                 {
  10.                     Potion[] pot = Potion.potionTypes;
  11.                     ItemPotion potion = (ItemPotion) potions[i].getItem();
  12.                     if(potion.hasEffect(potions[i]))
  13.                     {
  14.                         List <PotionEffect> effects = (List<PotionEffect>) potion.getEffects(potions[i].getItemDamage());
  15.                         for(int j = 0; j < effects.size(); j++)
  16.                         {
  17.                             if(!pot[effects.get(j).getPotionID()].isInstant())
  18.                             {
  19.                             //Creating the same effect, but with 10 second and 2 ticks duration (Just enough for good night vision)
  20.                             PotionEffect effect = new PotionEffect(effects.get(j).getPotionID(), 202, effects.get(j).getAmplifier());
  21.                             player.addPotionEffect(effect);
  22.                             }
  23.                         }
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.        
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment