Files
MiraiMC/patches/server/0075-Fast-speed-check.patch
2022-07-21 19:36:05 +02:00

55 lines
2.6 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 ecc7085ecb33f4a2bc08b49ca0889ca41a015c8c..c7c4f4489f9226d87b6d9f0f77d25806e8d80b75 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1225,7 +1225,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.tryCheckInsideBlocks();
- float f2 = this.getBlockSpeedFactor();
+ // NFT-Worlds start
+ 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();
+ }
+ // NFT-Worlds stop
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 6fb5f2f9bb1dc881eff5bc4a6edfcb1d3c7dc161..04d08c44f56a4af207b8240ca1d9d34790ead16d 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -221,4 +221,11 @@ public class MiraiConfig {
"Whether or not server should listen to location triggers.");
}
+ public static boolean fastSpeedCheck;
+ private static void speedCheck() {
+ fastSpeedCheck = getBoolean("fast-speed-check", true,
+ "Whether or not server should use a faster method",
+ "to check when entity delta movement is null.");
+ }
+
}
\ No newline at end of file