From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jacob 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 72e39b9c7344e89bb9919b882002b4ebbd2d464d..7947271bbdc58011088e626cd1b3f9625d9bcd62 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1132,7 +1132,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 86cc31add10259a248b6044d1bcfb0a9a6bac9c6..abbbcc568ead90575aef85317e973275b6b16d46 100644 --- a/src/main/java/wtf/etil/mirai/MiraiConfig.java +++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java @@ -256,4 +256,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