19 août 2019, 14:04

Merci de ta réponse mais ca crash dès que je la met sur mon armure :

public class EventHandler {

    @SubscribeEvent
    public void LivingEvent(LivingEvent event){

        if(event.entityLiving instanceof EntityPlayer)
        {
            if (event.entityLiving.isPotionActive(CustomPotion.FeatherFoaling)){

                if (event.entityLiving.getActivePotionEffect(CustomPotion.FeatherFoaling).getDuration() == 0){

                    event.entityLiving.removePotionEffect(CustomPotion.FeatherFoaling.id);
                    return;

                }



                    if(event.entityLiving.onGround){
                        event.setCanceled(true);



                    }

            }
        }
    }
}

Class armure

public class SpaciumArmorMod extends ItemArmor {
    public SpaciumArmorMod(ArmorMaterial material, int metaData)
    {
        super(material, 0, metaData);
    }

    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
    {
        if(stack.getItem() == SpaciumArmor.Space_Leggings)
        {
            return References.MOD_ID + ":textures/models/armor/spacium_layer_2.png";
        }

        else if(stack.getItem() == SpaciumArmor.Space_Helmet || stack.getItem() == SpaciumArmor.Space_Chestpalte || stack.getItem() == SpaciumArmor.Space_Boots)
        {
            return References.MOD_ID + ":textures/models/armor/spacium_layer_1.png";
        }
        return null;
    }

    public void onArmorTick(World world, EntityPlayer player , ItemStack itemStack){
        if(this == SpaciumArmor.Space_Helmet){
            player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 1000, 4));
            player.addPotionEffect(new PotionEffect(CustomPotion.FeatherFoaling.getId(), 1000, 1));

        }
        if(this == SpaciumArmor.Space_Boots){
            player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 20, 10));
        }

        if(this == SpaciumArmor.Space_Chestpalte ){
            player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 20, 5));


        }

        if(this == SpaciumArmor.Space_Leggings){


        }

        if (this == SpaciumArmor.Space_Leggings && this == SpaciumArmor.Space_Chestpalte && this == SpaciumArmor.Space_Boots && this == SpaciumArmor.Space_Helmet){
            player.addPotionEffect(new PotionEffect(Potion.invisibility.getId(), 20, 1));
        }


    }
}