Skip to content

Commit 4a0bae2

Browse files
committed
Skip movement if zero
1 parent a145753 commit 4a0bae2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: HaHaWTH <id_cn00@outlook.com>
3+
Date: Sun, 7 Apr 2024 15:56:44 +0800
4+
Subject: [PATCH] vmp-skip-movement-if-zero
5+
6+
7+
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
8+
index 48b61992a45784c7e6201be373e36104face7b85..e067703eb34ec85c3419e9e40647a8270a461eb0 100644
9+
--- a/src/main/java/net/minecraft/server/Entity.java
10+
+++ b/src/main/java/net/minecraft/server/Entity.java
11+
@@ -198,6 +198,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
12+
private boolean isInLava;
13+
private int lastLavaCheck = -1;
14+
// Beast end
15+
+ private boolean isBoundingBoxChanged = false; // Beast - VMP optimization
16+
public EnumMoveType moveType; // Beast - EntityMoveEvent
17+
18+
// Beast start - Cache current block pos
19+
@@ -608,6 +609,9 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
20+
}
21+
22+
public void move(EnumMoveType enummovetype, double d0, double d1, double d2) {
23+
+ if (!isBoundingBoxChanged && d0 == 0.0D && d1 == 0.0D && d2 == 0.0D) {
24+
+ return;
25+
+ }
26+
this.moveType = enummovetype; // Beast - EntityMoveEvent
27+
if (this.noclip) {
28+
this.a(this.getBoundingBox().d(d0, d1, d2));
29+
@@ -2791,6 +2795,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
30+
}
31+
32+
public void a(AxisAlignedBB axisalignedbb) {
33+
+ if (!this.boundingBox.equals(axisalignedbb)) isBoundingBoxChanged = true;
34+
// CraftBukkit start - block invalid bounding boxes
35+
double a = axisalignedbb.a,
36+
b = axisalignedbb.b,

0 commit comments

Comments
 (0)