Jump to content

Recommended Posts

Posted

Hey guys, i have made an armor, that gives me potion effects...

code is here:

public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
        if (itemStack.getItem().equals(ModItems.binosingum_helmet) || itemStack.getItem().equals(ModItems.texotek_helmet))
        {
            player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 40));
            player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 40));
        }
        if (itemStack.getItem().equals(ModItems.binosingum_chestplate)){
            player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 40, 2));
            player.addPotionEffect(new PotionEffect(Potion.resistance.id, 40, 2));
        }
        if (itemStack.getItem().equals(ModItems.texotek_chestplate)){
            player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 40, 5));
            player.addPotionEffect(new PotionEffect(Potion.resistance.id, 40, 10));
            player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 40, 2));
        }
        if (itemStack.getItem().equals(ModItems.binosingum_leggings) || itemStack.getItem().equals(ModItems.texotek_leggings)){
            player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 2));
        }
        if (itemStack.getItem().equals(ModItems.binosingum_boots) || itemStack.getItem().equals(ModItems.texotek_boots)){
            player.addPotionEffect(new PotionEffect(Potion.jump.id, 40));
        }
    }

i want to do the same for Zombie Pigmensso if they pickup my armor that they get the potion effects too

i tried this:

public void onArmorTick(World world, EntityMob entity, ItemStack itemStack) {
        if (itemStack.getItem().equals(ModItems.binosingum_helmet) || itemStack.getItem().equals(ModItems.texotek_helmet))
        {
            entity.addPotionEffect(new PotionEffect(Potion.nightVision.id, 40));
            entity.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 40));
        }
        if (itemStack.getItem().equals(ModItems.binosingum_chestplate)){
            entity.addPotionEffect(new PotionEffect(Potion.regeneration.id, 40, 2));
            entity.addPotionEffect(new PotionEffect(Potion.resistance.id, 40, 2));
        }
        if (itemStack.getItem().equals(ModItems.texotek_chestplate)){
            entity.addPotionEffect(new PotionEffect(Potion.regeneration.id, 40, 5));
            entity.addPotionEffect(new PotionEffect(Potion.resistance.id, 40, 10));
            entity.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 40, 2));
        }
        if (itemStack.getItem().equals(ModItems.binosingum_leggings) || itemStack.getItem().equals(ModItems.texotek_leggings)){
            entity.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 2));
        }
        if (itemStack.getItem().equals(ModItems.binosingum_boots) || itemStack.getItem().equals(ModItems.texotek_boots)){
            entity.addPotionEffect(new PotionEffect(Potion.jump.id, 40));
        }

    }

but that doesn't work

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.