Merge branch '1.21' of https://git.dbotthepony.ru/DBot/overdrive_that_matters into world-structures

This commit is contained in:
GearShocky 2025-03-17 05:44:22 +05:00
commit 7a7139c48c
4 changed files with 13 additions and 7 deletions

View File

@ -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();

View File

@ -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()
}
}
}

View File

@ -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))

View File

@ -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)