mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
--------- Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
32 lines
1.9 KiB
Diff
32 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Fri, 21 Jul 2023 11:47:59 +0800
|
|
Subject: [PATCH] Skip negligible planar movement multiplication
|
|
|
|
This patch is Powered by Gale(https://github.com/Dreeam-qwq/Gale)
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 7376b7f56009865ba2db24b68f008b077bcf34d3..0260ccee26a4dad7c7ea53504a45c645abe3c28f 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -1246,8 +1246,17 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
}
|
|
}
|
|
|
|
- float blockSpeedFactor = this.getBlockSpeedFactor();
|
|
- this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
|
|
+ // Leaves start - skip negligible planar movement multiplication
|
|
+ Vec3 oldDeltaMovement = this.getDeltaMovement();
|
|
+ if (!org.leavesmc.leaves.LeavesConfig.performance.skipNegligiblePlanarMovementMultiplication ||
|
|
+ (oldDeltaMovement.x < -1e-6 || oldDeltaMovement.x > 1e-6 || oldDeltaMovement.z < -1e-6 || oldDeltaMovement.z > 1e-6)) {
|
|
+ float blockSpeedFactor = this.getBlockSpeedFactor();
|
|
+ if (!org.leavesmc.leaves.LeavesConfig.performance.skipNegligiblePlanarMovementMultiplication ||
|
|
+ (blockSpeedFactor < 1 - 1e-6 || blockSpeedFactor > 1 + 1e-6)) {
|
|
+ this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - skip negligible planar movement multiplication
|
|
profilerFiller.pop();
|
|
}
|
|
}
|