From f954886675015005575e63a0f77a97202936a9db Mon Sep 17 00:00:00 2001 From: nostalgic853 Date: Mon, 24 Oct 2022 11:04:07 +0800 Subject: [PATCH] Skip entity move if no movement --- ...0022-Skip-entity-move-if-no-movement.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 patches/server/0022-Skip-entity-move-if-no-movement.patch diff --git a/patches/server/0022-Skip-entity-move-if-no-movement.patch b/patches/server/0022-Skip-entity-move-if-no-movement.patch new file mode 100644 index 0000000..2b0a136 --- /dev/null +++ b/patches/server/0022-Skip-entity-move-if-no-movement.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nostalgic853 +Date: Mon, 24 Oct 2022 11:01:36 +0800 +Subject: [PATCH] Skip entity move if no movement + +Copyright (c) 2021-2022 ishland + +Original code by RelativityMC, licensed under MIT +You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings) + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index c260859b0c8bba464559ad906183301ab62e6590..a4fef073d01a8255530307c73c45fbee66ae931b 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -398,6 +398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + @javax.annotation.Nullable + private UUID originWorld; + public boolean freezeLocked = false; // Paper - Freeze Tick Lock API ++ private boolean boundingBoxChanged = false; // KeYi + + public void setOrigin(@javax.annotation.Nonnull Location location) { + this.origin = location.toVector(); +@@ -1033,6 +1034,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + // Paper end - detailed watchdog information + + public void move(MoverType movementType, Vec3 movement) { ++ // KeYi start ++ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) { ++ boundingBoxChanged = false; ++ return; ++ } ++ // KeYi end ++ + // Paper start - detailed watchdog information + io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); + synchronized (this.posLock) { +@@ -3805,6 +3813,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + + public final void setBoundingBox(AABB boundingBox) { ++ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // KeYi + // CraftBukkit start - block invalid bounding boxes + double minX = boundingBox.minX, + minY = boundingBox.minY,