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(); diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt index 8ed8a703e..c4d753c96 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt @@ -106,10 +106,15 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) if (!status.job.matterValue.isZero) status.throttleFast() } else { - status.job.matterValue -= matter.receiveMatter(status.job.matterValue, false) + val received = matter.receiveMatter(status.job.matterValue, false) + status.job.matterValue -= received - if (status.job.matterValue.isPositive) - status.noMatter() + if (status.job.matterValue.isPositive) { + if (received.isPositive) + status.noMatter(1) + else + status.noMatter() + } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/SpawnModifiers.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/SpawnModifiers.kt index d7d1bb5d4..c40ff4f28 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/SpawnModifiers.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/SpawnModifiers.kt @@ -17,8 +17,8 @@ object WitheredSkeletonSpawnHandler { val entity = event.entity if (entity is WitherSkeleton) { - val giveHelmet = event.level.otmRandom.nextFloat() < ServerConfig.WITHER_SKELETON_HELMET_CHANCE - val giveSword = event.level.otmRandom.nextFloat() < ServerConfig.WITHER_SKELETON_SWORD_CHANCE + val giveHelmet = event.level.otmRandom.nextDouble() < ServerConfig.WITHER_SKELETON_HELMET_CHANCE + val giveSword = event.level.otmRandom.nextDouble() < ServerConfig.WITHER_SKELETON_SWORD_CHANCE if (giveHelmet) { if (!entity.hasItemInSlot(EquipmentSlot.HEAD)) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt index 62b9a8e82..9f442d2df 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt @@ -79,7 +79,7 @@ class MatteryFoodData(private var player: Player) : FoodData() { if (saturationLevel > 0f) { val satisfied = min(saturationLevel.roundToInt(), points) points -= satisfied - saturationLevel -= satisfied + saturationLevel = max(0f, saturationLevel - satisfied) } foodLevel = max(0, foodLevel - points)