More optimizations
This commit is contained in:
35
patches/server/0011-Fast-speed-check.patch
Normal file
35
patches/server/0011-Fast-speed-check.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: nostalgic853 <yuu8583@proton.me>
|
||||
Date: Sat, 22 Oct 2022 09:58:38 +0800
|
||||
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
|
||||
|
||||
This patch was took from Mirai. (https://github.com/etil2jz/Mirai)
|
||||
|
||||
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 a727875f6db8d9950d1d9ada67dd39480f3b0da9..c260859b0c8bba464559ad906183301ab62e6590 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1193,7 +1193,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
this.tryCheckInsideBlocks();
|
||||
- float f2 = this.getBlockSpeedFactor();
|
||||
+ // KeYi start - Fast speed check
|
||||
+ float f2;
|
||||
+ if (this.getDeltaMovement().x == 0 && this.getDeltaMovement().z == 0) {
|
||||
+ f2 = 1;
|
||||
+ } else {
|
||||
+ f2 = this.getBlockSpeedFactor();
|
||||
+ }
|
||||
+ // KeYi end
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2));
|
||||
// Paper start - remove expensive streams from here
|
||||
Reference in New Issue
Block a user