Files
MiraiMC/patches/server/0077-Fast-speed-check.patch
2022-06-29 03:01:17 +02:00

51 lines
2.4 KiB
Diff

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 9fc77dc845fc993ebb9d96f9af107f7e1e8e8a39..6b4370f8dffdaebb861ec59d0dad3fe54c696083 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1224,7 +1224,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
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 4ace3c19551ea1cc5079d0570f5f0e70f1cae6a5..4da53712474506e80c265ee38e1e1e88f51e3ec9 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -253,4 +253,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