Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
- if(itemstack.getItem().equals(ItemRegistry.potionBelt))
- {
- ItemStack[] potions = loadStacks(itemstack);
- for(int i = 0; i < potions.length; i++)
- {
- if(potions[i] != null)
- {
- Potion[] pot = Potion.potionTypes;
- ItemPotion potion = (ItemPotion) potions[i].getItem();
- if(potion.hasEffect(potions[i]))
- {
- List <PotionEffect> effects = (List<PotionEffect>) potion.getEffects(potions[i].getItemDamage());
- for(int j = 0; j < effects.size(); j++)
- {
- if(!pot[effects.get(j).getPotionID()].isInstant())
- {
- //Creating the same effect, but with 10 second and 2 ticks duration (Just enough for good night vision)
- PotionEffect effect = new PotionEffect(effects.get(j).getPotionID(), 202, effects.get(j).getAmplifier());
- player.addPotionEffect(effect);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment