From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: ishland Date: Sun, 12 Dec 2021 17:19:00 -0500 Subject: [PATCH] vmp: skip entity move if movement is zero 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 8a2429f915da389360dcb16609fef7701b4a863a..bc8cdffb58369a5c1796d3323ed1facbedf9c823 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -299,6 +299,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { 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; @@ -1035,6 +1036,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // Paper end - detailed watchdog information public void move(MoverType movementType, Vec3 movement) { + // DivineMC start - vmp: skip entity move if movement is zero + if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) { + boundingBoxChanged = false; + return; + } + // DivineMC end // Paper start - detailed watchdog information io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); synchronized (this.posLock) { @@ -3862,6 +3869,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } 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,