Continuing to eat/drink a food will prolong the effects

This commit is contained in:
Sollace 2021-08-19 13:16:22 +02:00
parent c8b2bc8b5f
commit aff0a488a4

View file

@ -99,7 +99,12 @@ public interface Toxin extends Affliction {
text = new TranslatableText("potion.withDuration", text, ChatUtil.ticksToString(ticks));
return of(text, (player, stack) -> {
player.addStatusEffect(new StatusEffectInstance(effect, ticks, amplifier, false, false, false));
StatusEffectInstance current = player.getStatusEffect(effect);
if (current != null) {
player.addStatusEffect(new StatusEffectInstance(effect, ticks + current.getDuration(), amplifier + current.getAmplifier(), false, false, false));
} else {
player.addStatusEffect(new StatusEffectInstance(effect, ticks, amplifier, false, false, false));
}
});
}