-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
805026e
commit 80d9144
Showing
82 changed files
with
536 additions
and
651 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
patches/removed/server/0022-Early-return-optimization-for-target-finding.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Sun, 14 Aug 2022 17:16:19 +0800 | ||
Subject: [PATCH] Early return optimization for target finding | ||
|
||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) | ||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java | ||
index aecb0ad814586bfc5e56755ee14379a69388b38c..c618d7c87a0b2e2ee55cbe64cae80178fd8bd651 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java | ||
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java | ||
@@ -76,9 +76,17 @@ public class TargetingConditions { | ||
} | ||
|
||
if (this.range > 0.0) { | ||
+ // Leaves start - check range before getting visibility | ||
+ double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); | ||
+ if (org.leavesmc.leaves.LeavesConfig.entityTargetFindingOptimization) { | ||
+ double followRangeRaw = this.useFollowRange ? this.getFollowRange(baseEntity) : this.range; | ||
+ if (f > followRangeRaw * followRangeRaw) { // the actual follow range will always be this value or smaller, so if the distance is larger then it never will return true after getting invis | ||
+ return false; | ||
+ } | ||
+ } | ||
+ // Leaves end - check range before getting visibility | ||
double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; | ||
double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656 | ||
- double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); | ||
if (f > e * e) { | ||
return false; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
patches/server/0022-Config-to-disable-method-profiler.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Mon, 15 Aug 2022 10:18:36 +0800 | ||
Subject: [PATCH] Config to disable method profiler | ||
|
||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java | ||
index 59d4bc687af52ffb2b8529ce91a5703492fce96f..601d12cc2e0f2e180882f6b8c878e24a0856d082 100644 | ||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java | ||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java | ||
@@ -1320,7 +1320,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa | ||
this.nextTickTimeNanos += i; | ||
|
||
try { | ||
- Profiler.Scope profiler_a = Profiler.use(this.createProfiler()); | ||
+ Profiler.Scope profiler_a = org.leavesmc.leaves.LeavesConfig.disableMethodProfiler ? null : Profiler.use(this.createProfiler()); // Leaves - disable profiler | ||
|
||
try { | ||
ProfilerFiller gameprofilerfiller = Profiler.get(); | ||
diff --git a/src/main/java/net/minecraft/util/profiling/Profiler.java b/src/main/java/net/minecraft/util/profiling/Profiler.java | ||
index fe8a8ee1f88c58a9fe730c4c0cc5fc4e3651e9f8..1c2bead15410adec68f7a9fecb8bc94f8636aeb2 100644 | ||
--- a/src/main/java/net/minecraft/util/profiling/Profiler.java | ||
+++ b/src/main/java/net/minecraft/util/profiling/Profiler.java | ||
@@ -44,6 +44,7 @@ public final class Profiler { | ||
} | ||
|
||
public static ProfilerFiller get() { | ||
+ if (org.leavesmc.leaves.LeavesConfig.disableMethodProfiler) return InactiveProfiler.INSTANCE; // Leaves - disable profiler | ||
return ACTIVE_COUNT.get() == 0 ? getDefaultFiller() : Objects.requireNonNullElseGet(ACTIVE.get(), Profiler::getDefaultFiller); | ||
} | ||
|
39 changes: 0 additions & 39 deletions
39
patches/server/0023-Config-to-disable-method-profiler.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.