serenas-shitmod/src/main/java/net/serenas/shitmod/LeanStatusEffect.java
2022-02-24 11:32:28 -08:00

40 lines
1.8 KiB
Java

package net.serenas.shitmod;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
public class LeanStatusEffect extends StatusEffect{
public LeanStatusEffect() {
super(
StatusEffectCategory.HARMFUL, // whether beneficial or harmful for entities
0x98D982); // color in RGB
}
// This method is called every tick to check whether it should apply the status effect or not
@Override
public boolean canApplyUpdateEffect(int duration, int amplifier) {
// In our case, we just make it return true so that it applies the status effect every tick.
return true;
}
// This method is called when it applies the status effect. We implement custom functionality here.
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
if (entity instanceof PlayerEntity) {
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.POISON));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.GLOWING));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE));
}
}
}