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.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameRules;
import net.neoforged.neoforge.event.EventHooks; import net.neoforged.neoforge.event.EventHooks;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -28,7 +29,7 @@ public class MixinLivingEntity {
at = @At("HEAD"), at = @At("HEAD"),
cancellable = true) cancellable = true)
public void dropExperience(@Nullable Entity killer, CallbackInfo hook) { 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(); hook.cancel();
var android = ((IMatteryPlayer) player).getOtmPlayer(); var android = ((IMatteryPlayer) player).getOtmPlayer();

View File

@ -106,12 +106,17 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState)
if (!status.job.matterValue.isZero) if (!status.job.matterValue.isZero)
status.throttleFast() status.throttleFast()
} else { } 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) if (status.job.matterValue.isPositive) {
if (received.isPositive)
status.noMatter(1)
else
status.noMatter() status.noMatter()
} }
} }
}
override fun computeNextJob(id: Int): JobContainer<DecomposerJob> { override fun computeNextJob(id: Int): JobContainer<DecomposerJob> {
val stack = inputContainer[0] val stack = inputContainer[0]

View File

@ -17,8 +17,8 @@ object WitheredSkeletonSpawnHandler {
val entity = event.entity val entity = event.entity
if (entity is WitherSkeleton) { if (entity is WitherSkeleton) {
val giveHelmet = event.level.otmRandom.nextFloat() < ServerConfig.WITHER_SKELETON_HELMET_CHANCE val giveHelmet = event.level.otmRandom.nextDouble() < ServerConfig.WITHER_SKELETON_HELMET_CHANCE
val giveSword = event.level.otmRandom.nextFloat() < ServerConfig.WITHER_SKELETON_SWORD_CHANCE val giveSword = event.level.otmRandom.nextDouble() < ServerConfig.WITHER_SKELETON_SWORD_CHANCE
if (giveHelmet) { if (giveHelmet) {
if (!entity.hasItemInSlot(EquipmentSlot.HEAD)) if (!entity.hasItemInSlot(EquipmentSlot.HEAD))

View File

@ -79,7 +79,7 @@ class MatteryFoodData(private var player: Player) : FoodData() {
if (saturationLevel > 0f) { if (saturationLevel > 0f) {
val satisfied = min(saturationLevel.roundToInt(), points) val satisfied = min(saturationLevel.roundToInt(), points)
points -= satisfied points -= satisfied
saturationLevel -= satisfied saturationLevel = max(0f, saturationLevel - satisfied)
} }
foodLevel = max(0, foodLevel - points) foodLevel = max(0, foodLevel - points)