9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2026-01-04 15:31:45 +00:00
Files
Gale/patches/server/0119-Skip-negligible-planar-movement-multiplication.patch
2024-07-16 20:11:23 +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 7de04da95f2697af68e90d627a898baa159c3444..092074acfc53d422b92efbe16e492c26f43db1f9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1274,9 +1274,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);
})) {