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

28 lines
1.2 KiB
Java
Raw Normal View History

package com.minelittlepony.unicopia;
2020-01-16 12:35:46 +01:00
import com.minelittlepony.unicopia.util.CustomStatusEffect;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
2020-01-16 12:35:46 +01:00
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
2020-01-27 11:05:22 +01:00
import net.minecraft.entity.effect.StatusEffectType;
2020-01-16 12:35:46 +01:00
import net.minecraft.entity.effect.StatusEffects;
2020-01-27 11:05:22 +01:00
import net.minecraft.util.Identifier;
2020-01-16 12:35:46 +01:00
2020-04-15 12:37:14 +02:00
public interface UEffects {
2020-01-16 12:35:46 +01:00
2020-04-15 12:37:14 +02:00
StatusEffect FOOD_POISONING = new CustomStatusEffect(new Identifier(UnicopiaCore.MODID, "food_poisoning"), StatusEffectType.BENEFICIAL, 3484199)
2020-01-16 12:35:46 +01:00
.setSilent()
2020-01-27 11:05:22 +01:00
.direct((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-27 11:05:22 +01:00
nausea = new StatusEffectInstance(StatusEffects.NAUSEA, foodEffect.getDuration(), foodEffect.getAmplifier(), foodEffect.isAmbient(), foodEffect.shouldShowParticles());
2020-01-16 12:35:46 +01:00
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
});
}