Files
LuminolMC/luminol-server/minecraft-patches/features/0022-Gale-Skip-entity-move-if-movement-is-zero.patch
2025-06-25 23:40:38 +08:00

43 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Sun, 12 Jan 2025 15:35:15 +0800
Subject: [PATCH] Gale: Skip entity move if movement is zero
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
ishland <ishlandmc@yeah.net>
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0103-Skip-entity-move-if-movement-is-zero.patch)
VMP (https://github.com/RelativityMC/VMP-fabric)
Licensed under: MIT (https://opensource.org/licenses/MIT)
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 50b4a82a054d41ac1439f9769eaefebc103b6d94..803cdabbcde93be8352e7370cf1f129f4663d277 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1107,7 +1107,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private double moveStartZ;
// Paper end - detailed watchdog information
+ private boolean boundingBoxChanged = false; // Gale - VMP - skip entity move if movement is zero
+
public void move(MoverType type, Vec3 movement) {
+ // Gale start - VMP - skip entity move if movement is zero
+ if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) {
+ return;
+ }
+ // Gale end - VMP - skip entity move if movement is zero
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
// Paper start - detailed watchdog information
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -5273,6 +5280,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB bb) {
+ // Gale start - VMP - skip entity move if movement is zero
+ if (!this.bb.equals(bb)) {
+ this.boundingBoxChanged = true;
+ }
+ // Gale end - VMP - skip entity move if movement is zero
// CraftBukkit start - block invalid bounding boxes
double minX = bb.minX,
minY = bb.minY,