mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-04 15:41:31 +00:00
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/GaleMC/Gale)
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index bc1cdee13f4ee72c62fc6e48720d6ae18d57a340..bd3c7cac3ae5088dcb8227f2f20358f7cf31bf0c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -1180,9 +1180,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
this.tryCheckInsideBlocks();
|
|
- float f = this.getBlockSpeedFactor();
|
|
-
|
|
- this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f));
|
|
+ // Leaves start - skip negligible planar movement multiplication
|
|
+ Vec3 oldDeltaMovement = this.getDeltaMovement();
|
|
+ if (!top.leavesmc.leaves.LeavesConfig.skipNegligiblePlanarMovementMultiplication ||
|
|
+ (oldDeltaMovement.x < -1e-6 || oldDeltaMovement.x > 1e-6 || oldDeltaMovement.z < -1e-6 || oldDeltaMovement.z > 1e-6)) {
|
|
+ float f = this.getBlockSpeedFactor();
|
|
+ if (!top.leavesmc.leaves.LeavesConfig.skipNegligiblePlanarMovementMultiplication || (f < 1 - 1e-6 || f > 1 + 1e-6)) {
|
|
+ this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f));
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - skip negligible planar movement multiplication
|
|
// Paper start - remove expensive streams from here
|
|
boolean noneMatch = true;
|
|
AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D);
|