41 lines
2.1 KiB
Diff
41 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) and 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 2efc715857d49f69a8289bcf50f422960c00c8bd..18e6e9fe39a559ae043fdafcf4e4db467144e309 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -1104,7 +1104,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
private volatile boolean preventMoving = false;
|
|
//Luminol end
|
|
|
|
+ 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");
|
|
@@ -5061,6 +5068,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,
|