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

Purpur Changes:
PurpurMC/Purpur@d5c06b4 fix summon_entity effect attempting to add incorrect entity, closes #1545
PurpurMC/Purpur@faa1f93 add PlayerSetTrialSpawnerTypeWithEggEvent, fixes #1546 (#1547)
PurpurMC/Purpur@1ab7990 Updated Upstream (Paper)
PurpurMC/Purpur@8b987b1 fix infinityWorksWithoutArrows not working
PurpurMC/Purpur@de2e7a7 Updated Upstream (Paper)
2024-07-06 04:09:46 +03:00

42 lines
2.1 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 4bacfd3370115a2343af777b20291b207f194f5f..30e4d362d195a57cb502f2fb92f50dc1d7c0043c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -324,6 +324,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;
@@ -1091,6 +1092,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
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
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
@@ -4046,6 +4053,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,