mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-23 08:49:28 +00:00
Skip entity move if movement is zero
This commit is contained in:
@@ -6,8 +6,9 @@ Subject: [PATCH] Reduce lambda and Optional allocation in
|
||||
|
||||
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
This patch is based on the following commit:
|
||||
"new: remove lambda allocation in EntityExplosionBehavior"
|
||||
This patch is based on the following mixin:
|
||||
"alloc/explosion_behavior/EntityExplosionBehaviorMixin"
|
||||
Original commit: "new: remove lambda allocation in EntityExplosionBehavior"
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.nl.html)
|
||||
|
||||
@@ -5,8 +5,9 @@ Subject: [PATCH] Replace AI goal set with optimized collection
|
||||
|
||||
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
This patch is based on the following commit:
|
||||
"new: replace AI goal set with optimized collection"
|
||||
This patch is based on the following mixin:
|
||||
"collections/goals/GoalSelectorMixin"
|
||||
Original commit: "new: replace AI goal set with optimized collection"
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.nl.html)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MartijnMuijsers <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)
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"entity/move_zero_velocity/MixinEntity"
|
||||
Original commit: "Performance: Ignore zero velocity movement"
|
||||
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/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c73f2a697bcb4a670df37879dfc3e140290325bd..aa3b6f085e370079883d9928962bff8e9b187246 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; // Gale - VMP - skip entity move if movement is zero
|
||||
public boolean onGround;
|
||||
public boolean horizontalCollision;
|
||||
public boolean verticalCollision;
|
||||
@@ -1023,6 +1024,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
public void move(MoverType movementType, 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
|
||||
// Paper start - detailed watchdog information
|
||||
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
synchronized (this.posLock) {
|
||||
@@ -3750,6 +3756,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
+ // Gale start - VMP - skip entity move if movement is zero
|
||||
+ if (!this.bb.equals(boundingBox)) {
|
||||
+ this.boundingBoxChanged = true;
|
||||
+ }
|
||||
+ // Gale end - VMP - skip entity move if movement is zero
|
||||
// CraftBukkit start - block invalid bounding boxes
|
||||
double minX = boundingBox.minX,
|
||||
minY = boundingBox.minY,
|
||||
@@ -15,10 +15,10 @@ As part of: Akarin (https://github.com/Akarin-project/Akarin)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c73f2a697bcb4a670df37879dfc3e140290325bd..6f8b83016a81e376053f865f71e65bea125e3727 100644
|
||||
index aa3b6f085e370079883d9928962bff8e9b187246..4d17a2c8235bb897a9acecbc71df364b76613b75 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1958,8 +1958,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1964,8 +1964,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public void playerTouch(Player player) {}
|
||||
|
||||
public void push(Entity entity) {
|
||||
Reference in New Issue
Block a user