Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameRules;

@SuppressWarnings("unused")
public class ComfortEffect extends MobEffect
Expand All @@ -21,11 +22,15 @@ public ComfortEffect() {

@Override
public void applyEffectTick(LivingEntity entity, int amplifier) {
boolean flag = entity.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);
if (!flag){
return;
}
if (entity.hasEffect(MobEffects.REGENERATION)) {
return;
}
if (entity instanceof Player player) {
if (player.getFoodData().getSaturationLevel() > 0.0) {
if (player.getFoodData().getFoodLevel()>=18){
return;
}
}
Expand Down