Files
MiraiMC/patches/server/0071-Fast-speed-check.patch
2022-09-07 20:59:03 +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 6bc313aa05d572236f05d0960fde0f27b9f93d50..9bdcad2b05367a8dcb519a2db8c4efea94a4d21c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1205,7 +1205,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 7a5d000c25af93b60215b3e2867358d7c238c6e4..7658c7743646fb1d3e07a9f91245407a2dd191dd 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