From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Wed, 30 Nov 2022 14:25:58 +0100 Subject: [PATCH] Skip entity move if movement is zero License: MIT (https://opensource.org/licenses/MIT) Gale - https://galemc.org This patch is based on the following mixin: "com/ishland/vmp/mixins/entity/move_zero_velocity/MixinEntity.java" By: ishland As part of: VMP (https://github.com/RelativityMC/VMP-fabric) Licensed under: MIT (https://opensource.org/licenses/MIT) diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java index c68233c5953f7a760b9c0b74c19bdfbeb61f349f..51b899299a655af6b85b69fbf7fef03f7cb83369 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -240,6 +240,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public float yRotO; public float xRotO; private AABB bb = INITIAL_AABB; + private boolean boundingBoxChanged = false; // Gale - VMP - skip entity move if movement is zero public boolean onGround; public boolean horizontalCollision; public boolean verticalCollision; @@ -1060,6 +1061,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Paper end - detailed watchdog information public void move(MoverType type, 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 ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); @@ -4151,6 +4157,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public final void setBoundingBox(AABB bb) { + // Gale start - VMP - skip entity move if movement is zero + if (!this.bb.equals(bb)) { + this.boundingBoxChanged = true; + } + // Gale end - VMP - skip entity move if movement is zero // CraftBukkit start - block invalid bounding boxes double minX = bb.minX, minY = bb.minY,