Search in sources :

Example 1 with EventEquipmentGlobalVar

use of com.viste.realisticarmortiers.data.EventEquipmentGlobalVar in project RealisticArmorTiers by IsakViste.

the class Equiped method addPotionEffect.

public static void addPotionEffect(ServerPlayerEntity player, PotionEffect setEffect) {
    EventEquipmentGlobalVar global = new EventEquipmentGlobalVar();
    RegistryObject<Effect> potionEffect = RegistryObject.of(new ResourceLocation(setEffect.id), ForgeRegistries.POTIONS);
    if (player.hasEffect(potionEffect.get())) {
        player.removeEffect(potionEffect.get());
    }
    player.addEffect(new EffectInstance(potionEffect.get(), global.getPotionDur(), setEffect.efficiency - 1));
}
Also used : EventEquipmentGlobalVar(com.viste.realisticarmortiers.data.EventEquipmentGlobalVar) ResourceLocation(net.minecraft.util.ResourceLocation) PotionEffect(com.viste.realisticarmortiers.data.PotionEffect) Effect(net.minecraft.potion.Effect) EffectInstance(net.minecraft.potion.EffectInstance)

Aggregations

EventEquipmentGlobalVar (com.viste.realisticarmortiers.data.EventEquipmentGlobalVar)1 PotionEffect (com.viste.realisticarmortiers.data.PotionEffect)1 Effect (net.minecraft.potion.Effect)1 EffectInstance (net.minecraft.potion.EffectInstance)1 ResourceLocation (net.minecraft.util.ResourceLocation)1