Unicopia/src/main/java/com/minelittlepony/unicopia/UEffects.java

31 lines
1.2 KiB
Java
Raw Normal View History

2020-01-16 12:35:46 +01:00
package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.Unicopia;
2020-01-17 14:27:26 +01:00
import com.minelittlepony.util.MagicalDamageSource;
2020-01-16 12:35:46 +01:00
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.potion.Potion;
public class UEffects {
public static final StatusEffect FOOD_POISONING = new UPotion(Unicopia.MODID, "food_poisoning", true, 3484199)
.setIconIndex(3, 1)
.setSilent()
.setEffectiveness(0.25)
.setApplicator((p, e, i) -> {
2020-01-17 14:27:26 +01:00
StatusEffectInstance nausea = e.getStatusEffect(StatusEffects.NAUSEA);
2020-01-16 12:35:46 +01:00
if (nausea == null) {
2020-01-17 14:27:26 +01:00
StatusEffectInstance foodEffect = e.getStatusEffect(p);
2020-01-16 12:35:46 +01:00
nausea = new StatusEffectInstance(StatusEffects.NAUSEA, foodEffect.getDuration(), foodEffect.getAmplifier(), foodEffect.getIsAmbient(), foodEffect.doesShowParticles());
e.addPotionEffect(nausea);
}
2020-01-17 14:27:26 +01:00
e.damage(MagicalDamageSource.FOOD_POISONING, i);
2020-01-16 12:35:46 +01:00
});
}