diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index db02223034..7b003c8498 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -23,6 +23,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodData; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.SkullBlockEntity; @@ -187,6 +188,9 @@ public void die(DamageSource cause) shakeOff(); super.die(cause); setHealth(20); + if (!this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) { + giveExperienceLevels(-(experienceLevel + 1)); + } this.foodData = new FoodData(); kill(this.getCombatTracker().getDeathMessage()); }