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

28 lines
1.2 KiB
Java
Raw Normal View History

2020-04-15 19:06:45 +02:00
package com.minelittlepony.unicopia.item;
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-25 13:32:33 +02:00
StatusEffect FOOD_POISONING = new CustomStatusEffect(new Identifier("unicopia", "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
2020-04-22 16:28:20 +02:00
e.addStatusEffect(nausea);
2020-01-16 12:35:46 +01:00
}
2020-01-17 14:27:26 +01:00
e.damage(MagicalDamageSource.FOOD_POISONING, i);
2020-01-16 12:35:46 +01:00
});
}