9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-23 00:39:16 +00:00
Files
DivineMC/patches/server/0012-vmp-skip-entity-move-if-movement-is-zero.patch
NONPLAYT 41643d7f29 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@962ee30 Updated Upstream (Paper)
PurpurMC/Purpur@74d1b4c Updated Upstream (Paper)
PurpurMC/Purpur@e2e8c61 Updated Upstream (Paper)
PurpurMC/Purpur@7a01fd8 Updated Upstream (Paper)
PurpurMC/Purpur@34c18f0 Updated Upstream (Paper)
PurpurMC/Purpur@ca668ab Updated Upstream (Paper)
2024-11-18 17:07:53 +03:00

42 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Fri, 26 Jan 2024 17:42:42 +0300
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 b2685ef358759d575eac82858e1a9c2408d34549..4d550730148d166806694fce65c5d10c61d9dca6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -326,6 +326,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public float yRotO;
public float xRotO;
private AABB bb;
+ private boolean boundingBoxChanged = false; // DivineMC - vmp: skip entity move if movement is zero
public boolean onGround;
public boolean horizontalCollision;
public boolean verticalCollision;
@@ -1222,6 +1223,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Paper end - detailed watchdog information
public void move(MoverType type, Vec3 movement) {
+ // DivineMC start - vmp: skip entity move if movement is zero
+ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) {
+ boundingBoxChanged = false;
+ return;
+ }
+ // DivineMC end
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");
@@ -4501,6 +4508,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB boundingBox) {
+ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // DivineMC - vmp: skip entity move if movement is zero
// CraftBukkit start - block invalid bounding boxes
double minX = boundingBox.minX,
minY = boundingBox.minY,