mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Apply Skip negligible planar movement multiplication
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
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 7bb90470233aaaf13b71dddbef7d227018c4622f..1871a020dc3a66abef4acce3d2953a90262d3f3b 100644
|
||||||
|
--- a/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -1223,8 +1223,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
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 5f4dd9b08638d8a28dfdce2cc5a320099b72055b..9cb6528935879bb88659100417c96a1b3748668c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -1287,9 +1287,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (!org.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 (!org.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
|
|
||||||
if (this.level().getBlockStatesIfLoaded(this.getBoundingBox().deflate(1.0E-6D)).noneMatch((iblockdata2) -> {
|
|
||||||
return iblockdata2.is(BlockTags.FIRE) || iblockdata2.is(Blocks.LAVA);
|
|
||||||
})) {
|
|
||||||
Reference in New Issue
Block a user