From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Sun, 12 Jan 2025 15:35:15 +0800 Subject: [PATCH] Gale: Skip entity move if movement is zero Co-authored by: Martijn Muijsers ishland 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 9d945f615187f86913be8a9b83b1aada3a1336b6..06496237f947af4849cb7f364eacf11d53736e3d 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1081,7 +1081,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"); @@ -5048,6 +5055,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,