9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0064-Skip-entity-move-if-movement-is-zero.patch
Dreeam c947b7234a Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@4eda045b Backport fix for MC-296337 (Fixes #12617) (#12619)
PaperMC/Paper@7ebc94c2 Add Registry#getTagValues (#12603)
PaperMC/Paper@e87320d5 Fix UOE when using generateTree with pale oak (#12616)
PaperMC/Paper@94f29035 Do not blow up accessing unregistered memories from API (Fixes #12618) (#12639)

Purpur Changes:
PurpurMC/Purpur@916df1a8 use the correct item reference for retrieving components, closes #1668
2025-06-07 12:41:49 +08:00

51 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
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 <ishlandmc@yeah.net>
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 90f80877f25fd10a62d6ed273aa2ebb4b390f292..c0a75b84360cdaf89bb23380210de7c39f51ab2b 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;
@@ -1064,6 +1065,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");
@@ -4155,6 +4161,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,