9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2026-01-06 15:41:56 +00:00
Files
Gale/patches/server/0117-Skip-negligible-planar-movement-multiplication.patch
2024-06-16 07:45:50 +08:00

34 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 30 Nov 2022 23:44:41 +0100
Subject: [PATCH] Skip negligible planar movement multiplication
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6650f27d1678ed6cb188f537931eaf3e3d40c7dd..448352d75cad0f016684079f2e14c667e1cecf32 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1188,9 +1188,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
this.tryCheckInsideBlocks();
+
+ // Gale start - skip negligible planar movement multiplication
+ Vec3 oldDeltaMovement = this.getDeltaMovement();
+ if (oldDeltaMovement.x < -1e-6 || oldDeltaMovement.x > 1e-6 || oldDeltaMovement.z < -1e-6 || oldDeltaMovement.z > 1e-6) {
+ // Gale end - skip negligible planar movement multiplication
float f = this.getBlockSpeedFactor();
- this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f));
+ // Gale start - skip negligible planar movement multiplication
+ if (f < 1 - 1e-6 || f > 1 + 1e-6) {
+ this.setDeltaMovement(oldDeltaMovement.multiply((double) f, 1.0D, (double) f));
+ }
+ }
+ // Gale 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);
})) {