29 lines
1.1 KiB
Java
29 lines
1.1 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.player.PlayerEntity;
|
|
|
|
public class ExpStatusEffect extends StatusEffect {
|
|
public ExpStatusEffect() {
|
|
super(
|
|
StatusEffectCategory.BENEFICIAL, // 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).addExperience(3 << amplifier); // Higher amplifier gives you EXP faster
|
|
}
|
|
}
|
|
} |