Files
LuminolMC/patches/server/0051-Gale-Skip-entity-move-if-movement-is-zero.patch

43 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <novau233@163.com>
Date: Tue, 6 Feb 2024 04:21:05 +0000
Subject: [PATCH] Gale Skip entity move if movement is zero
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bc16167dccaf865b831885a1b32f42ab60229fe4..99978531e19eb9d5a14354b7e518d609e2389b5a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -319,6 +319,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public float yRotO;
public float xRotO;
private AABB bb;
+ private boolean boundingBoxChanged = false; // Gale - VMP - skip entity move if movement is zero
public boolean onGround;
public boolean horizontalCollision;
public boolean verticalCollision;
@@ -1143,6 +1144,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
//Luminol end
public void move(MoverType movementType, 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
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -5011,6 +5017,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB boundingBox) {
+ // Gale start - VMP - skip entity move if movement is zero
+ if (!this.bb.equals(boundingBox)) {
+ this.boundingBoxChanged = true;
+ }
+ // Gale end - VMP - skip entity move if movement is zero
// CraftBukkit start - block invalid bounding boxes
double minX = boundingBox.minX,
minY = boundingBox.minY,