Fast speed check

This commit is contained in:
Etil
2022-01-21 18:01:09 +01:00
parent 78d72927d4
commit 0f34dc0588

View File

@@ -0,0 +1,50 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jacob <jacob@stellardev.org>
Date: Wed, 19 Jan 2022 16:55:38 -0700
Subject: [PATCH] Fast speed check
Original code by NFT-Worlds, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/NFT-Worlds/Server
etil2jz's note:
NFT-Worlds is related to Stellar devs, known for countless paid forks mostly taking open source patches,
doing questionable/buggy ones, and claiming breathtaking performance improvements. Never ever pay for
any of those Spigot forks!
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2809bc3e3772ca0d75adb964679889f259795e70..76acbf2c76b91982355f04c2ca275390db169e4b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1125,7 +1125,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
}
this.tryCheckInsideBlocks();
- float f2 = this.getBlockSpeedFactor();
+ float f2;
+ if (wtf.etil.mirai.MiraiConfig.fastSpeedCheck) {
+ if (this.getDeltaMovement().x == 0 && this.getDeltaMovement().z == 0) {
+ f2 = 1;
+ } else {
+ f2 = this.getBlockSpeedFactor();
+ }
+ } else {
+ f2 = this.getBlockSpeedFactor();
+ }
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2));
// Paper start - remove expensive streams from here
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index f327714292019eb0a401eef06f67a3562d6baab0..54a28a47d6096740cf56ca8e1156c008e6de1997 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -261,4 +261,9 @@ public class MiraiConfig {
criterionTriggerLocation = getBoolean("criterion-trigger.location", criterionTriggerLocation);
}
+ public static boolean fastSpeedCheck = true;
+ private static void speedCheck() {
+ fastSpeedCheck = getBoolean("fast-speed-check", fastSpeedCheck);
+ }
+
}
\ No newline at end of file