From 9a5614de6549a91b6d2e1b68a1df17eb9a05c019 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 16 Mar 2025 17:29:13 +0700 Subject: [PATCH] Don't drop experience capsules when keepInventory is enabled --- .../java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java index 5ddfd3c17..23a6aafc4 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java @@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.mixin; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.GameRules; import net.neoforged.neoforge.event.EventHooks; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -28,7 +29,7 @@ public class MixinLivingEntity { at = @At("HEAD"), cancellable = true) public void dropExperience(@Nullable Entity killer, CallbackInfo hook) { - if (((Object) this) instanceof Player player && ServerConfig.INSTANCE.getDROP_EXPERIENCE_CAPSULES()) { + if (((Object) this) instanceof Player player && ServerConfig.INSTANCE.getDROP_EXPERIENCE_CAPSULES() && !player.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) { hook.cancel(); var android = ((IMatteryPlayer) player).getOtmPlayer();