Files
Shiroha/shiroha-server/minecraft-patches/features/0078-Gale-Skip-negligible-planar-movement-multiplication.patch
T
NanaChiyo0721 ffe256f06d
Shiroha CI / build (push) Canceled after 0s
Shiroha CI / Event File (push) Canceled after 0s
Reduce allocation in unlistened spawn events
2026-08-07 14:13:33 +08:00

33 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Thu, 4 Jun 2026 17:32:39 +0800
Subject: [PATCH] Gale: Skip negligible planar movement multiplication
License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://github.com/GaleMC/Gale
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index e4dfb9dec23b1ac38e2f2de529d9683615e758a7..ab3bc9fea3fb5da4f851f4722fae77dd961f2e55 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1299,8 +1299,17 @@ public abstract class Entity
}
}
- float blockSpeedFactor = this.getBlockSpeedFactor();
- this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
+ // Gale start - skip negligible planar movement multiplication
+ Vec3 oldDeltaMovement = this.getDeltaMovement();
+ if (oldDeltaMovement.x < -1e-6 || oldDeltaMovement.x > 1e-6 || oldDeltaMovement.z < -1e-6 || oldDeltaMovement.z > 1e-6) {
+ // Gale end - skip negligible planar movement multiplication
+ float blockSpeedFactor = this.getBlockSpeedFactor();
+ // Gale start - skip negligible planar movement multiplication
+ if (blockSpeedFactor < 1 - 1e-6 || blockSpeedFactor > 1 + 1e-6) {
+ this.setDeltaMovement(oldDeltaMovement.multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
+ }
+ }
+ // Gale end - skip negligible planar movement multiplication
profiler.pop();
}
}