From b5dd1e25d0039f9b85e417e7b4ecd290d0cedd0d Mon Sep 17 00:00:00 2001 From: 404Setup <153366651+404Setup@users.noreply.github.com> Date: Mon, 9 Sep 2024 09:27:26 +0800 Subject: [PATCH] skip entity move if movement is zero --- ...skip-entity-move-if-movement-is-zero.patch | 41 +++++++++++++++++++ ...lice-Improve-map-saving-performance.patch} | 0 ...Slice-noEntityCollisions-for-Entity.patch} | 4 +- ...Allow-inventory-clicks-in-Spectator.patch} | 0 ...ble-sending-Entity-Movement-Packets.patch} | 4 +- ...karin-Save-Json-list-asynchronously.patch} | 0 ...-Remove-stream-in-PoiCompetitorScan.patch} | 0 ...-ScalableLux-Upstream-Starlight-Fix.patch} | 0 ...=> 0111-Kiterino-New-liquid-physics.patch} | 0 9 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 patches/server/0103-vmp-skip-entity-move-if-movement-is-zero.patch rename patches/server/{0103-Slice-Improve-map-saving-performance.patch => 0104-Slice-Improve-map-saving-performance.patch} (100%) rename patches/server/{0104-Slice-noEntityCollisions-for-Entity.patch => 0105-Slice-noEntityCollisions-for-Entity.patch} (91%) rename patches/server/{0105-Slice-Allow-inventory-clicks-in-Spectator.patch => 0106-Slice-Allow-inventory-clicks-in-Spectator.patch} (100%) rename patches/server/{0106-Slice-Disable-sending-Entity-Movement-Packets.patch => 0107-Slice-Disable-sending-Entity-Movement-Packets.patch} (96%) rename patches/server/{0107-Akarin-Save-Json-list-asynchronously.patch => 0108-Akarin-Save-Json-list-asynchronously.patch} (100%) rename patches/server/{0108-Airplane-Remove-stream-in-PoiCompetitorScan.patch => 0109-Airplane-Remove-stream-in-PoiCompetitorScan.patch} (100%) rename patches/server/{0109-ScalableLux-Upstream-Starlight-Fix.patch => 0110-ScalableLux-Upstream-Starlight-Fix.patch} (100%) rename patches/server/{0110-Kiterino-New-liquid-physics.patch => 0111-Kiterino-New-liquid-physics.patch} (100%) diff --git a/patches/server/0103-vmp-skip-entity-move-if-movement-is-zero.patch b/patches/server/0103-vmp-skip-entity-move-if-movement-is-zero.patch new file mode 100644 index 0000000..4869e7f --- /dev/null +++ b/patches/server/0103-vmp-skip-entity-move-if-movement-is-zero.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: 404Setup <153366651+404Setup@users.noreply.github.com> +Date: Mon, 9 Sep 2024 09:26:31 +0800 +Subject: [PATCH] vmp: skip entity move if movement is zero + +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 31c6840e819eacb9fde4f3ea0e2314bd5c947852..16027780d6ce37cf2b069cc3a0af87972175a434 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -323,6 +323,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + public float yRotO; + public float xRotO; + private AABB bb; ++ private boolean boundingBoxChanged = false; // vmp: skip entity move if movement is zero + public boolean onGround; + public boolean horizontalCollision; + public boolean verticalCollision; +@@ -1207,6 +1208,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // Paper end - detailed watchdog information + + public void move(MoverType movementType, Vec3 movement) { ++ // vmp start - skip entity move if movement is zero ++ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) { ++ boundingBoxChanged = false; ++ return; ++ } ++ // vmp end + final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity + // Paper start - detailed watchdog information + io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot move an entity off-main"); +@@ -4310,6 +4317,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + public final void setBoundingBox(AABB boundingBox) { ++ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // vmp - skip entity move if movement is zero + // CraftBukkit start - block invalid bounding boxes + double minX = boundingBox.minX, + minY = boundingBox.minY, diff --git a/patches/server/0103-Slice-Improve-map-saving-performance.patch b/patches/server/0104-Slice-Improve-map-saving-performance.patch similarity index 100% rename from patches/server/0103-Slice-Improve-map-saving-performance.patch rename to patches/server/0104-Slice-Improve-map-saving-performance.patch diff --git a/patches/server/0104-Slice-noEntityCollisions-for-Entity.patch b/patches/server/0105-Slice-noEntityCollisions-for-Entity.patch similarity index 91% rename from patches/server/0104-Slice-noEntityCollisions-for-Entity.patch rename to patches/server/0105-Slice-noEntityCollisions-for-Entity.patch index 1511187..b654cda 100644 --- a/patches/server/0104-Slice-noEntityCollisions-for-Entity.patch +++ b/patches/server/0105-Slice-noEntityCollisions-for-Entity.patch @@ -18,10 +18,10 @@ index ee8e9c0e3690e78f3cc621ddfca89ea4256d4803..0466b04f24830539f2c927481c1c7995 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 31c6840e819eacb9fde4f3ea0e2314bd5c947852..6eade6f119c48687a62d13926831b20ff301eec2 100644 +index 16027780d6ce37cf2b069cc3a0af87972175a434..f83c55a65ce97f9944049d7e7a9cf763ea957054 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -547,6 +547,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -548,6 +548,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess * Overriding this field will cause memory leaks. */ private final boolean hardCollides; diff --git a/patches/server/0105-Slice-Allow-inventory-clicks-in-Spectator.patch b/patches/server/0106-Slice-Allow-inventory-clicks-in-Spectator.patch similarity index 100% rename from patches/server/0105-Slice-Allow-inventory-clicks-in-Spectator.patch rename to patches/server/0106-Slice-Allow-inventory-clicks-in-Spectator.patch diff --git a/patches/server/0106-Slice-Disable-sending-Entity-Movement-Packets.patch b/patches/server/0107-Slice-Disable-sending-Entity-Movement-Packets.patch similarity index 96% rename from patches/server/0106-Slice-Disable-sending-Entity-Movement-Packets.patch rename to patches/server/0107-Slice-Disable-sending-Entity-Movement-Packets.patch index f5a4a80..0750379 100644 --- a/patches/server/0106-Slice-Disable-sending-Entity-Movement-Packets.patch +++ b/patches/server/0107-Slice-Disable-sending-Entity-Movement-Packets.patch @@ -36,10 +36,10 @@ index 035a40836a6986a2740f02712276d5a261f2aa3c..0682e8b10ff65d5a63bcf4768473ec1f flag5 = true; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6eade6f119c48687a62d13926831b20ff301eec2..ad87599640d36fc06fee7a212c7aa5d82dc2df7e 100644 +index f83c55a65ce97f9944049d7e7a9cf763ea957054..7f60b07f12d0f209bcec9c78ff5837fc74259e41 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -443,6 +443,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -444,6 +444,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess private long lastPlayerScanTime; private boolean playerInRange; // Canvas end diff --git a/patches/server/0107-Akarin-Save-Json-list-asynchronously.patch b/patches/server/0108-Akarin-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0107-Akarin-Save-Json-list-asynchronously.patch rename to patches/server/0108-Akarin-Save-Json-list-asynchronously.patch diff --git a/patches/server/0108-Airplane-Remove-stream-in-PoiCompetitorScan.patch b/patches/server/0109-Airplane-Remove-stream-in-PoiCompetitorScan.patch similarity index 100% rename from patches/server/0108-Airplane-Remove-stream-in-PoiCompetitorScan.patch rename to patches/server/0109-Airplane-Remove-stream-in-PoiCompetitorScan.patch diff --git a/patches/server/0109-ScalableLux-Upstream-Starlight-Fix.patch b/patches/server/0110-ScalableLux-Upstream-Starlight-Fix.patch similarity index 100% rename from patches/server/0109-ScalableLux-Upstream-Starlight-Fix.patch rename to patches/server/0110-ScalableLux-Upstream-Starlight-Fix.patch diff --git a/patches/server/0110-Kiterino-New-liquid-physics.patch b/patches/server/0111-Kiterino-New-liquid-physics.patch similarity index 100% rename from patches/server/0110-Kiterino-New-liquid-physics.patch rename to patches/server/0111-Kiterino-New-liquid-physics.patch