44 lines
2.1 KiB
Diff
44 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ishland <ishlandmc@yeah.net>
|
|
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 e46948c61c4f694c2224bed2bee695570d196ab9..0565cf824c2d623845239cb07c80f042732ff6be 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; // Mirai - vmp: skip entity move if movement is zero
|
|
public boolean onGround;
|
|
public boolean horizontalCollision;
|
|
public boolean verticalCollision;
|
|
@@ -1032,6 +1033,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
// Paper end - detailed watchdog information
|
|
|
|
public void move(MoverType movementType, Vec3 movement) {
|
|
+ // Mirai start - vmp: skip entity move if movement is zero
|
|
+ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) {
|
|
+ boundingBoxChanged = false;
|
|
+ return;
|
|
+ }
|
|
+ // Mirai end
|
|
// Paper start - detailed watchdog information
|
|
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
|
synchronized (this.posLock) {
|
|
@@ -3758,6 +3765,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
public final void setBoundingBox(AABB boundingBox) {
|
|
+ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // Mirai - vmp: skip entity move if movement is zero
|
|
// CraftBukkit start - block invalid bounding boxes
|
|
double minX = boundingBox.minX,
|
|
minY = boundingBox.minY,
|