mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-25 06:17:59 +01:00
32 lines
1.2 KiB
Java
32 lines
1.2 KiB
Java
|
package com.minelittlepony.unicopia;
|
||
|
|
||
|
import com.minelittlepony.unicopia.Unicopia;
|
||
|
|
||
|
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 DamageSource food_poisoning = new DamageSource("food_poisoning").bypassesArmor();
|
||
|
|
||
|
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) -> {
|
||
|
|
||
|
StatusEffectInstance nausea = e.getActivePotionEffect(StatusEffects.NAUSEA);
|
||
|
if (nausea == null) {
|
||
|
StatusEffect foodEffect = e.getActivePotionEffect(p);
|
||
|
nausea = new StatusEffectInstance(StatusEffects.NAUSEA, foodEffect.getDuration(), foodEffect.getAmplifier(), foodEffect.getIsAmbient(), foodEffect.doesShowParticles());
|
||
|
|
||
|
e.addPotionEffect(nausea);
|
||
|
}
|
||
|
|
||
|
e.attackEntityFrom(food_poisoning, i);
|
||
|
});
|
||
|
}
|