9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-22 16:39:22 +00:00
Use Gale as upstream
Update Remove Mojang username check patch
Remove Mikuserver patches (temporarily)
This commit is contained in:
Dreeam
2023-02-10 14:10:24 -05:00
parent 217372c33a
commit 4e079f9662
58 changed files with 323 additions and 8377 deletions

View File

@@ -62,13 +62,13 @@ paperweight {
remapRepo.set("https://maven.fabricmc.net/")
decompileRepo.set("https://maven.quiltmc.org/")
useStandardUpstream("Pufferfish") {
url.set(github("pufferfish-gg", "Pufferfish"))
ref.set(providers.gradleProperty("pufferfishCommit"))
useStandardUpstream("Gale") {
url.set(github("GaleMC", "Gale"))
ref.set(providers.gradleProperty("galeCommit"))
withStandardPatcher {
apiSourceDirPath.set("pufferfish-api")
serverSourceDirPath.set("pufferfish-server")
apiSourceDirPath.set("gale-api")
serverSourceDirPath.set("gale-server")
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Leaf-API"))

View File

@@ -1,7 +1,7 @@
group = org.dreeam.leaf
version = 1.19.3-R0.1-SNAPSHOT
pufferfishCommit = 315157103cc37bf5381cbd19ab43db7f19e6b347
galeCommit = f1503a7be737f1d0c2da33b3138dad4e786541a3
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -5,11 +5,11 @@ Subject: [PATCH] Leaf config files
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2204336d8800311b65e894739ab1b27273e7c6f2..39808c0cc23a97f707366378f28ba64b80e6acbb 100644
index 4c519dbd706cac728f31a7ccd99cc1e165812599..425ee736dbaacc0e633740b27723b9f62007be44 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1971,6 +1971,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
@@ -2014,6 +2014,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Paper end
+ // Leaf start

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..991698f8daff823d64a09c369e1ee8a8b2023478 100644
index e19c9544c346e7f505cfdd379be7f8f059d9e53d..3075ae381824f8b46d17f40022f23d58f9e50c12 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -24,14 +24,14 @@ configurations.api {
@@ -26,16 +26,14 @@ index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..991698f8daff823d64a09c369e1ee8a8
apiAndDocs(platform("net.kyori:adventure-bom:$adventureVersion"))
apiAndDocs("net.kyori:adventure-api")
apiAndDocs("net.kyori:adventure-text-minimessage")
@@ -39,20 +39,20 @@ dependencies {
@@ -39,19 +39,19 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
- api("org.apache.logging.log4j:log4j-api:2.17.1")
- api("org.slf4j:slf4j-api:1.8.0-beta4")
- api("io.sentry:sentry:5.4.0") // Pufferfish
+ api("org.apache.logging.log4j:log4j-api:2.19.0")
+ api("org.slf4j:slf4j-api:1.8.0-beta4") // Leaf TODO - Bump later, need to fix breaking compatibility
+ api("io.sentry:sentry:6.13.0") // Pufferfish
- implementation("org.ow2.asm:asm:9.2")
- implementation("org.ow2.asm:asm-commons:9.2")
@@ -57,7 +55,7 @@ index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..991698f8daff823d64a09c369e1ee8a8
compileOnly(annotations)
testCompileOnly(annotations)
@@ -64,8 +64,8 @@ dependencies {
@@ -63,8 +63,8 @@ dependencies {
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
@@ -68,7 +66,7 @@ index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..991698f8daff823d64a09c369e1ee8a8
}
configure<PublishingExtension> {
@@ -108,9 +108,9 @@ tasks.withType<Javadoc> {
@@ -110,9 +110,9 @@ tasks.withType<Javadoc> {
options.use()
options.isDocFilesSubDirs = true
options.links(
@@ -80,7 +78,7 @@ index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..991698f8daff823d64a09c369e1ee8a8
// Paper start
//"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", // don't link to bungee chat
"https://jd.adventure.kyori.net/api/$adventureVersion/",
@@ -147,6 +147,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.
@@ -152,6 +152,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}

View File

@@ -27,14 +27,13 @@ index ac9b690fcccb60b587e5345f12f1383afd0a73a1..0a4320b32485db84a0be16535b406f04
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 39808c0cc23a97f707366378f28ba64b80e6acbb..8eb8a788dc3dbc0d5ac24089a57c730089fd8dbe 100644
index 425ee736dbaacc0e633740b27723b9f62007be44..236aa2c1841eef6ca723a809b1632894bebf0b67 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2147,4 +2147,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end
+
@@ -2216,4 +2216,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
long getLastTickOversleepTime();
// Gale end - YAPFA - last tick time - API
+ // Purpur start
+ /**
+ * Check if server is lagging according to laggy threshold setting

View File

@@ -24,12 +24,12 @@ index 3b3d9642a8d63798dc28f2f8df77f0466451cbff..8d3605f25e97a375971705c737bc7bac
}
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index c077e7c883613fcb6e559b4e4776e794caa3b363..ba869354adc59db2fc547c481c1ed4d5d0af23b7 100644
index 7903554958f567c7b566a47fa4b49852a837898e..730394fd53fdaa90133ee399f86e76da8ccc08e6 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -656,11 +656,15 @@ public final class SimplePluginManager implements PluginManager {
@Override
public void callEvent(@NotNull Event event) {
@@ -662,11 +662,15 @@ public final class SimplePluginManager implements PluginManager {
// Gale end - JettPack - skip events without listeners
// Paper - replace callEvent by merging to below method
- if (event.isAsynchronous() && server.isPrimaryThread()) {
+ // KTP start - optimize spigot event bus
@@ -43,5 +43,5 @@ index c077e7c883613fcb6e559b4e4776e794caa3b363..ba869354adc59db2fc547c481c1ed4d5
}
+ // KTP end - optimize spigot event bus
HandlerList handlers = event.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners();
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {

View File

@@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Thu, 27 Oct 2022 18:47:33 -0400
Subject: [PATCH] KeYi: Add Java19 Support for SIMD
Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
index ab5fea0b03224bf249352ce340e94704ff713345..42288a065acee7e3181364bfadb26d3c1dc6fdc2 100644
--- a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
@@ -15,7 +15,7 @@ public class SIMDChecker {
@Deprecated
public static boolean canEnable(Logger logger) {
try {
- if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) {
+ if (SIMDDetection.getJavaVersion() < 17) { // KeYi - Add Java19 Support for SIMD
return false;
} else {
SIMDDetection.testRun = true;
@@ -36,5 +36,4 @@ public class SIMDChecker {
} catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
return false;
}
-
}

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c68df5e5cc63b26da8623cf27e257ef07a61897d..17683d888d6aa55dcedaca59951aad011af006ed 100644
index a9f50779740e7fcec98ac8a88742858776a1fe05..ffbdc96d4fad7d603c5510675357ca06e828fb44 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3,6 +3,9 @@ package org.bukkit.entity;
@@ -20,7 +20,7 @@ index c68df5e5cc63b26da8623cf27e257ef07a61897d..17683d888d6aa55dcedaca59951aad01
import com.destroystokyo.paper.ClientOption; // Paper
import com.destroystokyo.paper.Title; // Paper
import net.kyori.adventure.text.Component;
@@ -2946,4 +2949,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2956,4 +2959,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Override
Spigot spigot();
// Spigot end

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/Cryptite/Slice
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 17683d888d6aa55dcedaca59951aad011af006ed..119b97dab3c3477741191a8afdc3b72a0d9bd085 100644
index ffbdc96d4fad7d603c5510675357ca06e828fb44..989563b2cd8318c7d84ea40a5eacd56a22087289 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2809,6 +2809,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2819,6 +2819,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
String getClientBrandName();
// Paper end

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8eb8a788dc3dbc0d5ac24089a57c730089fd8dbe..b4c6a3d57ea21aa9ebc05f6aaf6a1b750b04545c 100644
index 236aa2c1841eef6ca723a809b1632894bebf0b67..3fa5b8740f6c5cbfd55dfc908225301d6d292c0b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -113,6 +113,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -20,10 +20,10 @@ index 8eb8a788dc3dbc0d5ac24089a57c730089fd8dbe..b4c6a3d57ea21aa9ebc05f6aaf6a1b75
/**
* Gets the version of game this server implements
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index ba869354adc59db2fc547c481c1ed4d5d0af23b7..d7064142c0aafbe17af263c4ecad6f1e879bb9d7 100644
index 730394fd53fdaa90133ee399f86e76da8ccc08e6..14d05c364fe11941045e1f24bcc00c0e78d34fe7 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -648,6 +648,8 @@ public final class SimplePluginManager implements PluginManager {
@@ -646,6 +646,8 @@ public final class SimplePluginManager implements PluginManager {
}
private void fireEvent(Event event) { callEvent(event); } // Paper - support old method incase plugin uses reflection
@@ -32,7 +32,7 @@ index ba869354adc59db2fc547c481c1ed4d5d0af23b7..d7064142c0aafbe17af263c4ecad6f1e
/**
* Calls an event with the given details.
*
@@ -666,6 +668,17 @@ public final class SimplePluginManager implements PluginManager {
@@ -672,6 +674,19 @@ public final class SimplePluginManager implements PluginManager {
}
// KTP end - optimize spigot event bus
@@ -47,10 +47,12 @@ index ba869354adc59db2fc547c481c1ed4d5d0af23b7..d7064142c0aafbe17af263c4ecad6f1e
+ }
+
+ private void callEventInternal(Event event) {
HandlerList handlers = event.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners();
@@ -687,7 +700,7 @@ public final class SimplePluginManager implements PluginManager {
+ HandlerList handlers = event.getHandlers();
+ RegisteredListener[] listeners = handlers.getRegisteredListeners();
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {
continue;
@@ -690,7 +705,7 @@ public final class SimplePluginManager implements PluginManager {
plugin.getDescription().getAuthors(),
plugin.getDescription().getFullName(),
ex.getMessage()
@@ -58,4 +60,4 @@ index ba869354adc59db2fc547c481c1ed4d5d0af23b7..d7064142c0aafbe17af263c4ecad6f1e
+ ));
}
} catch (Throwable ex) {
gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
// Paper start - error reporting

View File

@@ -5,679 +5,146 @@ Subject: [PATCH] Rebrand
diff --git a/build.gradle.kts b/build.gradle.kts
index 04a1e3c9619b41f429bd598d55c9e0b5abaff920..c8f031712006d95c59027791be1bdcdc2bd836c4 100644
index e01986477360b1dbe991af6667e726e8ac656246..ff8e0b3ed28ed0c02e436f19945e1b76d2d5333f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins {
}
@@ -9,7 +9,7 @@ plugins {
dependencies {
- implementation(project(":pufferfish-api")) // Pufferfish // Paper
+ implementation(project(":leaf-api")) // Paper // Pufferfish // Leaf
// Pufferfish start
implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") {
// Gale start - project setup
// Depend on own API
- implementation(project(":gale-api"))
+ implementation(project(":leaf-api")) // Leaf
// Depend on Paper MojangAPI
implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
exclude("io.papermc.paper", "paper-api")
@@ -81,7 +81,7 @@ tasks.jar {
@@ -79,7 +79,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Pufferfish-$implementationVersion", // Pufferfish
+ "Implementation-Version" to "git-Leaf-$implementationVersion", // Pufferfish // Leaf
- "Implementation-Version" to "git-Gale-$implementationVersion", // Gale - branding changes
+ "Implementation-Version" to "git-Leaf-$implementationVersion", // Gale - branding changes // Leaf
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..bf670b956b20d670f84f1ef76badaae7f0c20e5b 100644
index e45e6b44b2a8f2cdae6e0048a812b92126aa17ca..b5f3f213da8a40d5184098af017c8e2669c3e58c 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Paper")
+ .appName("Leaf") // Leaf
- .appName("Gale") // Gale - branding changes
+ .appName("Leaf") // Gale - branding changes // Leaf
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 68d16efaf9c2d997afabadcf1ee24c5de685b5b3..c69cb21f2ccf0f93a7ec17d4ee1ddb0ba5cfa5b2 100644
index fe702a042cb132987e5135d2ed855484f9cef686..51704170ca171440e198a51b7fba563dca8debb6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -924,7 +924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) {
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER)");
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO LEAF)"); // Leaf
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
try {
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1027,7 +1027,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER - If you think this is a Gale bug, please report it at https://github.com/GaleMC/Gale/issues )");
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER - If you think this is a Leaf bug, please report it at https://github.com/Winds-Studio/Leaf/issues )"); // Leaf
// Gale end - branding changes
// Gale start - base thread pool
while (serverThread.isAlive()) {
@@ -1857,7 +1857,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
@DontObfuscate
public String getServerModName() {
- return "Pufferfish"; // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Leaf"; // Leaf - Leaf > // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
- return "Gale"; // Gale - branding changes - Gale > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Leaf"; // Leaf - Leaf > // Gale - branding changes - Gale > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 277e8a03ab270eabb6b8c31d0076f3310c91eef2..07b40f503358987339937bb8db5a3ee54c1b08c8 100644
index a7bb3275b2da8308696b18fb527514f9c4859d35..7b92f58c01234ef44cfe5d2e0806a7718f0e61d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Pufferfish"; // Paper // Pufferfish
+ private final String serverName = "Leaf"; // Paper // Pufferfish // Leaf
- private final String serverName = "Gale"; // Paper // Gale - branding changes
+ private final String serverName = "Leaf"; // Paper // Gale - branding changes // Leaf
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index cdefb2025eedea7e204d70d568adaf1c1ec4c03c..38920d680d9b0d81013dcf16ce3dd7271eeafe4c 100644
index 3997a7fec43e05b455644b4d58c68995fad541f4..1933207eb01305ff41822560c5987376b366133f 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -504,7 +504,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
//this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Leaf"); // Paper // Leaf
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Gale"); // Paper // Gale - branding changes
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Leaf"); // Paper // Gale - branding changes // Leaf
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 80553face9c70c2a3d897681e7761df85b22d464..3e14c02c2ed3d687c866087bf7477918f45e3719 100644
index 0b5979723bb30f9011ac64c36d894aa41713ec9b..17e3ee3a73a2347e9f0baa0ed1640a3b0e75ed16 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/gg.pufferfish.pufferfish/pufferfish-api/pom.properties"); // Pufferfish
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.dreeam.leaf/leaf-api/pom.properties"); // Pufferfish // Leaf
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.galemc.gale/gale-api/pom.properties"); // Gale - branding changes
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.dreeam.leaf/leaf-api/pom.properties"); // Gale - branding changes // Leaf
Properties properties = new Properties();
if (stream != null) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index e9fa7faaa4451e36b3908cbcbbe0baf213abde96..6466e8bd54b38e4f432101c6d1a397db1066d341 100644
index bcb144ec4a836b8b32f60726bcbee218a4f62742..9ab8f897471258383623cfe3ca9ff591ca40a56a 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -155,14 +155,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Leaf bug." ); // Paper // Leaf
@@ -161,15 +161,15 @@ public final class WatchdogThread extends ServerThread // Paper - rewrite chunk
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug. This could be a Gale bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug. This could be a Leaf bug." ); // Paper // Leaf
// Gale end - branding changes
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" );
+ log.log( Level.SEVERE, "If you are unsure or still think this is a Leaf bug, please report this to https://github.com/Winds-Studio/Leaf/issues" ); // Leaf
- log.log( Level.SEVERE, "If you are unsure or think this is a Gale bug, please report this to https://github.com/GaleMC/Gale/issues - and if you think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" ); // Gale - branding changes
+ log.log( Level.SEVERE, "If you are unsure or think this is a Leaf bug, please report this to https://github.com/Winds-Studio/Leaf/issues - and if you think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" ); // Gale - branding changes // Leaf
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "Leaf version: " + Bukkit.getServer().getVersion() ); // Leaf
- log.log( Level.SEVERE, "Gale version: " + Bukkit.getServer().getVersion() ); // Gale - branding changes
+ log.log( Level.SEVERE, "Leaf version: " + Bukkit.getServer().getVersion() ); // Gale - branding changes // Leaf
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -185,12 +185,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO LEAF - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Leaf
@@ -197,13 +197,13 @@ public final class WatchdogThread extends ServerThread // Paper - rewrite chunk
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Gale bug, please report it at https://github.com/GaleMC/Gale/issues - THIS IS NOT A PAPER BUG OR CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Leaf bug, please report it at https://github.com/Winds-Studio/Leaf/issues - THIS IS NOT A PAPER BUG OR CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Leaf
// Gale end - branding changes
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Leaf!):" ); // Paper // Leaf
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Gale!):" ); // Paper // Gale - branding changes
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Leaf!):" ); // Paper // Gale - branding changes // Leaf
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -206,7 +206,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
WatchdogThread.dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO LEAF - THIS IS NOT A BUG OR A CRASH ---"); // Leaf
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.serverThread.getId(), Integer.MAX_VALUE ), log ); // Gale - base thread pool
@@ -224,7 +224,7 @@ public final class WatchdogThread extends ServerThread // Paper - rewrite chunk
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Gale bug, please report it at https://github.com/GaleMC/Gale/issues - THIS IS NOT A PAPER BUG OR CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Leaf bug, please report it at https://github.com/Winds-Studio/Leaf/issues - THIS IS NOT A PAPER BUG OR CRASH ---"); // Leaf
// Gale end - branding changes
}
log.log( Level.SEVERE, "------------------------------" );
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
index a7d785f60c884ee4ee487cc364402d66c3dc2ecc..9597d58066bdbca302d790e6c195204b7d878011 100644
GIT binary patch
literal 13210
zcmc&)1ydY6w_ae;A`29^#oe{ITXBjPcXzkNDekVtin|vp?oNTl-QBJC{eH#G%*mO^
z#Lgr+^88Ryl0icuL;(N*XmYZWYX9+({}B@0e|c88LDhc@Xep*B1_0E@e|j^92LMpy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mng$hYBii+&ZqedxWT0<Y>dnV#LG4zC%+kzcK+-??vEHT>Q-T8zu<!_QuSc
WX&3$!%>|s_1IbA#OV)^+1pg1OmmZn`

View File

@@ -4,42 +4,73 @@ Date: Wed, 12 Oct 2022 10:42:15 -0400
Subject: [PATCH] Leaf Config
diff --git a/build.gradle.kts b/build.gradle.kts
index ff8e0b3ed28ed0c02e436f19945e1b76d2d5333f..038ea85f4c9c1fcd0c4d3127944dfc81ed831d4f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -48,6 +48,13 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+ // Pufferfish start
+ implementation("org.yaml:snakeyaml:1.33")
+ implementation("me.carleslc.Simple-YAML:Simple-Yaml:1.8.3") {
+ exclude(group = "org.yaml", module = "snakeyaml")
+ }
+ // Pufferfish end
+
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 2cc44fbf8e5bd436b6d4e19f6c06b351e750cb31..00f30e047beefe914543718009947ecc60c21790 100644
index 781fc0a92f73be73b9313e7bc4eeb2f2ed6ff8ea..b40c03e42e02bca29fe8b107d9382db6e49c1d1e 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -242,7 +242,8 @@ public class TimingsExport extends Thread {
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
@@ -307,8 +307,9 @@ public class TimingsExport extends Thread {
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Pufferfish
- pair("pufferfish", mapAsJSON(gg.pufferfish.pufferfish.PufferfishConfig.getConfigCopy(), null)) // Pufferfish
+ pair("pufferfish", mapAsJSON(gg.pufferfish.pufferfish.PufferfishConfig.getConfigCopy(), null)), // Pufferfish
// Gale start - Gale configuration - include in timings
pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)),
- pair("gale", mapAsJSON(Bukkit.spigot().getGaleConfig(), null))
+ pair("gale", mapAsJSON(Bukkit.spigot().getGaleConfig(), null)),
// Gale end - Gale configuration - include in timings
+ pair("leaf", mapAsJSON(org.dreeam.leaf.LeafConfig.getConfigCopy(), null)) // Leaf
));
new TimingsExport(listeners, parent, history).start();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c69cb21f2ccf0f93a7ec17d4ee1ddb0ba5cfa5b2..3bed5eb755e97149a9651ca007564275e0eaf2d1 100644
index 51704170ca171440e198a51b7fba563dca8debb6..108245311279757c17b543b8bb0fcafd31c5eaf8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1857,7 +1857,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
@DontObfuscate
public String getServerModName() {
- return "Leaf"; // Leaf - Leaf > // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return org.dreeam.leaf.LeafConfig.serverModName; // Leaf - Leaf > // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
- return "Leaf"; // Leaf - Leaf > // Gale - branding changes - Gale > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return org.dreeam.leaf.LeafConfig.serverModName; // Leaf - Leaf > // Gale - branding changes - Gale > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 673fb3955291407be37dc78be4eec9bf2018128b..a7023765e3c82e70574069af00227e3cf6f98e65 100644
index b49b2fe152b70c8020ba2edc48d46cc4fe8d525e..9eee6da2d5eb3cce22ab0b7fc842485503d03070 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -223,6 +223,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -227,6 +227,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
// Paper end
gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
+<<<<<<< HEAD
// Gale start - CPU core estimation
if (GaleGlobalConfiguration.get().logToConsole.cpuCoresEstimation) {
@@ -247,6 +248,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
LOGGER.warn("If you would like to disable this message, set simd.warn-if-disabled to false in gale-global.yml");
}
// Gale start - Pufferfish - SIMD support
+=======
+ gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
+ gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
+ org.dreeam.leaf.LeafConfig.load(); // Leaf
+>>>>>>> Leaf Config
this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);

View File

@@ -5,25 +5,19 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index b52c4f00f4a10c0f748182e39c9c1daeb0c4904b..6e7ff4c213a05d0858c057cd1d81f0de77e3d926 100644
index 038ea85f4c9c1fcd0c4d3127944dfc81ed831d4f..cc4c8d671a27c5cca17f2881603099e14c86c232 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,12 +9,12 @@ plugins {
dependencies {
implementation(project(":leaf-api")) // Paper // Pufferfish // Leaf
// Pufferfish start
- implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") {
+ implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
exclude("io.papermc.paper", "paper-api")
}
// Pufferfish end
@@ -17,7 +17,7 @@ dependencies {
// Gale end - project setup
implementation("io.projectreactor.tools:blockhound:1.0.7.RELEASE") // Gale - base thread pool - watch for blocking base threads
// Paper start
- implementation("org.jline:jline-terminal-jansi:3.21.0")
+ implementation("org.jline:jline-terminal-jansi:3.22.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
/*
Required to add the missing Log4j2Plugins.dat file from log4j-core
@@ -22,40 +22,40 @@ dependencies {
@@ -25,28 +25,28 @@ dependencies {
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
@@ -61,14 +55,10 @@ index b52c4f00f4a10c0f748182e39c9c1daeb0c4904b..6e7ff4c213a05d0858c057cd1d81f0de
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") // Leaf TODO - Bump later, need to fix breaking compatibility
// Pufferfish start
- implementation("org.yaml:snakeyaml:1.32")
- implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.2") {
+ implementation("org.yaml:snakeyaml:1.33")
+ implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.3") {
exclude(group="org.yaml", module="snakeyaml")
implementation("org.yaml:snakeyaml:1.33")
@@ -55,9 +55,9 @@ dependencies {
}
// Pufferfish end
implementation("com.github.technove:Flare:34637f3f87") // Pufferfish - flare
- testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
+ testImplementation("io.github.classgraph:classgraph:4.8.154") // Paper - mob goal test
@@ -78,7 +68,7 @@ index b52c4f00f4a10c0f748182e39c9c1daeb0c4904b..6e7ff4c213a05d0858c057cd1d81f0de
implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
}
@@ -206,3 +206,6 @@ tasks.registerRunTask("runDev") {
@@ -214,3 +214,6 @@ tasks.registerRunTask("runDev") {
description = "Spin up a non-relocated Mojang-mapped test server"
classpath(sourceSets.main.map { it.runtimeClasspath })
}

View File

@@ -5,26 +5,30 @@ Subject: [PATCH] Remove Mojang username check
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index f3b340fc6be9878d677a76673450aac3e0b73d4b..3011018c8fa221f515cf670dea9791f8c4ea1f69 100644
index 9b924f0793d8231244c160a5bc7ac8e1a35bad34..0057ccf67eeff26330753cb769db0532063d8d5d 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -36,6 +36,7 @@ import net.minecraft.util.Crypt;
@@ -37,6 +37,7 @@ import net.minecraft.util.Crypt;
import net.minecraft.util.CryptException;
import net.minecraft.util.RandomSource;
import org.apache.commons.lang3.Validate;
+import org.dreeam.leaf.LeafConfig;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.slf4j.Logger;
// CraftBukkit start
@@ -237,7 +238,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Override
@@ -243,10 +244,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
public void handleHello(ServerboundHelloPacket packet) {
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]);
+ if (!LeafConfig.removeMojangUsernameCheck) Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // Leaf - Remove Mojang's username check
// Gale start - JettPack - reduce array allocations
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", ArrayConstants.emptyObjectArray);
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", ArrayConstants.emptyObjectArray);
+ if (!LeafConfig.removeMojangUsernameCheck) Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", ArrayConstants.emptyObjectArray); // Leaf - Remove Mojang's username check
// Gale end - JettPack - reduce array allocations
// Paper start - validate usernames
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation || !LeafConfig.removeMojangUsernameCheck) { // Leaf - Remove Mojang's username check
if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) {
ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!");
return;
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 770553ef8976d76067396276792ea23a7ab7d51d..7870c85030144831936d692dde4fff7bedd692da 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Remove Spigot Check for Broken BungeeCord Configurations
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index e7ff7ad3bf4dd17fdd34202ec3aef8e9512bc36d..a00c7ba6d2161ce91ade78e3d53c8d57f86e9c99 100644
index 8e68d1373a519cc12bf83de6aadcb24cbbd34af6..a5776ef739b1bf8c8efed0a97d0939e271c8ba72 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -9,6 +9,7 @@ import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
@@ -10,6 +10,7 @@ import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
import net.minecraft.network.protocol.handshake.ServerHandshakePacketListener;
import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket;
import net.minecraft.server.MinecraftServer;
@@ -16,7 +16,7 @@ index e7ff7ad3bf4dd17fdd34202ec3aef8e9512bc36d..a00c7ba6d2161ce91ade78e3d53c8d57
// CraftBukkit start
import java.net.InetAddress;
@@ -139,7 +140,9 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -135,7 +136,9 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
{
connection.spoofedProfile = ServerHandshakePacketListenerImpl.gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class);
}

View File

@@ -7,18 +7,18 @@ This Check is added in 1.17.x -> 1.18.x update by Mojang.
By removing this check, it enable hackers to use some modules of hack clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 34540b4ebad2ec430fa12e1e5d9d6e4a79df91de..84cb548e89350d9127b18f69e47d1f7433bcb1ee 100644
index 93a533bdeb5108f5c3e758f8062de083283fd075..5a656751b101d914afd5b07d70e60b50009ed215 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -182,6 +182,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -188,6 +188,7 @@ import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.executor.queue.BaseTaskQueues;
import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues;
+import org.dreeam.leaf.LeafConfig;
import org.slf4j.Logger;
// CraftBukkit start
@@ -1948,7 +1949,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1979,7 +1980,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Vec3 vec3d2 = vec3d.subtract(vec3d1);
double d0 = 1.0000001D;

View File

@@ -19,32 +19,6 @@ index 0c5caad2a5bfc14450cf8d37f988ee176e8d1450..05a0a890a719a957d9aea736d6c0e85b
this.setVariant(holder);
this.direction = Direction.from2DDataValue(nbt.getByte("facing"));
super.readAdditionalSaveData(nbt);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
index 5956a7759964f5e4939f062e93714fba64f53141..0ca82175ec91ca8b3418c0931682c972666c47f8 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
@@ -182,7 +182,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase {
@Override
public Brain<Zoglin> getBrain() {
- return super.getBrain();
+ return (Brain<Zoglin>) super.getBrain(); // Purpur - decompile error
}
protected void updateActivity() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
index ac75c54e897565e340b66823caeed92ba1d1641a..769e4fbaac01a4fe3a45bd9cab5c63b61fc69f53 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -70,7 +70,7 @@ public class PiglinBrute extends AbstractPiglin {
@Override
public Brain<PiglinBrute> getBrain() {
- return super.getBrain();
+ return (Brain<PiglinBrute>) super.getBrain(); // Purpur - decompile error
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
index 42f46d338886e2892ee4219d19be4dc97f61616f..fdd3aa81644087bff33a47c5f98e14ca0452f3ef 100644
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java

View File

@@ -54,10 +54,10 @@ index ae5dd08de75a7ed231295f306fd0974da3988249..b8d49f7607c646216d42f4e047997d47
if (this.source.acceptsSuccess() && !this.silent) {
this.source.sendSystemMessage(message);
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 330f6c79417378da855326b4da665f9d240e748d..564830a1d511716ab977923ba43fa38c475f484f 100644
index c7083450b3466d80611b5efdac78b31ac2e70cf5..0e8700ccc884957f08fa382723a3784d94da0f0e 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -215,6 +215,7 @@ public class Commands {
@@ -214,6 +214,7 @@ public class Commands {
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
StopCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
@@ -66,10 +66,10 @@ index 330f6c79417378da855326b4da665f9d240e748d..564830a1d511716ab977923ba43fa38c
if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3bed5eb755e97149a9651ca007564275e0eaf2d1..ab0a4a36241bee59b142df65736003c69dcb3dd4 100644
index 108245311279757c17b543b8bb0fcafd31c5eaf8..590d697eb0b1e61d3b910ac5276598e6428189fe 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1022,6 +1022,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1127,6 +1127,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
this.safeShutdown(waitForShutdown, false);
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
@@ -78,30 +78,50 @@ index 3bed5eb755e97149a9651ca007564275e0eaf2d1..ab0a4a36241bee59b142df65736003c6
this.hasLoggedStop = true; // Paper
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a7023765e3c82e70574069af00227e3cf6f98e65..598d0200c055ef357a0a0d8857ce740d0bff9bae 100644
index 9eee6da2d5eb3cce22ab0b7fc842485503d03070..ae0c0c984c512b68a3e48d39743cd41b35674ce7 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -50,6 +50,7 @@ import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import net.minecraft.world.level.storage.LevelStorageSource;
@@ -51,6 +51,7 @@ import org.galemc.gale.command.GaleCommands;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.executor.thread.OriginalServerThread;
import org.galemc.gale.util.CPUCoresEstimation;
+import org.dreeam.leaf.tasks.BossBarTask;
import org.slf4j.Logger;
// CraftBukkit start
@@ -336,6 +337,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -227,7 +228,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
// Paper end
-<<<<<<< HEAD
// Gale start - CPU core estimation
if (GaleGlobalConfiguration.get().logToConsole.cpuCoresEstimation) {
@@ -248,11 +248,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
LOGGER.warn("If you would like to disable this message, set simd.warn-if-disabled to false in gale-global.yml");
}
// Gale start - Pufferfish - SIMD support
-=======
- gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
- gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
org.dreeam.leaf.LeafConfig.load(); // Leaf
->>>>>>> Leaf Config
this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
@@ -364,6 +360,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.info("JMX monitoring enabled");
}
if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish
+ BossBarTask.startAll(); // Purpur
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7d6d3c8556033d289fdadc489e73fba478fce41a..d4ae8fc06ac5931273e6ced45158d8a3144a0bdf 100644
index e6c2eff84ac596825a11574cf89956e70a344562..66082298aea31d17c8e9a85e3cca1951b2d53f87 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -268,6 +268,7 @@ public class ServerPlayer extends Player {
@@ -269,6 +269,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@@ -109,7 +129,7 @@ index 7d6d3c8556033d289fdadc489e73fba478fce41a..d4ae8fc06ac5931273e6ced45158d8a3
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -506,6 +507,7 @@ public class ServerPlayer extends Player {
@@ -507,6 +508,7 @@ public class ServerPlayer extends Player {
}
}
@@ -117,7 +137,7 @@ index 7d6d3c8556033d289fdadc489e73fba478fce41a..d4ae8fc06ac5931273e6ced45158d8a3
}
@Override
@@ -572,6 +574,7 @@ public class ServerPlayer extends Player {
@@ -573,6 +575,7 @@ public class ServerPlayer extends Player {
}
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -125,7 +145,7 @@ index 7d6d3c8556033d289fdadc489e73fba478fce41a..d4ae8fc06ac5931273e6ced45158d8a3
}
// CraftBukkit start - World fallback code, either respawn location or global spawn
@@ -2548,4 +2551,14 @@ public class ServerPlayer extends Player {
@@ -2551,4 +2554,14 @@ public class ServerPlayer extends Player {
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
@@ -141,26 +161,26 @@ index 7d6d3c8556033d289fdadc489e73fba478fce41a..d4ae8fc06ac5931273e6ced45158d8a3
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4b754f6eae683248d7fe11d6d6cb168d5dd696a2..866042589daa1d3e85645293375bd1dfc34c1982 100644
index 0cbef825129b173a5244a195ea68444c216c0b1b..56a585f9b05e7b38900899be2fe439ac20205bc8 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -100,6 +100,7 @@ import net.minecraft.world.scores.Objective;
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.scores.Scoreboard; // Paper
@@ -105,6 +105,7 @@ import net.minecraft.world.scores.Scoreboard; // Paper
import net.minecraft.world.scores.Team;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues;
+import org.dreeam.leaf.tasks.BossBarTask;
import org.slf4j.Logger;
// CraftBukkit start
@@ -455,6 +456,7 @@ public abstract class PlayerList {
@@ -521,6 +522,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end
+ BossBarTask.addToAll(player); // Purpur
// CraftBukkit - Moved from above, added world
if (GaleGlobalConfiguration.get().logToConsole.playerLoginLocations) { // Gale - JettPack - make logging login location configurable
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
}
@@ -564,6 +566,8 @@ public abstract class PlayerList {
@@ -636,6 +638,8 @@ public abstract class PlayerList {
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
// Paper end

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 564830a1d511716ab977923ba43fa38c475f484f..2c5afab3cc0c66a2e63c1f647a033ca1a58f9e39 100644
index 0e8700ccc884957f08fa382723a3784d94da0f0e..66242833210ae89cbca7448cd4e7cf1fa774bcf0 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -216,6 +216,7 @@ public class Commands {
@@ -215,6 +215,7 @@ public class Commands {
StopCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
org.dreeam.leaf.commands.TPSBarCommand.register(this.dispatcher); // Purpur
@@ -19,10 +19,10 @@ index 564830a1d511716ab977923ba43fa38c475f484f..2c5afab3cc0c66a2e63c1f647a033ca1
if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d4ae8fc06ac5931273e6ced45158d8a3144a0bdf..336691038e2b1a68e1cd40d7015d42acceb2b069 100644
index 66082298aea31d17c8e9a85e3cca1951b2d53f87..d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -269,6 +269,7 @@ public class ServerPlayer extends Player {
@@ -270,6 +270,7 @@ public class ServerPlayer extends Player {
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
private boolean tpsBar = false; // Purpur
@@ -30,7 +30,7 @@ index d4ae8fc06ac5931273e6ced45158d8a3144a0bdf..336691038e2b1a68e1cd40d7015d42ac
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -508,6 +509,7 @@ public class ServerPlayer extends Player {
@@ -509,6 +510,7 @@ public class ServerPlayer extends Player {
}
if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
@@ -38,7 +38,7 @@ index d4ae8fc06ac5931273e6ced45158d8a3144a0bdf..336691038e2b1a68e1cd40d7015d42ac
}
@Override
@@ -575,6 +577,7 @@ public class ServerPlayer extends Player {
@@ -576,6 +578,7 @@ public class ServerPlayer extends Player {
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
@@ -46,7 +46,7 @@ index d4ae8fc06ac5931273e6ced45158d8a3144a0bdf..336691038e2b1a68e1cd40d7015d42ac
}
// CraftBukkit start - World fallback code, either respawn location or global spawn
@@ -2560,5 +2563,13 @@ public class ServerPlayer extends Player {
@@ -2563,5 +2566,13 @@ public class ServerPlayer extends Player {
public void tpsBar(boolean tpsBar) {
this.tpsBar = tpsBar;
}

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 2c5afab3cc0c66a2e63c1f647a033ca1a58f9e39..8ee8ff15f4511684261ff7a9417baa2ccd313b69 100644
index 66242833210ae89cbca7448cd4e7cf1fa774bcf0..ff19fcd83295c6936dd83c7780d5757071ca44a5 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -217,6 +217,8 @@ public class Commands {
@@ -216,6 +216,8 @@ public class Commands {
WhitelistCommand.register(this.dispatcher);
org.dreeam.leaf.commands.TPSBarCommand.register(this.dispatcher); // Purpur
org.dreeam.leaf.commands.CompassCommand.register(this.dispatcher); // Purpur
@@ -20,10 +20,10 @@ index 2c5afab3cc0c66a2e63c1f647a033ca1a58f9e39..8ee8ff15f4511684261ff7a9417baa2c
if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 336691038e2b1a68e1cd40d7015d42acceb2b069..cdcd1358ab8781c261c97aec03bb96118eb577f7 100644
index d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039..1b92480529c4436efe3d3b293a7af1fa95457a9d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -270,6 +270,7 @@ public class ServerPlayer extends Player {
@@ -271,6 +271,7 @@ public class ServerPlayer extends Player {
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
private boolean tpsBar = false; // Purpur
private boolean compassBar = false; // Purpur
@@ -31,7 +31,7 @@ index 336691038e2b1a68e1cd40d7015d42acceb2b069..cdcd1358ab8781c261c97aec03bb9611
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -508,6 +509,7 @@ public class ServerPlayer extends Player {
@@ -509,6 +510,7 @@ public class ServerPlayer extends Player {
}
}
@@ -39,7 +39,7 @@ index 336691038e2b1a68e1cd40d7015d42acceb2b069..cdcd1358ab8781c261c97aec03bb9611
if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
if (nbt.contains("Purpur.CompassBar")) { this.compassBar = nbt.getBoolean("Purpur.CompassBar"); } // Purpur
}
@@ -576,6 +578,7 @@ public class ServerPlayer extends Player {
@@ -577,6 +579,7 @@ public class ServerPlayer extends Player {
}
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -47,7 +47,7 @@ index 336691038e2b1a68e1cd40d7015d42acceb2b069..cdcd1358ab8781c261c97aec03bb9611
nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
nbt.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur
}
@@ -2571,5 +2574,14 @@ public class ServerPlayer extends Player {
@@ -2574,5 +2577,14 @@ public class ServerPlayer extends Player {
public void compassBar(boolean compassBar) {
this.compassBar = compassBar;
}

View File

@@ -7,18 +7,18 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ab0a4a36241bee59b142df65736003c69dcb3dd4..411fae7132b1d1763712594a18cff10d612cef7e 100644
index 590d697eb0b1e61d3b910ac5276598e6428189fe..fe25f51ee708c76bcf66e3280bb235713c99f79c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -305,6 +305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot end
@@ -404,6 +404,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
public final GaleConfigurations galeConfigurations; // Gale - Gale configuration
public static long currentTickLong = 0L; // Paper
+ public boolean lagging = false; // Purpur
public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
@@ -1159,6 +1160,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1272,6 +1273,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
this.recentTps[1] = tps5.getAverage();
this.recentTps[2] = tps15.getAverage();
// Paper end
@@ -27,14 +27,13 @@ index ab0a4a36241bee59b142df65736003c69dcb3dd4..411fae7132b1d1763712594a18cff10d
}
// Spigot end
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dde6e4d4f64792e8815eb302fda49b6afa0030a1..96cde1f86ca073e7e9e5799bcb12a10adf9230b2 100644
index 7b92f58c01234ef44cfe5d2e0806a7718f0e61d8..28962c1d1881db69b7ae83413a73eff141bddde3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2943,4 +2943,11 @@ public final class CraftServer implements Server {
@@ -3001,4 +3001,10 @@ public final class CraftServer implements Server {
}
// Gale end - YAPFA - last tick time - API
// Paper end
+
+ // Purpur start
+ @Override
+ public boolean isLagging() {

View File

@@ -7,13 +7,13 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 411fae7132b1d1763712594a18cff10d612cef7e..75daffc4eaa831708f1ccfa5370ddf1871998033 100644
index fe25f51ee708c76bcf66e3280bb235713c99f79c..1f3f414ede558f590a5e68256a60d9ca3c3edf32 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1179,6 +1179,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
@@ -1285,6 +1285,13 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
this.tickServer(this::haveTime);
lastTickProperTime = (System.nanoTime() - tickProperStart) / 1000000L; // Gale - YAPFA - last tick time
this.setDelayedTasksMaxNextTickTime(Math.max(Util.getMillis() + 50L, this.nextTickTime)); // Gale - base thread pool
+ // Purpur start - tps catchup
+ if (org.dreeam.leaf.LeafConfig.tpsCatchup) {
+ this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
@@ -22,8 +22,8 @@ index 411fae7132b1d1763712594a18cff10d612cef7e..75daffc4eaa831708f1ccfa5370ddf18
+ }
+ // Purpur end - tps catchup
this.waitUntilNextTick();
this.profiler.pop();
this.endMetricsRecordingTick();
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index a723d5a6bb69543072b8e9a7082ba3f0e89d453e..66092bc87472278898743971dd80244cb750297e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java

View File

@@ -29,10 +29,10 @@ index 5c6aa9c464784ad5ee366412d080c72d3d22a76f..35d819aa2e660263cf6a5a0c09a6e73f
return true;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index edd2c236ca7c37e1a3aec0048b8974f4cd62f2cc..62aff29485f124880739e7d2b5fb0d8a9d957741 100644
index 0ab14271e6efebe49ed9fec904e47566691b9f40..b5e887258bee7de80a9b1d06da030b1d7d07ddc6 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1635,4 +1635,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1616,4 +1616,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null;
}
// Paper end

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index a0c19503aabab5378d672a30163d35a5ba05b6c1..0b089a2032d468532a40e81cb0e9eda4cf184ad0 100644
index 5ba0a756d45350dcda3caa5518c9a47a4de06f14..e438597242adc99e88f465231a043ea25eec4ba1 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -297,6 +297,7 @@ public class PlayerAdvancements {
@@ -298,6 +298,7 @@ public class PlayerAdvancements {
advancement.getRewards().grant(this.player);
// Paper start - Add Adventure message to PlayerAdvancementDoneEvent
if (message != null && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
@@ -19,10 +19,10 @@ index a0c19503aabab5378d672a30163d35a5ba05b6c1..0b089a2032d468532a40e81cb0e9eda4
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index cdcd1358ab8781c261c97aec03bb96118eb577f7..d46f33d9bc99484297270f88e68c1519922cb7db 100644
index 1b92480529c4436efe3d3b293a7af1fa95457a9d..2c2262a2babd4fd5ca22b4630c1f0ae5e3a1a9ab 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -947,6 +947,7 @@ public class ServerPlayer extends Player {
@@ -948,6 +948,7 @@ public class ServerPlayer extends Player {
}));
Team scoreboardteambase = this.getTeam();
@@ -30,7 +30,7 @@ index cdcd1358ab8781c261c97aec03bb96118eb577f7..d46f33d9bc99484297270f88e68c1519
if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != Team.Visibility.ALWAYS) {
if (scoreboardteambase.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent);
@@ -1747,6 +1748,26 @@ public class ServerPlayer extends Player {
@@ -1744,6 +1745,26 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -58,10 +58,10 @@ index cdcd1358ab8781c261c97aec03bb96118eb577f7..d46f33d9bc99484297270f88e68c1519
public void displayClientMessage(Component message, boolean overlay) {
this.sendSystemMessage(message, overlay);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 866042589daa1d3e85645293375bd1dfc34c1982..d63a020733e1274d9cc87df13b4b50d36b006629 100644
index 56a585f9b05e7b38900899be2fe439ac20205bc8..fb1bf9dd162ae7105df6ff20724be72768c60d0f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1017,6 +1017,20 @@ public abstract class PlayerList {
@@ -1131,6 +1131,20 @@ public abstract class PlayerList {
}
// CraftBukkit end
@@ -103,10 +103,10 @@ index 2848cb7c76e94d8349f042dc92daf01322a6ce5a..0edf0e24b0b311269b447a34f3aad485
return this.isFireSource;
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3073b34a0e0281b6b0330721bb0440147de28511..ebc7034d68a1c732ba5b89c95e79660d5505a74c 100644
index ce197df36b3746dbd511287ecd78e46eaec3d5e0..b439a6033223269c94e988069c0df3ad6ba5da28 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3863,6 +3863,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3877,6 +3877,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return SlotAccess.NULL;
}

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d63a020733e1274d9cc87df13b4b50d36b006629..e1a60b9e380448e1594516ec078e89cc7f74db2a 100644
index fb1bf9dd162ae7105df6ff20724be72768c60d0f..94f3d84a1a89e1f1c720d6e7f19e93b1b0b5a865 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -721,7 +721,7 @@ public abstract class PlayerList {
@@ -794,7 +794,7 @@ public abstract class PlayerList {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
} else {
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;

View File

@@ -1,79 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Mon, 13 Sep 2021 04:48:21 +0200
Subject: [PATCH] Purpur: Halloween options and optimizations
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index 1572a81ce1718964d795f2a2a411402f88901c73..ae2c84af8baaf1bba9b0debe3774321417d77413 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -246,7 +246,7 @@ public class Bat extends AmbientCreature {
int i = world.getMaxLocalRawBrightness(pos);
byte b0 = 4;
- if (Bat.isHalloween()) {
+ if (Bat.isHalloweenSeason(world.getMinecraftWorld())) { // Purpur
b0 = 7;
} else if (random.nextBoolean()) {
return false;
@@ -260,6 +260,7 @@ public class Bat extends AmbientCreature {
private static boolean isSpookySeason = false;
private static final int ONE_HOUR = 20 * 60 * 60;
private static int lastSpookyCheck = -ONE_HOUR;
+ public static boolean isHalloweenSeason(Level level) { return org.dreeam.leaf.LeafConfig.forceHalloweenSeason || isHalloween(); } // Purpur
private static boolean isHalloween() {
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
LocalDate localdate = LocalDate.now();
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index b8abee145fc92faddef98da913eca7715b6bfc03..41de63fdcfe48c2a77f2d04e5bffbca41c98afe3 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -158,11 +158,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
this.reassessWeaponGoal();
this.setCanPickUpLoot(this.level.paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
- LocalDate localdate = LocalDate.now();
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
-
- if (j == 10 && i == 31 && randomsource.nextFloat() < 0.25F) {
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(world.getMinecraftWorld()) && this.random.nextFloat() < org.dreeam.leaf.LeafConfig.chanceHeadHalloweenOnEntity) { // Purpur
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(randomsource.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 9976205537cfe228735687f1e9c52c74ac025690..dfe4c6d2bf9bee2e019635d02f01dc08f99c160e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -559,11 +559,7 @@ public class Zombie extends Monster {
}
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
- LocalDate localdate = LocalDate.now();
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
-
- if (j == 10 && i == 31 && randomsource.nextFloat() < 0.25F) {
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(world.getMinecraftWorld()) && this.random.nextFloat() < org.dreeam.leaf.LeafConfig.chanceHeadHalloweenOnEntity) { // Purpur
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(randomsource.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 040c1f584c525990ec844cba9f01df5b33fa2a37..2855f8c4684cb9afee1bd8a4c2ae82d45ef1ea2b 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -256,4 +256,11 @@ public class LeafConfig {
advancementOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.advancement.only-broadcast-to-affected-player", advancementOnlyBroadcastToAffectedPlayer);
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
}
+
+ public static boolean forceHalloweenSeason = false;
+ public static float chanceHeadHalloweenOnEntity = 0.25F;
+ private static void halloweenSetting() {
+ forceHalloweenSeason = getBoolean("gameplay-mechanics.halloween.force", forceHalloweenSeason);
+ chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
+ }
}

View File

@@ -40,10 +40,10 @@ index b0204af850ee182773ad458208cccd946ad148d5..f74e420b1791df528a30a1213bb0076b
@Nullable
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 7b71073027f4cf79736546500ededdfbb83d968e..98c9c1899a311e76179f72fa1c43830fb5b9c521 100644
index 39981cd0003eb7ee416d887ffec70fb049599320..a5a1773109123c3499d6b2b02b76805d66764ec5 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -63,6 +63,13 @@ import net.minecraft.world.phys.shapes.Shapes;
@@ -65,6 +65,13 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.slf4j.Logger;
@@ -57,7 +57,7 @@ index 7b71073027f4cf79736546500ededdfbb83d968e..98c9c1899a311e76179f72fa1c43830f
public class Block extends BlockBehaviour implements ItemLike {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -325,7 +332,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -328,7 +335,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
if (world instanceof ServerLevel) {
Block.getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> {
@@ -66,7 +66,7 @@ index 7b71073027f4cf79736546500ededdfbb83d968e..98c9c1899a311e76179f72fa1c43830f
});
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
}
@@ -341,7 +348,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -344,7 +351,7 @@ public class Block extends BlockBehaviour implements ItemLike {
io.papermc.paper.event.block.BlockBreakBlockEvent event = new io.papermc.paper.event.block.BlockBreakBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.block.CraftBlock.at(world, source), items);
event.callEvent();
for (var drop : event.getDrops()) {
@@ -75,7 +75,7 @@ index 7b71073027f4cf79736546500ededdfbb83d968e..98c9c1899a311e76179f72fa1c43830f
}
state.spawnAfterBreak(world.getMinecraftWorld(), pos, ItemStack.EMPTY, true);
}
@@ -352,13 +359,53 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -355,13 +362,53 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
if (world instanceof ServerLevel) {
Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack).forEach((itemstack1) -> {
@@ -198,12 +198,12 @@ index 58986bc0677c5ea1ad54d7d6d4efa5c2ea233aea..59d616137088af46d4494171fe96ba01
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 2855f8c4684cb9afee1bd8a4c2ae82d45ef1ea2b..f87f4f19738dfe8b58d3dbf0c27933fd3ec93883 100644
index 040c1f584c525990ec844cba9f01df5b33fa2a37..414516ee3596bcde783900200823e8ed00dae6fe 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -263,4 +263,9 @@ public class LeafConfig {
forceHalloweenSeason = getBoolean("gameplay-mechanics.halloween.force", forceHalloweenSeason);
chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
@@ -256,4 +256,9 @@ public class LeafConfig {
advancementOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.advancement.only-broadcast-to-affected-player", advancementOnlyBroadcastToAffectedPlayer);
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
}
+
+ public static boolean persistentTileEntityDisplayNames = false;

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 84cb548e89350d9127b18f69e47d1f7433bcb1ee..86e5e0caf3b341d5556665e5f5fd7d158d639118 100644
index 5a656751b101d914afd5b07d70e60b50009ed215..4f131ca1977475513ee43120f06b7c026f49e91e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -809,6 +809,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -837,6 +837,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
@@ -18,7 +18,7 @@ index 84cb548e89350d9127b18f69e47d1f7433bcb1ee..86e5e0caf3b341d5556665e5f5fd7d15
return;
}
@@ -1370,8 +1371,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1401,8 +1402,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 3e0d38ed6959d5d9f7dbae8d604acb9299b8621d..f7e8b6e1872a397c96afc938754726b0d4e493b4 100644
index 41ff954010c11d524ffb90abd22c29a1d8d8f5a0..675da6794923cfefbe41034247a71ef929e2802c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -583,6 +583,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -581,6 +581,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
entity.load(nbt);
}, () -> {
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));

View File

@@ -7,18 +7,18 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 76a9da8209d557b913c49ccd281bf147b9ac4fa4..a39d038b5198c9244e2225e0fe383f3c96b49a08 100644
index 825cdb927925a35a53e399ee647ea0738e67a5c9..d9197a989435dacb954692c4b6b9175062f268d8 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -139,6 +139,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -141,6 +141,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}, MemoryModuleType.MEETING_POINT, (entityvillager, holder) -> {
return holder.is(PoiTypes.MEETING);
});
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur
+ private int notLobotomizedCount = 0; // Purpur
public long nextGolemPanic = -1; // Pufferfish
public Villager(EntityType<? extends Villager> entityType, Level world) {
this(entityType, world, VillagerType.PLAINS);
@@ -155,6 +157,47 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE));
}
@@ -67,10 +67,11 @@ index 76a9da8209d557b913c49ccd281bf147b9ac4fa4..a39d038b5198c9244e2225e0fe383f3c
@Override
public Brain<Villager> getBrain() {
return (Brain<Villager>) super.getBrain(); // CraftBukkit - decompile error
@@ -250,12 +293,27 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -248,7 +291,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
protected void customServerAiStep() { mobTick(false); }
protected void mobTick(boolean inactive) {
this.level.getProfiler().push("villagerBrain");
- if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper
+ // Purpur start
+ if (org.dreeam.leaf.LeafConfig.villagerLobotomizeEnabled) {
+ // treat as inactive if lobotomized
@@ -80,21 +81,18 @@ index 76a9da8209d557b913c49ccd281bf147b9ac4fa4..a39d038b5198c9244e2225e0fe383f3c
+ this.isLobotomized = false;
+ }
+ // Purpur end
// Pufferfish start
if (!inactive) {
if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
this.getBrain().tick((ServerLevel) this.level, this); // Paper
}
// Pufferfish end
+ if (!inactive) {
+ this.getBrain().tick((ServerLevel) this.level, this); // Paper
+ }
+ // Purpur start
+ else if (this.isLobotomized && shouldRestock()) {
+ // make sure we restock if needed when lobotomized
+ restock();
+ }
+ // Purpur end
this.level.getProfiler().pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index a1a8ac55e572156671e47317ba061855be79e5ac..ec3fb8865211bd7625103c37af7b96df37163a07 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -112,12 +110,12 @@ index a1a8ac55e572156671e47317ba061855be79e5ac..ec3fb8865211bd7625103c37af7b96df
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 558c8d64305fe7266e916c51177142c2f6cb19c4..5ee72a675550520ba14e6f5b7375ba7fee326ef1 100644
index 414516ee3596bcde783900200823e8ed00dae6fe..55879146faa26d3ed58693627f8dfe9126bf5171 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -273,4 +273,11 @@ public class LeafConfig {
private static void sandSettings() {
fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping);
@@ -261,4 +261,11 @@ public class LeafConfig {
private static void tileentitySetting() {
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
}
+
+ public static boolean villagerLobotomizeEnabled = false;

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1d6e9d696b7d288db4557540bd1556478849f8c8..38995416ecbfb8067069926cc0e9be1734851206 100644
index 4f131ca1977475513ee43120f06b7c026f49e91e..9305f5d0f1323604ae2bc7cee7c19d0304874883 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2369,7 +2369,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2405,7 +2405,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
do {
instant1 = (Instant) this.lastChatTimeStamp.get();
if (timestamp.isBefore(instant1)) {
@@ -20,10 +20,10 @@ index 1d6e9d696b7d288db4557540bd1556478849f8c8..38995416ecbfb8067069926cc0e9be17
} while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp));
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 5ee72a675550520ba14e6f5b7375ba7fee326ef1..dcac5cf6eb0992b3b3d51222f328b7f87936322a 100644
index 55879146faa26d3ed58693627f8dfe9126bf5171..e0d5e00b4291e66b27a3a0c1701af3c4e7b3db26 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -280,4 +280,9 @@ public class LeafConfig {
@@ -268,4 +268,9 @@ public class LeafConfig {
villagerLobotomizeEnabled = getBoolean("mobs.villager.lobotomize.enabled", villagerLobotomizeEnabled);
villagerLobotomizeCheckInterval = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheckInterval);
}

View File

@@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 4 Apr 2020 03:07:59 -0500
Subject: [PATCH] Purpur: Skip events if there's no listeners
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 8ee8ff15f4511684261ff7a9417baa2ccd313b69..31e44f59bd34ae79dd1147263e446e6d6e9f8c66 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -429,6 +429,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Async command map building
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
+ if (PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - skip all this crap if there's nothing listening
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -439,6 +440,7 @@ public class Commands {
}
}
// CraftBukkit end
+ } // Purpur - skip event
player.connection.send(new ClientboundCommandsPacket(rootcommandnode));
}

View File

@@ -426,10 +426,10 @@ index e5ea9f27a1936ed9e329e74317c91c5df89b9fbd..89a41d396162a1c2eb2df5192b0d888b
private long lastFill = -1;
private long nextRefill = -1;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 1fcdd47ee804db8d6649b603fd95c5273f40801d..2e922bb844bc147224a60ef2aae33a0125e6ca4a 100644
index bca581f2a192015f5461e5bf776234687e5ae9fc..87161a2a3f611abdefdb2ef475a3cb64261339b8 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -53,6 +53,10 @@ import net.minecraft.world.level.material.Fluids;
@@ -52,6 +52,10 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.ticks.LevelChunkTicks;
import net.minecraft.world.ticks.TickContainerAccess;
import org.slf4j.Logger;
@@ -440,9 +440,9 @@ index 1fcdd47ee804db8d6649b603fd95c5273f40801d..2e922bb844bc147224a60ef2aae33a01
public class LevelChunk extends ChunkAccess {
@@ -932,7 +936,7 @@ public class LevelChunk extends ChunkAccess {
@@ -931,7 +935,7 @@ public class LevelChunk extends ChunkAccess {
if (this.needsDecoration) {
//try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur
try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
this.needsDecoration = false;
- java.util.Random random = new java.util.Random();
+ Random random = new FastRandom();
@@ -471,18 +471,18 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..ef8909c9c13c8f46ec6d452f0d14c9a1
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f8d321e925bf2708e51590542325c1bdc67d5964..ace7e9f66c3583fc51f06bd9963ed55968d40c0f 100644
index 9eae3862abb5f1d7755a8e777fd4bf9a6f8e321d..ee86c8d45c6cbbc0de3039e7d319eb26a8c8f918 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -134,6 +134,7 @@ import org.bukkit.util.Consumer;
import org.bukkit.util.RayTraceResult;
@@ -132,6 +132,7 @@ import org.bukkit.util.RayTraceResult;
import org.bukkit.util.StructureSearchResult;
import org.bukkit.util.Vector;
import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues;
+import cc.keyimc.keyi.utils.FastRandom; // KeYi
public class CraftWorld extends CraftRegionAccessor implements World {
public static final int CUSTOM_DIMENSION_OFFSET = 10;
@@ -226,7 +227,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -224,7 +225,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
// Paper end

View File

@@ -1,44 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 4 Jun 2021 09:13:54 -0500
Subject: [PATCH] Purpur: Add toggle for sand duping fix
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index eacb8a407fe99af2c13f23c12b5544696bda8890..2e4476c3a563ee8899e2ea3d7f064a7d0114260d 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -130,7 +130,7 @@ public class FallingBlockEntity extends Entity {
@Override
public void tick() {
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (org.dreeam.leaf.LeafConfig.fixSandDuping && this.isRemoved()) { // Purpur
return;
}
// Paper end - fix sand duping
@@ -147,7 +147,7 @@ public class FallingBlockEntity extends Entity {
this.move(MoverType.SELF, this.getDeltaMovement());
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (org.dreeam.leaf.LeafConfig.fixSandDuping && this.isRemoved()) { // Purpur
return;
}
// Paper end - fix sand duping
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index f87f4f19738dfe8b58d3dbf0c27933fd3ec93883..558c8d64305fe7266e916c51177142c2f6cb19c4 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -268,4 +268,9 @@ public class LeafConfig {
private static void tileentitySetting() {
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
}
+
+ public static boolean fixSandDuping = true;
+ private static void sandSettings() {
+ fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping);
+ }
}

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7c43de6ad6bd7259c6bcb2a55e312e8abfcf546b..472d9281199cb9cd8edafc6d2309e5e296a014cd 100644
index d274e9373f7507dd38f2e0162c8a683b1ddde04e..7052b1fb5a2bf6099c92eeeab8c83098d97792c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -26,6 +26,9 @@ import java.util.Optional;
@@ -28,7 +28,7 @@ index 7c43de6ad6bd7259c6bcb2a55e312e8abfcf546b..472d9281199cb9cd8edafc6d2309e5e2
import org.bukkit.map.MapCursor;
import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue;
@@ -3029,4 +3033,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3036,4 +3040,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.spigot;
}
// Spigot end

View File

@@ -1,954 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Fri, 1 Jul 2022 04:03:37 -0500
Subject: [PATCH] Purpur: Remove Timings
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
index e5d9c6f2cbe11c2ded6d8ad111fa6a8b2086dfba..830d863cd9665d58875bfa5ca2bcd22f89ab2d49 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
@@ -915,9 +915,9 @@ public final class ChunkHolderManager {
}
public boolean processTicketUpdates() {
- co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager
+ //co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager // Purpur
return this.processTicketUpdates(true, true, null);
- } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager
+ //} finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager // Purpur
}
private static final ThreadLocal<List<ChunkProgressionTask>> CURRENT_TICKET_UPDATE_SCHEDULING = new ThreadLocal<>();
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
index 8013dd333e27aa5fd0beb431fa32491eec9f5246..e42eb93fd9f6f51ff5bb4b14a2304d4ffcdd8441 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
@@ -1750,7 +1750,7 @@ public final class NewChunkHolder {
boolean canSavePOI = !(chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave) && (poi != null && poi.isDirty());
boolean canSaveEntities = entities != null;
- try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper
+ //try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper // Purpur
if (canSaveChunk) {
canSaveChunk = this.saveChunk(chunk, unloading);
}
@@ -1764,7 +1764,7 @@ public final class NewChunkHolder {
this.lastEntityUnload = null;
}
}
- }
+ //} // Purpur
return executedUnloadTask | canSaveChunk | canSaveEntities | canSavePOI ? new SaveStat(executedUnloadTask || canSaveChunk, canSaveEntities, canSavePOI): null;
}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 01bdf134fc21220ab7ecca51f2dcd51c0b466bba..6bf14183a3fcd2b3d166752ce33240d2ff1ffa7c 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -67,14 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart {
@Override
public void postProcess() {
- // Pufferfish start
+ /*// Pufferfish start // Purpur
if (enabled && !reallyEnabled) {
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default");
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml");
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false.");
}
enabled = reallyEnabled;
- // Pufferfish end
+ */// Pufferfish end // Purpur
MinecraftTimings.processConfig(this);
}
}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 27d4aa45e585842c04491839826d405d6f447f0e..767623a35dda71d77c65602e10ef2b3f0ae743f1 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -47,8 +47,9 @@ public class PacketUtils {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.getConnection().isConnected()) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
- try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
+ //try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings // Purpur
packet.handle(listener);
+ /* // Purpur
} catch (Exception exception) {
net.minecraft.network.Connection networkmanager = listener.getConnection();
String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>"; // Paper
@@ -60,7 +61,7 @@ public class PacketUtils {
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
networkmanager.setReadOnly();
- }
+ } */ // Purpur
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 75daffc4eaa831708f1ccfa5370ddf1871998033..a0e94d7a3ae1b6d28811324d24dff7ac5c6d4c16 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1393,15 +1393,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
- co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
+ //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur
long i = Util.getNanos();
// Paper start - move oversleep into full server tick
- isOversleep = true;MinecraftTimings.serverOversleep.startTiming();
+ //isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); // Purpur
this.managedBlock(() -> {
return !this.canOversleep();
});
- isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
+ //isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); // Purpur
// Paper end
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
@@ -1453,9 +1453,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
- try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
+ //try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { // Purpur
this.runAllTasks();
- }
+ //} // Purpur
// Paper end
// Paper start
long endTime = System.nanoTime();
@@ -1477,29 +1477,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.frameTimer.logFrameDuration(i1 - i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
- co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
+ //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper // Purpur
}
public void tickChildren(BooleanSupplier shouldKeepTicking) {
- MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
+ //MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper // Purpur
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
- MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
+ //MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
this.profiler.push("commandFunctions");
- MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
+ //MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper // Purpur
this.getFunctions().tick();
- MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
+ //MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper // Purpur
this.profiler.popPush("levels");
//Iterator iterator = this.getAllLevels().iterator(); // Paper - moved down
// CraftBukkit start
// Run tasks that are waiting on processing
- MinecraftTimings.processQueueTimer.startTiming(); // Spigot
+ //MinecraftTimings.processQueueTimer.startTiming(); // Spigot // Purpur
while (!this.processQueue.isEmpty()) {
this.processQueue.remove().run();
}
- MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
+ //MinecraftTimings.processQueueTimer.stopTiming(); // Spigot // Purpur
- MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
+ //MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper // Purpur
// Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - optimize time updates
for (final ServerLevel world : this.getAllLevels()) {
@@ -1519,7 +1519,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end
- MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
+ //MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
this.isIteratingOverLevels = true; // Paper
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
@@ -1543,14 +1543,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.push("tick");
try {
- worldserver.timings.doTick.startTiming(); // Spigot
+ //worldserver.timings.doTick.startTiming(); // Spigot // Purpur
worldserver.tick(shouldKeepTicking);
// Paper start
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
regionManager.recalculateRegions();
}
// Paper end
- worldserver.timings.doTick.stopTiming(); // Spigot
+ //worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
} catch (Throwable throwable) {
// Spigot Start
CrashReport crashreport;
@@ -1573,24 +1573,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.isIteratingOverLevels = false; // Paper
this.profiler.popPush("connection");
- MinecraftTimings.connectionTimer.startTiming(); // Spigot
+ //MinecraftTimings.connectionTimer.startTiming(); // Spigot // Purpur
this.getConnection().tick();
- MinecraftTimings.connectionTimer.stopTiming(); // Spigot
+ //MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Purpur
this.profiler.popPush("players");
- MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
+ //MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper // Purpur
this.playerList.tick();
- MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
+ //MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper // Purpur
if (SharedConstants.IS_RUNNING_IN_IDE) {
GameTestTicker.SINGLETON.tick();
}
this.profiler.popPush("server gui refresh");
- MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
+ //MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper // Purpur
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
- MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
+ //MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper // Purpur
this.profiler.pop();
}
@@ -2755,7 +2755,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return;
}
- co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming();
+ //co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming(); // Purpur
try {
for (;;) {
boolean moreTasks = this.tickMidTickTasks();
@@ -2782,7 +2782,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
} finally {
- co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming();
+ //co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming(); // Purpur
}
}
// Paper end - execute chunk tasks mid tick
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 6483a1d461904a0584b6808b2f86ac7329bba963..f662278d302661e57c850529ede81ea2889a82cb 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -88,7 +88,7 @@ public class ServerFunctionManager {
} else {
int i;
- try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
+ try /*(co.aikar.timings.Timing timing = function.getTiming().startTiming())*/ { // Paper // Purpur
this.context = new ServerFunctionManager.ExecutionContext(tracer);
i = this.context.runTopCommand(function, source);
} finally {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 598d0200c055ef357a0a0d8857ce740d0bff9bae..1cc5cf3dcf33e89092b2aa689170c775007e4e4a 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -484,7 +484,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInputs() {
- MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
+ //MinecraftTimings.serverCommandTimer.startTiming(); // Spigot // Purpur
// Paper start - use proper queue
ConsoleInput servercommand;
while ((servercommand = this.serverCommandQueue.poll()) != null) {
@@ -501,7 +501,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// CraftBukkit end
}
- MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot
+ //MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot // Purpur
}
@Override
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d939b1e3bc101e66bc1019cf49d8079665dadfcc..eb4f2c5c9453f59abbc7c9b9629ab0d43a4c5da6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -620,15 +620,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void tick(BooleanSupplier shouldKeepTicking) {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper
+ //try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper // Purpur
gameprofilerfiller.push("poi");
this.poiManager.tick(shouldKeepTicking);
- } // Paper
+ //} // Paper // Purpur
gameprofilerfiller.popPush("chunk_unload");
if (!this.level.noSave()) {
- try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper
+ //try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper // Purpur
this.processUnloads(shouldKeepTicking);
- } // Paper
+ //} // Paper // Purpur
}
gameprofilerfiller.pop();
@@ -1250,24 +1250,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - optimised tracker
private final void processTrackQueue() {
- this.level.timings.tracker1.startTiming();
+ //this.level.timings.tracker1.startTiming(); // Purpur
try {
for (TrackedEntity tracker : this.entityMap.values()) {
// update tracker entry
tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
}
} finally {
- this.level.timings.tracker1.stopTiming();
+ //this.level.timings.tracker1.stopTiming(); // Purpur
}
- this.level.timings.tracker2.startTiming();
+ //this.level.timings.tracker2.startTiming(); // Purpur
try {
for (TrackedEntity tracker : this.entityMap.values()) {
tracker.serverEntity.sendChanges();
}
} finally {
- this.level.timings.tracker2.stopTiming();
+ //this.level.timings.tracker2.stopTiming(); // Purpur
}
}
// Paper end - optimised tracker
@@ -1282,7 +1282,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
- level.timings.tracker1.startTiming(); // Paper
+ //level.timings.tracker1.startTiming(); // Paper // Purpur
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1307,17 +1307,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
- level.timings.tracker1.stopTiming(); // Paper
+ //level.timings.tracker1.stopTiming(); // Paper // Purpur
if (!list.isEmpty()) {
objectiterator = this.entityMap.values().iterator();
- level.timings.tracker2.startTiming(); // Paper
+ //level.timings.tracker2.startTiming(); // Paper // Purpur
while (objectiterator.hasNext()) {
playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next();
playerchunkmap_entitytracker.updatePlayers(list);
}
- level.timings.tracker2.stopTiming(); // Paper
+ //level.timings.tracker2.stopTiming(); // Paper // Purpur
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c6f5d6756fa0e068a462d9c0ded12e0771abba37..2c23321c826d929981df51f2cc60cdcdb649a43f 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -450,10 +450,10 @@ public class ServerChunkCache extends ChunkSource {
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
// Paper end
com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
- this.level.timings.syncChunkLoad.startTiming(); // Paper
+ //this.level.timings.syncChunkLoad.startTiming(); // Paper // Purpur
chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
- this.level.timings.syncChunkLoad.stopTiming(); // Paper
+ //this.level.timings.syncChunkLoad.stopTiming(); // Paper // Purpur
} // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
@@ -601,17 +601,17 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
- try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
+ //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
this.chunkMap.saveAllChunks(flush);
- } // Paper - Timings
+ //} // Paper - Timings // Purpur
}
// Paper start - duplicate save, but call incremental
public void saveIncrementally() {
this.runDistanceManagerUpdates();
- try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
+ //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
this.chunkMap.saveIncrementally();
- } // Paper - Timings
+ //} // Paper - Timings // Purpur
}
// Paper end
@@ -641,22 +641,22 @@ public class ServerChunkCache extends ChunkSource {
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
this.level.getProfiler().push("purge");
- this.level.timings.doChunkMap.startTiming(); // Spigot
+ //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- this.level.timings.doChunkMap.stopTiming(); // Spigot
+ //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur
this.level.getProfiler().popPush("chunks");
if (tickChunks) {
- this.level.timings.chunks.startTiming(); // Paper - timings
+ //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur
this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes
this.tickChunks();
- this.level.timings.chunks.stopTiming(); // Paper - timings
+ //this.level.timings.chunks.stopTiming(); // Paper - timings // Purpur
}
- this.level.timings.doChunkUnload.startTiming(); // Spigot
+ //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur
this.level.getProfiler().popPush("unload");
this.chunkMap.tick(shouldKeepTicking);
- this.level.timings.doChunkUnload.stopTiming(); // Spigot
+ //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur
this.level.getProfiler().pop();
this.clearCache();
}
@@ -711,7 +711,7 @@ public class ServerChunkCache extends ChunkSource {
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
gameprofilerfiller.push("naturalSpawnCount");
- this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
+ //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
NaturalSpawner.SpawnState spawnercreature_d; // moved down
@@ -732,12 +732,12 @@ public class ServerChunkCache extends ChunkSource {
// Pufferfish end
}
// Paper end
- this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
+ //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur
//this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
gameprofilerfiller.popPush("filteringLoadedChunks");
// Paper - moved down
- this.level.timings.chunkTicks.startTiming(); // Paper
+ //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur
// Paper - moved down
@@ -791,17 +791,17 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
- this.level.timings.chunkTicks.stopTiming(); // Paper
+ //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur
gameprofilerfiller.popPush("customSpawners");
if (flag2) {
- try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
+ //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
- } // Paper - timings
+ //} // Paper - timings // Purpur
}
gameprofilerfiller.pop();
// Paper start - use set of chunks requiring updates, rather than iterating every single one loaded
gameprofilerfiller.popPush("broadcast");
- this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
+ //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
this.chunkMap.needsChangeBroadcasting.clear();
@@ -813,7 +813,7 @@ public class ServerChunkCache extends ChunkSource {
}
}
}
- this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
+ //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur
gameprofilerfiller.pop();
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
// Paper start - controlled flush for entity tracker packets
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 53198ebfa30273c5ddc1bb4324f5174ff99f688d..deef2fafed137d90cbd14a71d3e7bb1210348af9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -666,7 +666,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
gameprofilerfiller.popPush("tickPending");
- timings.scheduledBlocks.startTiming(); // Paper
+ //timings.scheduledBlocks.startTiming(); // Paper // Purpur
if (!this.isDebug()) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");
@@ -675,20 +675,20 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.fluidTicks.tick(j, 65536, this::tickFluid);
gameprofilerfiller.pop();
}
- timings.scheduledBlocks.stopTiming(); // Paper
+ //timings.scheduledBlocks.stopTiming(); // Paper // Purpur
gameprofilerfiller.popPush("raid");
- this.timings.raids.startTiming(); // Paper - timings
+ //this.timings.raids.startTiming(); // Paper - timings // Purpur
this.raids.tick();
- this.timings.raids.stopTiming(); // Paper - timings
+ //this.timings.raids.stopTiming(); // Paper - timings // Purpur
gameprofilerfiller.popPush("chunkSource");
- this.timings.chunkProviderTick.startTiming(); // Paper - timings
+ //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur
this.getChunkSource().tick(shouldKeepTicking, true);
- this.timings.chunkProviderTick.stopTiming(); // Paper - timings
+ //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur
gameprofilerfiller.popPush("blockEvents");
- timings.doSounds.startTiming(); // Spigot
+ //timings.doSounds.startTiming(); // Spigot // Purpur
this.runBlockEvents();
- timings.doSounds.stopTiming(); // Spigot
+ //timings.doSounds.stopTiming(); // Spigot // Purpur
this.handlingTick = false;
gameprofilerfiller.pop();
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
@@ -699,7 +699,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (flag || this.emptyTime++ < 300) {
gameprofilerfiller.push("entities");
- timings.tickEntities.startTiming(); // Spigot
+ //timings.tickEntities.startTiming(); // Spigot // Purpur
if (this.dragonFight != null) {
gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
@@ -707,7 +707,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
- timings.entityTick.startTiming(); // Spigot
+ //timings.entityTick.startTiming(); // Spigot // Purpur
this.entityTickList.forEach((entity) -> {
entity.activatedPriorityReset = false; // Pufferfish - DAB
if (!entity.isRemoved()) {
@@ -748,8 +748,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
});
- timings.entityTick.stopTiming(); // Spigot
- timings.tickEntities.stopTiming(); // Spigot
+ //timings.entityTick.stopTiming(); // Spigot // Purpur
+ //timings.tickEntities.stopTiming(); // Spigot // Purpur
gameprofilerfiller.pop();
this.tickBlockEntities();
}
@@ -902,7 +902,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start - optimise random block ticking
gameprofilerfiller.popPush("randomTick");
- timings.chunkTicksBlocks.startTiming(); // Paper
+ //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
@@ -936,7 +936,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise random block ticking
- timings.chunkTicksBlocks.stopTiming(); // Paper
+ //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur
gameprofilerfiller.pop();
}
@@ -1211,8 +1211,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end
// Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
- timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
- try {
+ //timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper // Purpur
+ //try { // Purpur
// Paper end - timings
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -1228,7 +1228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.postTick(); // CraftBukkit
} else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop();
- } finally { timer.stopTiming(); } // Paper - timings
+ //} finally { timer.stopTiming(); } // Paper - timings // Purpur
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1251,8 +1251,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
- co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
- try {
+ //co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper // Purpur
+ //try { // Purpur
// Paper end
passenger.setOldPosAndRot();
++passenger.tickCount;
@@ -1282,7 +1282,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
- } finally { timer.stopTiming(); }// Paper - EAR2 timings
+ //} finally { timer.stopTiming(); }// Paper - EAR2 timings // Purpur
}
} else {
passenger.stopRiding();
@@ -1302,14 +1302,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
}
- try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
+ //try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { // Purpur
if (doFull) {
this.saveLevelData();
}
- this.timings.worldSaveChunks.startTiming(); // Paper
+ //this.timings.worldSaveChunks.startTiming(); // Paper // Purpur
if (!this.noSave()) chunkproviderserver.saveIncrementally();
- this.timings.worldSaveChunks.stopTiming(); // Paper
+ //this.timings.worldSaveChunks.stopTiming(); // Paper // Purpur
// Copied from save()
// CraftBukkit start - moved from MinecraftServer.saveChunks
@@ -1321,7 +1321,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
}
// CraftBukkit end
- }
+ //} // Purpur
}
// Paper end
@@ -1335,7 +1335,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
- try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
+ //try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper // Purpur // Purpur
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -1345,11 +1345,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
- timings.worldSaveChunks.startTiming(); // Paper
+ //timings.worldSaveChunks.startTiming(); // Paper // Purpur
if (!close) chunkproviderserver.save(flush); // Paper - rewrite chunk system
if (close) chunkproviderserver.close(true); // Paper - rewrite chunk system
- timings.worldSaveChunks.stopTiming(); // Paper
- }// Paper
+ //timings.worldSaveChunks.stopTiming(); // Paper // Purpur
+ //}// Paper // Purpur
// Paper - rewrite chunk system - entity saving moved into ChunkHolder
} else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 38995416ecbfb8067069926cc0e9be1734851206..fc5f3f6e8dcddc3dfe5cf66bfaa25eeafc8ecb53 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2506,7 +2506,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
}
// Paper End
- co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper
+ //co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper // Purpur
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2516,7 +2516,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) {
- co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
+ //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
return;
}
@@ -2529,7 +2529,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return;
} finally {
- co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
+ //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e1a60b9e380448e1594516ec078e89cc7f74db2a..c0278a87a77d14c7598e6d431b63bbd5c7d863af 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1203,7 +1203,7 @@ public abstract class PlayerList {
public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
- MinecraftTimings.savePlayers.startTiming(); // Paper
+ //MinecraftTimings.savePlayers.startTiming(); // Paper // Purpur
int numSaved = 0;
long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
@@ -1214,7 +1214,7 @@ public abstract class PlayerList {
}
// Paper end
}
- MinecraftTimings.savePlayers.stopTiming(); // Paper
+ //MinecraftTimings.savePlayers.stopTiming(); // Paper // Purpur
return null; }); // Paper - ensure main
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index 57ef7fbba3028c28231abf7b7ae78aa019323536..651c156dc8a5aad04d461add02e22147af657d07 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -58,9 +58,9 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
this.status = Behavior.Status.RUNNING;
int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
this.endTimestamp = time + (long)i;
- this.timing.startTiming(); // Paper - behavior timings
+ //this.timing.startTiming(); // Paper - behavior timings // Purpur
this.start(world, entity, time);
- this.timing.stopTiming(); // Paper - behavior timings
+ //this.timing.stopTiming(); // Paper - behavior timings // Purpur
return true;
} else {
return false;
@@ -72,13 +72,13 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
@Override
public final void tickOrStop(ServerLevel world, E entity, long time) {
- this.timing.startTiming(); // Paper - behavior timings
+ //this.timing.startTiming(); // Paper - behavior timings // Purpur
if (!this.timedOut(time) && this.canStillUse(world, entity, time)) {
this.tick(world, entity, time);
} else {
this.doStop(world, entity, time);
}
- this.timing.stopTiming(); // Paper - behavior timings
+ //this.timing.stopTiming(); // Paper - behavior timings // Purpur
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index fcdb9bde8e1605e30dde3e580491522d4b62cdc0..7094701d213c73ba47ace806962244c10fdf4dda 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -46,10 +46,10 @@ public abstract class Sensor<E extends LivingEntity> {
if (--this.timeToTick <= 0L) {
// Paper start - configurable sensor tick rate and timings
this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
- this.timing.startTiming();
+ //this.timing.startTiming(); // Purpur
// Paper end
this.doTick(world, entity);
- this.timing.stopTiming(); // Paper - sensor timings
+ //this.timing.stopTiming(); // Paper - sensor timings // Purpur
}
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 62aff29485f124880739e7d2b5fb0d8a9d957741..e61e52a34bb237bf7b1e28ba8087d1b2cd5f2f89 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -968,15 +968,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
ProfilerFiller gameprofilerfiller = this.getProfiler();
gameprofilerfiller.push("blockEntities");
- timings.tileEntityPending.startTiming(); // Spigot
+ //timings.tileEntityPending.startTiming(); // Spigot // Purpur
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
this.pendingBlockEntityTickers.clear();
}
- timings.tileEntityPending.stopTiming(); // Spigot
+ //timings.tileEntityPending.stopTiming(); // Spigot // Purpur
- timings.tileEntityTick.startTiming(); // Spigot
+ //timings.tileEntityTick.startTiming(); // Spigot // Purpur
// Spigot start
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0;
@@ -1009,7 +1009,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
this.blockEntityTickers.removeAll(toRemove);
- timings.tileEntityTick.stopTiming(); // Spigot
+ //timings.tileEntityTick.stopTiming(); // Spigot // Purpur
this.tickingBlockEntities = false;
co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
gameprofilerfiller.pop();
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 5521418fa307b3eeb4f02a10c39f05b360d1d06e..31cab107a606409af5c1fe56cd0956d707637cc0 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -133,7 +133,7 @@ public final class NaturalSpawner {
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
world.getProfiler().push("spawner");
- world.timings.mobSpawn.startTiming(); // Spigot
+ //world.timings.mobSpawn.startTiming(); // Spigot // Purpur
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -188,7 +188,7 @@ public final class NaturalSpawner {
}
}
- world.timings.mobSpawn.stopTiming(); // Spigot
+ //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur
world.getProfiler().pop();
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index de7a5f3812a017131fd1b32fbeff10e325b1cd2e..f64225897d659127dd87293b26b58653cefda0c3 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -930,7 +930,7 @@ public class LevelChunk extends ChunkAccess {
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
if (this.needsDecoration) {
- try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
+ //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur
this.needsDecoration = false;
java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed());
@@ -950,7 +950,7 @@ public class LevelChunk extends ChunkAccess {
}
}
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
- } // Paper
+ //} // Paper // Purpur
}
}
}
@@ -1310,7 +1310,7 @@ public class LevelChunk extends ChunkAccess {
ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
gameprofilerfiller.push(this::getType);
- this.blockEntity.tickTimer.startTiming(); // Spigot
+ //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1332,7 +1332,7 @@ public class LevelChunk extends ChunkAccess {
// Paper end
// Spigot start
} finally {
- this.blockEntity.tickTimer.stopTiming();
+ //this.blockEntity.tickTimer.stopTiming(); // Purpur
// Spigot end
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 38920d680d9b0d81013dcf16ce3dd7271eeafe4c..4f01386675b4faf94589b4ae5f65a93737ab3240 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -516,10 +516,10 @@ public class CraftScheduler implements BukkitScheduler {
this.runners.remove(task.getTaskId());
}
}
- MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper
+ //MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper // Purpur
this.pending.addAll(temp);
temp.clear();
- MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
+ //MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper // Purpur
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
}
@@ -563,7 +563,7 @@ public class CraftScheduler implements BukkitScheduler {
}
void parsePending() { // Paper
- if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper
+ //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper // Purpur
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -582,7 +582,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;
- if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper
+ //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper // Purpur
}
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f..4f1cf281c4bf68c37982d390da8779dea78dab18 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -96,13 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@Override
public void run() {
- try (Timing ignored = timings.startTiming()) { // Paper
+ //try (Timing ignored = timings.startTiming()) { // Paper // Purpur
if (this.rTask != null) {
this.rTask.run();
} else {
this.cTask.accept(this);
}
- } // Paper
+ //} // Paper // Purpur
}
long getCreatedAt() {
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
index 138407c2d4b0bc55ddb9aac5d2aa3edadda090fb..a6e9e503a496c18e2501b03ec84f4600c134a50c 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
@@ -115,7 +115,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
public void getScoreboardScores(ObjectiveCriteria criteria, String name, Consumer<Score> consumer) {
// Paper start - add timings for scoreboard search
// plugins leaking scoreboards will make this very expensive, let server owners debug it easily
- co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync();
+ //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); // Purpur
try {
// Paper end - add timings for scoreboard search
for (CraftScoreboard scoreboard : this.scoreboards) {
@@ -123,7 +123,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
board.forAllObjectives(criteria, name, (score) -> consumer.accept(score));
}
} finally { // Paper start - add timings for scoreboard search
- co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync();
+ //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); // Purpur
}
// Paper end - add timings for scoreboard search
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 63d3fcc45be732a4cd2dc8b5347d860fd6577bdd..57a27fb05235db8c056492885055fdbe36bee7d1 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -169,7 +169,7 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
- MinecraftTimings.entityActivationCheckTimer.startTiming();
+ //MinecraftTimings.entityActivationCheckTimer.startTiming(); // Purpur
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
@@ -242,7 +242,7 @@ public class ActivationRange
}
// Paper end
}
- MinecraftTimings.entityActivationCheckTimer.stopTiming();
+ //MinecraftTimings.entityActivationCheckTimer.stopTiming(); // Purpur
}
/**

View File

@@ -10,19 +10,17 @@ this patch is focused around the sensors used for ai
delete the line of sight cache less often and use a faster nearby comparison
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 2db9ce11dc52b8fb737e3344265e2a40d07ffc26..29fa9ad2223de668c15a5e5b433704b2c4765610 100644
index 27fc50571305132c86497fcb1d5b1bb514610a4e..f1a33fd186fa9c10ac99b7b0e6379902a10dfb14 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -873,10 +873,10 @@ public abstract class Mob extends LivingEntity {
@@ -867,8 +867,8 @@ public abstract class Mob extends LivingEntity {
return;
}
// Paper end
+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up
//this.level.getProfiler().push("sensing"); // Purpur
- this.sensing.tick();
+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
//this.level.getProfiler().pop(); // Purpur
- int i = this.level.getServer().getTickCount() + this.getId();
+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up
+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
if (i % 2 != 0 && this.tickCount > 1) {
//this.level.getProfiler().push("targetSelector"); // Purpur
this.targetSelector.tickRunningGoals(false);

File diff suppressed because it is too large Load Diff

View File

@@ -8,19 +8,18 @@ Original license: GPL v3
Original project: https://github.com/Akarin-project/Akarin
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index 4fd709a550bf8da1e996894a1ca6b91206c31e9e..b43a7c3aea930805ea917176d4a7b5564be084cb 100644
index 5dee29939421333caa51e1a659d8ad9f9c0358c9..1f629ec713333fae303b4b31422a880fc858172b 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -23,6 +23,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.stream.Stream;
@@ -24,6 +24,7 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
+
import me.titaniumtown.ArrayConstants;
+import io.papermc.paper.util.MCUtil;
import net.minecraft.Util;
import net.minecraft.util.GsonHelper;
import org.slf4j.Logger;
@@ -148,37 +150,43 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
@@ -149,37 +150,43 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
}
public void save() throws IOException {

View File

@@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Mon, 24 Oct 2022 10:25:40 +0800
Subject: [PATCH] KeYi: Do not save firework entities or the server may be
laggy
Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
index 5406925cd66f46ab8744123c670d72cea7bfc3a1..0b664dfef68b1e3905c9d8451602abf9cd9eafe6 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -358,4 +358,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public boolean isAttackable() {
return false;
}
+
+ // KeYi start
+ @Override
+ public boolean shouldBeSaved() {
+ return false;
+ }
+ // KeYi end
}

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/Cryptite/Slice
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b5aaddaf2ef9e7639cbdc682d06330945be3c432..b157f887092b4ca9642548eadd9a633bb74ec14d 100644
index 2c2262a2babd4fd5ca22b4630c1f0ae5e3a1a9ab..27c3c32b2bbc0ba1420ecae635d42e9df054256a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -268,6 +268,7 @@ public class ServerPlayer extends Player {
@@ -269,6 +269,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@@ -19,10 +19,10 @@ index b5aaddaf2ef9e7639cbdc682d06330945be3c432..b157f887092b4ca9642548eadd9a633b
private boolean compassBar = false; // Purpur
private boolean ramBar = false; // Purpur
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c0278a87a77d14c7598e6d431b63bbd5c7d863af..54d9b2c1dcab93b37c02aeda146aef088f20dff0 100644
index 94f3d84a1a89e1f1c720d6e7f19e93b1b0b5a865..e77d9b23ae797cc1b2d04028695bfa27d9f02076 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -901,12 +901,12 @@ public abstract class PlayerList {
@@ -975,12 +975,12 @@ public abstract class PlayerList {
int i = flag ? 1 : 0;
// CraftBukkit start
LevelData worlddata = worldserver1.getLevelData();
@@ -38,7 +38,7 @@ index c0278a87a77d14c7598e6d431b63bbd5c7d863af..54d9b2c1dcab93b37c02aeda146aef08
// entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 472d9281199cb9cd8edafc6d2309e5e296a014cd..3ef7fec22de7727b8627802e305aa68340798e70 100644
index 7052b1fb5a2bf6099c92eeeab8c83098d97792c7..581bcd14e6a186bac1389dbbb25eca3625790db4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1192,6 +1192,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@@ -1,46 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Thu, 1 Jul 2021 12:17:44 +0000
Subject: [PATCH] Patina: Don't create new random instance
Original license: GPL v3
Original project: https://github.com/PatinaMC/Patina
Original code by PatinaMC, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/PatinaMC/Patina
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 36cbcf3ca6412d98c9f7a002c5935bb99419fcca..b5aaddaf2ef9e7639cbdc682d06330945be3c432 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -393,7 +393,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
- int k1 = RandomSource.create().nextInt(i1);
+ int k1 = worldserver.random.nextInt(i1); // Patina - don't create new random instance
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
@@ -430,7 +430,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
- int k1 = RandomSource.create().nextInt(i1);
+ int k1 = world.random.nextInt(i1); // Patina - don't create new random instance
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
index 1ef089dbf83de35d875c00efdf468c397be56978..c345f10cbf7f3451edc604f97cdf959d70639e17 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
@@ -349,7 +349,7 @@ public class QueryThreadGs4 extends GenericThread {
this.identBytes[2] = bs[5];
this.identBytes[3] = bs[6];
this.ident = new String(this.identBytes, StandardCharsets.UTF_8);
- this.challenge = RandomSource.create().nextInt(16777216);
+ this.challenge = java.util.concurrent.ThreadLocalRandom.current().nextInt(16777216); // Patina - don't create new random instance
this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8);
}

View File

@@ -1,52 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
Date: Sat, 24 Oct 2020 21:03:53 -0500
Subject: [PATCH] Yatopia: Smarter statistics ticking
Original license: MIT
Original project: https://github.com/YatopiaMC/Yatopia
In vanilla, statistics that count time spent for an action (i.e. time played or sneak time) are incremented every tick. This is retarded. With this patch and a configured interval of 20, the statistics are only ticked every 20th tick and are incremented by 20 ticks at a time. This means a lot less ticking with the same accurate counting.
With an interval of 20, this patch saves roughly 3ms per tick on a server w/ 80 players online.
Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 61597ebe2f9faff43994c475074b87d11905e582..f61f1388aa93b98a3df407973f643f5f03e71652 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -278,19 +278,21 @@ public abstract class Player extends LivingEntity {
this.moveCloak();
if (!this.level.isClientSide) {
this.foodData.tick(this);
- this.awardStat(Stats.PLAY_TIME);
- this.awardStat(Stats.TOTAL_WORLD_TIME);
- if (this.isAlive()) {
- this.awardStat(Stats.TIME_SINCE_DEATH);
- }
-
- if (this.isDiscrete()) {
- this.awardStat(Stats.CROUCH_TIME);
- }
-
- if (!this.isSleeping()) {
- this.awardStat(Stats.TIME_SINCE_REST);
+ // Mirai start
+ if (tickCount % 20 == 0) {
+ this.awardStat(Stats.PLAY_TIME, 20);
+ this.awardStat(Stats.TOTAL_WORLD_TIME, 20);
+ if (this.isAlive()) {
+ this.awardStat(Stats.TIME_SINCE_DEATH, 20);
+ }
+ if (this.isDiscrete()) {
+ this.awardStat(Stats.CROUCH_TIME, 20);
+ }
+ if (!this.isSleeping()) {
+ this.awardStat(Stats.TIME_SINCE_REST, 20);
+ }
}
+ // Mirai end
}
int i = 29999999;

View File

@@ -1,38 +0,0 @@
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] Mirai: Fast speed check
Original license: GPL v3
Original project: https://github.com/etil2jz/Mirai
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 78423f4e97025cafd62037c6505f89faeed8a1f0..1f8210cd90d9e0ae3feaba2e10ff8073836cdfd3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1194,7 +1194,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

View File

@@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Mon, 24 Oct 2022 11:01:36 +0800
Subject: [PATCH] VMP: Skip entity move if no movement
Original license: MIT
Original project: https://github.com/RelativityMC/VMP-fabric
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1f8210cd90d9e0ae3feaba2e10ff8073836cdfd3..8f3f7a4c2429dd3c9060a1d2f412e41a5448bf4c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -398,6 +398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean collidingWithWorldBorder; // Paper
+ private boolean boundingBoxChanged = false; // KeYi
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -1034,6 +1035,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end - detailed watchdog information
public void move(MoverType movementType, Vec3 movement) {
+ // KeYi start
+ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) {
+ boundingBoxChanged = false;
+ return;
+ }
+ // KeYi end
+
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
synchronized (this.posLock) {
@@ -3824,6 +3832,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setBoundingBox(AABB boundingBox) {
+ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // KeYi
// CraftBukkit start - block invalid bounding boxes
double minX = boundingBox.minX,
minY = boundingBox.minY,

View File

@@ -1,791 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Fri, 27 Jan 2023 19:38:48 +0800
Subject: [PATCH] MikuServer: Async entity traveling
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/co/m2ek4u/aoame/AnotherTickThread.java b/src/main/java/co/m2ek4u/aoame/AnotherTickThread.java
new file mode 100644
index 0000000000000000000000000000000000000000..d5fe52beb25e7a95549cdf0ae19edf6029f10642
--- /dev/null
+++ b/src/main/java/co/m2ek4u/aoame/AnotherTickThread.java
@@ -0,0 +1,13 @@
+package co.m2ek4u.aoame;
+
+import io.papermc.paper.util.TickThread;
+
+public class AnotherTickThread extends TickThread {
+ public AnotherTickThread(String name) {
+ super(name);
+ }
+
+ public AnotherTickThread(Runnable run, String name) {
+ super(run, name);
+ }
+}
diff --git a/src/main/java/co/m2ek4u/aoame/CallbackExecutor.java b/src/main/java/co/m2ek4u/aoame/CallbackExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..b861405a7626ba8fa677c455bf6507253b33c157
--- /dev/null
+++ b/src/main/java/co/m2ek4u/aoame/CallbackExecutor.java
@@ -0,0 +1,99 @@
+package co.m2ek4u.aoame;
+
+import org.jetbrains.annotations.NotNull;
+import java.util.Queue;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.LockSupport;
+
+public class CallbackExecutor extends ThreadPoolExecutor {
+ private final AtomicBoolean isSubmittingStarted = new AtomicBoolean(false);
+ private final Queue<TaskEntry> submittedTasks = new ConcurrentLinkedDeque<>();
+
+ public CallbackExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
+ }
+
+ public CallbackExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue, @NotNull ThreadFactory threadFactory) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
+ }
+
+ public CallbackExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue, @NotNull RejectedExecutionHandler handler) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
+ }
+
+ public CallbackExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue, @NotNull ThreadFactory threadFactory, @NotNull RejectedExecutionHandler handler) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
+ }
+
+ public void startSubmitting(){
+ if (this.isSubmittingStarted.get()){
+ throw new IllegalStateException();
+ }
+ this.isSubmittingStarted.set(true);
+ }
+
+ public void awaitSubmittingEnd(){
+ while (this.isSubmittingStarted.get()){
+ LockSupport.parkNanos(this,1);
+ }
+ }
+
+ public void executeWithCallBack(Runnable command,Runnable callBack){
+ if (this.isSubmittingStarted.get()){
+ TaskEntry newTask = new TaskEntry(command,callBack);
+ this.execute(newTask::runMainTask);
+ this.submittedTasks.add(newTask);
+ return;
+ }
+ throw new IllegalStateException();
+ }
+
+ public boolean isSubmittingStarted(){
+ return this.isSubmittingStarted.get();
+ }
+
+ public void stopSubmitting(){
+ if (!this.isSubmittingStarted.get()){
+ throw new IllegalStateException();
+ }
+ this.isSubmittingStarted.set(false);
+ TaskEntry task;
+ while ((task = this.submittedTasks.poll())!=null){
+ while (!task.runSubTask()){
+ LockSupport.parkNanos(this,1);
+ }
+ }
+ }
+
+ private static class TaskEntry{
+ private final Runnable mainTask;
+ private final Runnable subTask;
+ private volatile boolean mainTaskFinished = false;
+
+ public TaskEntry(Runnable mainTask,Runnable subTask){
+ this.mainTask = mainTask;
+ this.subTask = subTask;
+ }
+
+ public void runMainTask(){
+ try {
+ this.mainTask.run();
+ }finally {
+ this.mainTaskFinished = true;
+ }
+ }
+
+ public boolean runSubTask(){
+ if (!this.mainTaskFinished){
+ return false;
+ }
+ try {
+ this.subTask.run();
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
index 0133ea6feb1ab88f021f66855669f58367e7420b..b128433d2888a98bce55052e821626c0478748dd 100644
--- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
@@ -1,6 +1,9 @@
package com.destroystokyo.paper.util.maplist;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.ObjectList;
+import it.unimi.dsi.fastutil.objects.ObjectLists;
import net.minecraft.world.entity.Entity;
import java.util.Arrays;
import java.util.Iterator;
@@ -12,117 +15,42 @@ import java.util.NoSuchElementException;
*/
public final class EntityList implements Iterable<Entity> {
- protected final Int2IntOpenHashMap entityToIndex = new Int2IntOpenHashMap(2, 0.8f);
- {
- this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
- }
-
- protected static final Entity[] EMPTY_LIST = new Entity[0];
-
- protected Entity[] entities = EMPTY_LIST;
- protected int count;
+ private final ObjectList<Entity> objectList = ObjectLists.synchronize(new ObjectArrayList<>());
public int size() {
- return this.count;
+ return this.objectList.size();
}
public boolean contains(final Entity entity) {
- return this.entityToIndex.containsKey(entity.getId());
+ return this.objectList.contains(entity);
}
public boolean remove(final Entity entity) {
- final int index = this.entityToIndex.remove(entity.getId());
- if (index == Integer.MIN_VALUE) {
- return false;
- }
-
- // move the entity at the end to this index
- final int endIndex = --this.count;
- final Entity end = this.entities[endIndex];
- if (index != endIndex) {
- // not empty after this call
- this.entityToIndex.put(end.getId(), index); // update index
- }
- this.entities[index] = end;
- this.entities[endIndex] = null;
-
- return true;
+ return this.objectList.remove(entity);
}
public boolean add(final Entity entity) {
- final int count = this.count;
- final int currIndex = this.entityToIndex.putIfAbsent(entity.getId(), count);
-
- if (currIndex != Integer.MIN_VALUE) {
- return false; // already in this list
- }
-
- Entity[] list = this.entities;
-
- if (list.length == count) {
- // resize required
- list = this.entities = Arrays.copyOf(list, (int)Math.max(4L, count * 2L)); // overflow results in negative
- }
-
- list[count] = entity;
- this.count = count + 1;
-
- return true;
+ return this.objectList.add(entity);
}
public Entity getChecked(final int index) {
- if (index < 0 || index >= this.count) {
- throw new IndexOutOfBoundsException("Index: " + index + " is out of bounds, size: " + this.count);
- }
- return this.entities[index];
+ return this.objectList.get(index);
}
public Entity getUnchecked(final int index) {
- return this.entities[index];
+ return this.objectList.get(index);
}
public Entity[] getRawData() {
- return this.entities;
+ return this.objectList.toArray(Entity[]::new);
}
public void clear() {
- this.entityToIndex.clear();
- Arrays.fill(this.entities, 0, this.count, null);
- this.count = 0;
+ this.objectList.clear();
}
@Override
public Iterator<Entity> iterator() {
- return new Iterator<Entity>() {
-
- Entity lastRet;
- int current;
-
- @Override
- public boolean hasNext() {
- return this.current < EntityList.this.count;
- }
-
- @Override
- public Entity next() {
- if (this.current >= EntityList.this.count) {
- throw new NoSuchElementException();
- }
- return this.lastRet = EntityList.this.entities[this.current++];
- }
-
- @Override
- public void remove() {
- final Entity lastRet = this.lastRet;
-
- if (lastRet == null) {
- throw new IllegalStateException();
- }
- this.lastRet = null;
-
- EntityList.this.remove(lastRet);
- --this.current;
- }
- };
+ return this.objectList.iterator();
}
}
diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
index 61c170555c8854b102c640b0b6a615f9f732edbf..ec90ff5c2581706180498b74dbbf960d52d47209 100644
--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
+++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
@@ -6,8 +6,14 @@ import io.papermc.paper.util.CoordinateUtils;
import io.papermc.paper.util.TickThread;
import io.papermc.paper.util.WorldUtil;
import io.papermc.paper.world.ChunkEntitySlices;
+import it.unimi.dsi.fastutil.ints.Int2ReferenceMap;
+import it.unimi.dsi.fastutil.ints.Int2ReferenceMaps;
import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap;
+import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
+import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.objects.Object2ReferenceMap;
+import it.unimi.dsi.fastutil.objects.Object2ReferenceMaps;
import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap;
import net.minecraft.core.BlockPos;
import io.papermc.paper.chunk.system.ChunkSystem;
@@ -26,11 +32,8 @@ import net.minecraft.world.phys.AABB;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.UUID;
+
+import java.util.*;
import java.util.concurrent.locks.StampedLock;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -46,15 +49,15 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
public final ServerLevel world;
private final StampedLock stateLock = new StampedLock();
- protected final Long2ObjectOpenHashMap<ChunkSlicesRegion> regions = new Long2ObjectOpenHashMap<>(128, 0.5f);
+ protected final Long2ObjectMap<ChunkSlicesRegion> regions = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>(128, 0.5f));
private final int minSection; // inclusive
private final int maxSection; // inclusive
private final LevelCallback<Entity> worldCallback;
private final StampedLock entityByLock = new StampedLock();
- private final Int2ReferenceOpenHashMap<Entity> entityById = new Int2ReferenceOpenHashMap<>();
- private final Object2ReferenceOpenHashMap<UUID, Entity> entityByUUID = new Object2ReferenceOpenHashMap<>();
+ private final Map<Integer,Entity> entityById = Int2ReferenceMaps.synchronize(new Int2ReferenceOpenHashMap<>());
+ private final Object2ReferenceMap<UUID, Entity> entityByUUID = Object2ReferenceMaps.synchronize(new Object2ReferenceOpenHashMap<>());
private final EntityList accessibleEntities = new EntityList();
public EntityLookup(final ServerLevel world, final LevelCallback<Entity> worldCallback) {
@@ -208,8 +211,8 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
public void get(final AABB box, final Consumer<Entity> action) {
List<Entity> entities = new ArrayList<>();
this.getEntitiesWithoutDragonParts(null, box, entities, null);
- for (int i = 0, len = entities.size(); i < len; ++i) {
- action.accept(entities.get(i));
+ for (Entity entity : entities) {
+ action.accept(entity);
}
}
@@ -217,8 +220,8 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
public <U extends Entity> void get(final EntityTypeTest<Entity, U> filter, final AABB box, final AbortableIterationConsumer<U> action) {
List<Entity> entities = new ArrayList<>();
this.getEntitiesWithoutDragonParts(null, box, entities, null);
- for (int i = 0, len = entities.size(); i < len; ++i) {
- final U casted = filter.tryCast(entities.get(i));
+ for (Entity entity : entities) {
+ final U casted = filter.tryCast(entity);
if (casted != null && action.accept(casted).shouldAbort()) {
break;
}
@@ -231,14 +234,14 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
if (entity.updatingSectionStatus) {
// recursive status update
- LOGGER.error("Cannot recursively update entity chunk status for entity " + entity, new Throwable());
+ LOGGER.warn("Cannot recursively update entity chunk status for entity " + entity);
return;
}
final boolean entityStatusUpdateBefore = slices == null ? false : slices.startPreventingStatusUpdates();
if (entityStatusUpdateBefore) {
- LOGGER.error("Cannot update chunk status for entity " + entity + " since entity chunk (" + slices.chunkX + "," + slices.chunkZ + ") is receiving update", new Throwable());
+ LOGGER.warn("Cannot update chunk status for entity " + entity + " since entity chunk (" + slices.chunkX + "," + slices.chunkZ + ") is receiving update");
return;
}
@@ -347,7 +350,7 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
}
if (entity.updatingSectionStatus) {
- LOGGER.warn("Entity " + entity + " is currently prevented from being added/removed to world since it is processing section status updates", new Throwable());
+ LOGGER.warn("Entity " + entity + " is currently prevented from being added/removed to world since it is processing section status updates");
return false;
}
diff --git a/src/main/java/io/papermc/paper/util/CachedLists.java b/src/main/java/io/papermc/paper/util/CachedLists.java
index e08f4e39db4ee3fed62e37364d17dcc5c5683504..22a5470862acfa470c9acd97c96fea29aede0b68 100644
--- a/src/main/java/io/papermc/paper/util/CachedLists.java
+++ b/src/main/java/io/papermc/paper/util/CachedLists.java
@@ -1,5 +1,6 @@
package io.papermc.paper.util;
+import com.google.common.collect.Lists;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.AABB;
import org.bukkit.Bukkit;
@@ -8,50 +9,18 @@ import java.util.List;
public final class CachedLists {
- // Paper start - optimise collisions
- static final UnsafeList<AABB> TEMP_COLLISION_LIST = new UnsafeList<>(1024);
- static boolean tempCollisionListInUse;
-
- public static UnsafeList<AABB> getTempCollisionList() {
- if (!Bukkit.isPrimaryThread() || tempCollisionListInUse) {
- return new UnsafeList<>(16);
- }
- tempCollisionListInUse = true;
- return TEMP_COLLISION_LIST;
- }
-
- public static void returnTempCollisionList(List<AABB> list) {
- if (list != TEMP_COLLISION_LIST) {
- return;
- }
- ((UnsafeList)list).setSize(0);
- tempCollisionListInUse = false;
+ public static List<AABB> getTempCollisionList() {
+ return Lists.newCopyOnWriteArrayList();
}
- static final UnsafeList<Entity> TEMP_GET_ENTITIES_LIST = new UnsafeList<>(1024);
- static boolean tempGetEntitiesListInUse;
+ public static void returnTempCollisionList(List<AABB> list) {}
- public static UnsafeList<Entity> getTempGetEntitiesList() {
- if (!Bukkit.isPrimaryThread() || tempGetEntitiesListInUse) {
- return new UnsafeList<>(16);
- }
- tempGetEntitiesListInUse = true;
- return TEMP_GET_ENTITIES_LIST;
+ public static List<Entity> getTempGetEntitiesList() {
+ return Lists.newCopyOnWriteArrayList();
}
- public static void returnTempGetEntitiesList(List<Entity> list) {
- if (list != TEMP_GET_ENTITIES_LIST) {
- return;
- }
- ((UnsafeList)list).setSize(0);
- tempGetEntitiesListInUse = false;
- }
+ public static void returnTempGetEntitiesList(List<Entity> list) {}
// Paper end - optimise collisions
- public static void reset() {
- // Paper start - optimise collisions
- TEMP_COLLISION_LIST.completeReset();
- TEMP_GET_ENTITIES_LIST.completeReset();
- // Paper end - optimise collisions
- }
+ public static void reset() {}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3b7e4b724e86518ea57f5ed5ef0b8b3741d10f6f..9601de5775667c2d94e07b89bb7605b1e03d413d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import co.m2ek4u.aoame.AnotherTickThread;
+import co.m2ek4u.aoame.CallbackExecutor;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import co.aikar.timings.Timings;
@@ -41,9 +43,8 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
@@ -284,6 +285,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected WorldData worldData;
private volatile boolean isSaving;
+ private final AtomicInteger threadId = new AtomicInteger();
+ public final CallbackExecutor asyncExecutor = new CallbackExecutor(
+ Runtime.getRuntime().availableProcessors(),
+ Runtime.getRuntime().availableProcessors(),
+ 50,
+ TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<>(),
+ task -> {
+ AnotherTickThread worker = new AnotherTickThread(task,"Entity-Async-Worker # "+threadId.getAndIncrement());
+ worker.setDaemon(true);
+ return worker;
+ }
+ );
+
// CraftBukkit start
public final WorldLoader.DataLoadContext worldLoader;
public org.bukkit.craftbukkit.CraftServer server;
@@ -1333,17 +1348,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} else {
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
if (this.haveTime()) {
- Iterator iterator = this.getAllLevels().iterator();
-
- while (iterator.hasNext()) {
- ServerLevel worldserver = (ServerLevel) iterator.next();
-
+ for (ServerLevel worldserver : this.getAllLevels()) {
if (worldserver.getChunkSource().pollTask()) {
ret = true; // Paper - force execution of all worlds, do not just bias the first
}
}
}
-
return ret; // Paper - force execution of all worlds, do not just bias the first
}
}
@@ -1393,6 +1403,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
+ if (this.asyncExecutor.isSubmittingStarted()){
+ this.asyncExecutor.stopSubmitting();
+ }
//co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur
long i = Util.getNanos();
@@ -1406,6 +1419,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
++this.tickCount;
+ this.asyncExecutor.startSubmitting();
this.tickChildren(shouldKeepTicking);
if (i - this.lastServerStatus >= 5000000000L) {
this.lastServerStatus = i;
@@ -1522,11 +1536,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
this.isIteratingOverLevels = true; // Paper
- Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
- while (iterator.hasNext()) {
- ServerLevel worldserver = (ServerLevel) iterator.next();
- worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
- worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ for (ServerLevel worldserver : this.getAllLevels()) {
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
/*this.profiler.push(() -> { // Purpur
@@ -1557,7 +1569,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
} catch (Throwable t) {
- if (throwable instanceof ThreadDeath) { throw (ThreadDeath)throwable; } // Paper
+ if (throwable instanceof ThreadDeath) {
+ throw (ThreadDeath) throwable;
+ } // Paper
throw new RuntimeException("Error generating crash report", t);
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 03b8ef3409fd5f7a4d4b06e13cf8eb22b3bbf8a1..824f26db01750866a2d9bbeefe17457f84d19504 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,5 +1,6 @@
package net.minecraft.server.level;
+import co.m2ek4u.aoame.AnotherTickThread;
import com.google.common.annotations.VisibleForTesting;
import co.aikar.timings.TimingHistory; // Paper
import com.google.common.collect.Lists;
@@ -269,7 +270,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority priority,
java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
- if (Thread.currentThread() != this.thread) {
+ if (Thread.currentThread() != this.thread && !(Thread.currentThread() instanceof AnotherTickThread)) {
this.getChunkSource().mainThreadProcessor.execute(() -> {
this.loadChunksForMoveAsync(axisalignedbb, priority, onLoad);
});
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 40dbf933504a46aa358ca4280c578fabf0651315..619730e2013b4c8907ba7b7e6927b57b4ac76ec7 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -44,6 +44,7 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -3420,51 +3421,102 @@ public abstract class LivingEntity extends Entity {
this.updateFallFlying();
AABB axisalignedbb = this.getBoundingBox();
- // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
- this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza));
- // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("freezing"); // Purpur
- boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
- int i;
+ if (this instanceof net.minecraft.world.entity.player.Player) {
+ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
+ this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza));
+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("freezing"); // Purpur
+ boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
+ int i;
- if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
- i = this.getTicksFrozen();
- if (this.isInPowderSnow && this.canFreeze()) {
- this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
- } else {
- this.setTicksFrozen(Math.max(0, i - 2));
+ if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
+ i = this.getTicksFrozen();
+ if (this.isInPowderSnow && this.canFreeze()) {
+ this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
+ } else {
+ this.setTicksFrozen(Math.max(0, i - 2));
+ }
}
- }
- this.removeFrost();
- this.tryAddFrost();
- if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
- i = flag1 ? 5 : 1;
- this.hurt(DamageSource.FREEZE, (float) i);
- }
+ this.removeFrost();
+ this.tryAddFrost();
+ if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
+ i = flag1 ? 5 : 1;
+ this.hurt(DamageSource.FREEZE, (float) i);
+ }
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("push"); // Purpur
- if (this.autoSpinAttackTicks > 0) {
- --this.autoSpinAttackTicks;
- this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
- }
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("push"); // Purpur
+ if (this.autoSpinAttackTicks > 0) {
+ --this.autoSpinAttackTicks;
+ this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
+ }
- this.pushEntities();
- //this.level.getProfiler().pop(); // Purpur
- // Paper start
- if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
- if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
- Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
- Location to = new Location (this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
- io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
- if (!event.callEvent()) {
- absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
- } else if (!to.equals(event.getTo())) {
- absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ this.pushEntities();
+ //this.level.getProfiler().pop(); // Purpur
+ // Paper start
+ if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
+ Location to = new Location(this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
+ if (!event.callEvent()) {
+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ } else if (!to.equals(event.getTo())) {
+ absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ }
}
}
+ } else {
+ MinecraftServer.getServer().asyncExecutor.executeWithCallBack(() -> {
+ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
+ this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza));
+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("freezing"); // Purpur
+ boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
+ int i;
+
+ if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
+ i = this.getTicksFrozen();
+ if (this.isInPowderSnow && this.canFreeze()) {
+ this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
+ } else {
+ this.setTicksFrozen(Math.max(0, i - 2));
+ }
+ }
+
+ this.removeFrost();
+ this.tryAddFrost();
+ if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
+ i = flag1 ? 5 : 1;
+ this.hurt(DamageSource.FREEZE, (float) i);
+ }
+
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("push"); // Purpur
+ if (this.autoSpinAttackTicks > 0) {
+ --this.autoSpinAttackTicks;
+ this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
+ }
+
+ this.pushEntities();
+ //this.level.getProfiler().pop(); // Purpur
+ }, () -> {
+ if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
+ Location to = new Location(this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
+ if (!event.callEvent()) {
+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ } else if (!to.equals(event.getTo())) {
+ absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ }
+ }
+ }
+ });
}
// Paper end
if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
index 9f138bc471b5c2a4fa813ff943dbe34018b8df74..5c8a90f8536c9291df5891d8c75de963b75ec4bd 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
@@ -7,6 +7,7 @@ import com.mojang.logging.LogUtils;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMaps;
import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
import java.util.List;
import java.util.Map;
@@ -25,8 +26,9 @@ import org.slf4j.Logger;
public class PoiSection {
private static final Logger LOGGER = LogUtils.getLogger();
- private final Short2ObjectMap<PoiRecord> records = new Short2ObjectOpenHashMap<>();
- private final Map<Holder<PoiType>, Set<PoiRecord>> byType = Maps.newHashMap(); public final Map<Holder<PoiType>, Set<PoiRecord>> getData() { return this.byType; } // Paper - public accessor
+ private final Short2ObjectMap<PoiRecord> records = Short2ObjectMaps.synchronize(new Short2ObjectOpenHashMap<>());
+ private final Map<Holder<PoiType>, Set<PoiRecord>> byType = Maps.newConcurrentMap();
+ public final Map<Holder<PoiType>, Set<PoiRecord>> getData() { return this.byType; } // Paper - public accessor
private final Runnable setDirty;
private boolean isValid;
public final Optional<PoiSection> noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java b/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java
index daa03360dd7044f10b20f36023b305dc7e0bb7df..f11cf0c0701247692075da2f2db7602e72ef1ec8 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java
@@ -19,17 +19,17 @@ public class LegacyRandomSource implements BitRandomSource {
}
@Override
- public RandomSource fork() {
+ public synchronized RandomSource fork() {
return new LegacyRandomSource(this.nextLong());
}
@Override
- public PositionalRandomFactory forkPositional() {
+ public synchronized PositionalRandomFactory forkPositional() {
return new LegacyRandomSource.LegacyPositionalRandomFactory(this.nextLong());
}
@Override
- public void setSeed(long seed) {
+ public synchronized void setSeed(long seed) {
if (!this.seed.compareAndSet(this.seed.get(), (seed ^ 25214903917L) & 281474976710655L)) {
throw ThreadingDetector.makeThreadingException("LegacyRandomSource", (Thread)null);
} else {
@@ -38,7 +38,7 @@ public class LegacyRandomSource implements BitRandomSource {
}
@Override
- public int next(int bits) {
+ public synchronized int next(int bits) {
long l = this.seed.get();
long m = l * 25214903917L + 11L & 281474976710655L;
if (!this.seed.compareAndSet(l, m)) {
@@ -49,7 +49,7 @@ public class LegacyRandomSource implements BitRandomSource {
}
@Override
- public double nextGaussian() {
+ public synchronized double nextGaussian() {
return this.gaussianSource.nextGaussian();
}

View File

@@ -1,620 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Fri, 27 Jan 2023 19:43:43 +0800
Subject: [PATCH] MikuServer: Async entity ai
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java b/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java
index 0fd814f1d65c111266a2b20f86561839a4cef755..fe4d76875462ac9d408c972b968647af78f2ed14 100644
--- a/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java
+++ b/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java
@@ -94,7 +94,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
return 1.0 - ((double)this.indexMap.size() / (double)this.listSize);
}
- public int createRawIterator() {
+ public synchronized int createRawIterator() {
if (this.allowSafeIteration()) {
++this.iteratorCount;
}
@@ -105,7 +105,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
}
}
- public int advanceRawIterator(final int index) {
+ public synchronized int advanceRawIterator(final int index) {
final E[] elements = this.listElements;
int ret = index + 1;
for (int len = this.listSize; ret < len; ++ret) {
@@ -117,7 +117,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
return -1;
}
- public void finishRawIterator() {
+ public synchronized void finishRawIterator() {
if (this.allowSafeIteration() && --this.iteratorCount == 0) {
if (this.getFragFactor() >= this.maxFragFactor) {
this.defrag();
@@ -125,7 +125,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
}
}
- public boolean remove(final E element) {
+ public synchronized boolean remove(final E element) {
final int index = this.indexMap.removeInt(element);
if (index >= 0) {
if (this.firstInvalidIndex < 0 || index < this.firstInvalidIndex) {
@@ -144,11 +144,11 @@ public final class IteratorSafeOrderedReferenceSet<E> {
return false;
}
- public boolean contains(final E element) {
+ public synchronized boolean contains(final E element) {
return this.indexMap.containsKey(element);
}
- public boolean add(final E element) {
+ public synchronized boolean add(final E element) {
final int listSize = this.listSize;
final int previous = this.indexMap.putIfAbsent(element, listSize);
@@ -223,30 +223,30 @@ public final class IteratorSafeOrderedReferenceSet<E> {
//this.check();
}
- public E rawGet(final int index) {
+ public synchronized E rawGet(final int index) {
return this.listElements[index];
}
- public int size() {
+ public synchronized int size() {
// always returns the correct amount - listSize can be different
return this.indexMap.size();
}
- public IteratorSafeOrderedReferenceSet.Iterator<E> iterator() {
+ public synchronized IteratorSafeOrderedReferenceSet.Iterator<E> iterator() {
return this.iterator(0);
}
- public IteratorSafeOrderedReferenceSet.Iterator<E> iterator(final int flags) {
+ public synchronized IteratorSafeOrderedReferenceSet.Iterator<E> iterator(final int flags) {
if (this.allowSafeIteration()) {
++this.iteratorCount;
}
return new BaseIterator<>(this, true, (flags & ITERATOR_FLAG_SEE_ADDITIONS) != 0 ? Integer.MAX_VALUE : this.listSize);
}
- public java.util.Iterator<E> unsafeIterator() {
+ public synchronized java.util.Iterator<E> unsafeIterator() {
return this.unsafeIterator(0);
}
- public java.util.Iterator<E> unsafeIterator(final int flags) {
+ public synchronized java.util.Iterator<E> unsafeIterator(final int flags) {
return new BaseIterator<>(this, false, (flags & ITERATOR_FLAG_SEE_ADDITIONS) != 0 ? Integer.MAX_VALUE : this.listSize);
}
@@ -273,7 +273,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
}
@Override
- public boolean hasNext() {
+ public synchronized boolean hasNext() {
if (this.finished) {
return false;
}
@@ -297,7 +297,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
}
@Override
- public E next() {
+ public synchronized E next() {
if (!this.hasNext()) {
throw new NoSuchElementException();
}
@@ -310,7 +310,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
}
@Override
- public void remove() {
+ public synchronized void remove() {
final E lastReturned = this.lastReturned;
if (lastReturned == null) {
throw new IllegalStateException();
@@ -320,7 +320,7 @@ public final class IteratorSafeOrderedReferenceSet<E> {
}
@Override
- public void finishedIterating() {
+ public synchronized void finishedIterating() {
if (this.finished || !this.canFinish) {
throw new IllegalStateException();
}
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
index f597d65d56964297eeeed6c7e77703764178fee0..b3bcafc8bafe1e4a1a2b690499b91e5316a604f1 100644
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
@@ -4,6 +4,7 @@ import com.destroystokyo.paper.util.maplist.EntityList;
import io.papermc.paper.chunk.system.entity.EntityLookup;
import io.papermc.paper.util.TickThread;
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMaps;
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ChunkHolder;
@@ -34,7 +35,7 @@ public final class ChunkEntitySlices {
protected final EntityCollectionBySection allEntities;
protected final EntityCollectionBySection hardCollidingEntities;
- protected final Reference2ObjectOpenHashMap<Class<? extends Entity>, EntityCollectionBySection> entitiesByClass;
+ protected final Reference2ObjectMap<Class<? extends Entity>, EntityCollectionBySection> entitiesByClass;
protected final EntityList entities = new EntityList();
public ChunkHolder.FullChunkStatus status;
@@ -61,7 +62,7 @@ public final class ChunkEntitySlices {
this.allEntities = new EntityCollectionBySection(this);
this.hardCollidingEntities = new EntityCollectionBySection(this);
- this.entitiesByClass = new Reference2ObjectOpenHashMap<>();
+ this.entitiesByClass = Reference2ObjectMaps.synchronize(new Reference2ObjectOpenHashMap<>());
this.status = status;
}
@@ -209,7 +210,7 @@ public final class ChunkEntitySlices {
}
for (final Iterator<Reference2ObjectMap.Entry<Class<? extends Entity>, EntityCollectionBySection>> iterator =
- this.entitiesByClass.reference2ObjectEntrySet().fastIterator(); iterator.hasNext();) {
+ this.entitiesByClass.reference2ObjectEntrySet().iterator(); iterator.hasNext();) {
final Reference2ObjectMap.Entry<Class<? extends Entity>, EntityCollectionBySection> entry = iterator.next();
if (entry.getKey().isInstance(entity)) {
@@ -234,7 +235,7 @@ public final class ChunkEntitySlices {
}
for (final Iterator<Reference2ObjectMap.Entry<Class<? extends Entity>, EntityCollectionBySection>> iterator =
- this.entitiesByClass.reference2ObjectEntrySet().fastIterator(); iterator.hasNext();) {
+ this.entitiesByClass.reference2ObjectEntrySet().iterator(); iterator.hasNext();) {
final Reference2ObjectMap.Entry<Class<? extends Entity>, EntityCollectionBySection> entry = iterator.next();
if (entry.getKey().isInstance(entity)) {
@@ -312,11 +313,11 @@ public final class ChunkEntitySlices {
this.storage = (E[])(cap <= 0 ? EMPTY : new Entity[cap]);
}
- public boolean isEmpty() {
+ public synchronized boolean isEmpty() {
return this.size == 0;
}
- public int size() {
+ public synchronized int size() {
return this.size;
}
@@ -328,7 +329,7 @@ public final class ChunkEntitySlices {
}
}
- public void add(final E entity) {
+ public synchronized void add(final E entity) {
final int idx = this.size++;
if (idx >= this.storage.length) {
this.resize();
@@ -338,7 +339,7 @@ public final class ChunkEntitySlices {
}
}
- public int indexOf(final E entity) {
+ public synchronized int indexOf(final E entity) {
final E[] storage = this.storage;
for (int i = 0, len = Math.min(this.storage.length, this.size); i < len; ++i) {
@@ -350,7 +351,7 @@ public final class ChunkEntitySlices {
return -1;
}
- public boolean remove(final E entity) {
+ public synchronized boolean remove(final E entity) {
final int idx = this.indexOf(entity);
if (idx == -1) {
return false;
@@ -367,7 +368,7 @@ public final class ChunkEntitySlices {
return true;
}
- public boolean has(final E entity) {
+ public synchronized boolean has(final E entity) {
return this.indexOf(entity) != -1;
}
}
@@ -388,7 +389,7 @@ public final class ChunkEntitySlices {
this.entitiesBySection = new BasicEntityList[sectionCount];
}
- public void addEntity(final Entity entity, final int sectionIndex) {
+ public synchronized void addEntity(final Entity entity, final int sectionIndex) {
BasicEntityList<Entity> list = this.entitiesBySection[sectionIndex];
if (list != null && list.has(entity)) {
@@ -404,7 +405,7 @@ public final class ChunkEntitySlices {
++this.count;
}
- public void removeEntity(final Entity entity, final int sectionIndex) {
+ public synchronized void removeEntity(final Entity entity, final int sectionIndex) {
final BasicEntityList<Entity> list = this.entitiesBySection[sectionIndex];
if (list == null || !list.remove(entity)) {
@@ -419,7 +420,7 @@ public final class ChunkEntitySlices {
}
}
- public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
+ public synchronized void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
if (this.count == 0) {
return;
}
@@ -457,7 +458,7 @@ public final class ChunkEntitySlices {
}
}
- public void getEntitiesWithEnderDragonParts(final Entity except, final AABB box, final List<Entity> into,
+ public synchronized void getEntitiesWithEnderDragonParts(final Entity except, final AABB box, final List<Entity> into,
final Predicate<? super Entity> predicate) {
if (this.count == 0) {
return;
@@ -508,7 +509,7 @@ public final class ChunkEntitySlices {
}
}
- public void getEntitiesWithEnderDragonParts(final Entity except, final Class<?> clazz, final AABB box, final List<Entity> into,
+ public synchronized void getEntitiesWithEnderDragonParts(final Entity except, final Class<?> clazz, final AABB box, final List<Entity> into,
final Predicate<? super Entity> predicate) {
if (this.count == 0) {
return;
@@ -559,7 +560,7 @@ public final class ChunkEntitySlices {
}
}
- public <T extends Entity> void getEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
+ public synchronized <T extends Entity> void getEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
final Predicate<? super T> predicate) {
if (this.count == 0) {
return;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index beb7c22cb63021f26c06f91050361e1b25fcc72d..07b2cd85956dda47ed0a026cd837c5b9498213ac 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -25,8 +25,8 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry;
import it.unimi.dsi.fastutil.longs.LongIterator;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
-import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator;
-import it.unimi.dsi.fastutil.objects.ObjectIterator;
+import it.unimi.dsi.fastutil.objects.*;
+
import java.io.IOException;
import java.io.Writer;
import java.nio.file.Path;
@@ -52,6 +52,7 @@ import java.util.function.IntSupplier;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
+
import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
@@ -113,7 +114,6 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
import org.bukkit.entity.Player;
// CraftBukkit end
-import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
@@ -153,7 +153,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Queue<Runnable> unloadQueue;
int viewDistance;
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper
- public final ReferenceOpenHashSet<ChunkHolder> needsChangeBroadcasting = new ReferenceOpenHashSet<>();
+ public final ReferenceSet<ChunkHolder> needsChangeBroadcasting = ReferenceSets.synchronize(new ReferenceOpenHashSet<>());
// Paper - rewrite chunk system
// Paper start - optimise checkDespawn
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0ae45cf5a084fd412305e8b2f5dabe608b4eb1c1..686852f5cb6303381c45a673a0daf79a2d3a9dfe 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -6,12 +6,7 @@ import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Either;
import java.io.File;
import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.BooleanSupplier;
@@ -803,7 +798,7 @@ public class ServerChunkCache extends ChunkSource {
//gameprofilerfiller.popPush("broadcast"); // Purpur
//this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
- ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
+ List<ChunkHolder> copy = new ArrayList<>(this.chunkMap.needsChangeBroadcasting);
this.chunkMap.needsChangeBroadcasting.clear();
for (ChunkHolder holder : copy) {
holder.broadcastChanges(holder.getFullChunkNowUnchecked()); // LevelChunks are NEVER unloaded
diff --git a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
index 50a9f33aa31e9273c7c52d4bb2b02f0f884f7ba5..b7cd7b4bb7a2fb58dd907428f7e03662ef5e5c29 100644
--- a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
+++ b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
@@ -13,9 +13,9 @@ import java.util.Map;
import java.util.stream.Collectors;
public class ClassInstanceMultiMap<T> extends AbstractCollection<T> {
- private final Map<Class<?>, List<T>> byClass = Maps.newHashMap();
+ private final Map<Class<?>, List<T>> byClass = Maps.newConcurrentMap();
private final Class<T> baseClass;
- private final List<T> allInstances = Lists.newArrayList();
+ private final List<T> allInstances = Lists.newCopyOnWriteArrayList();
public ClassInstanceMultiMap(Class<T> elementType) {
this.baseClass = elementType;
@@ -23,7 +23,7 @@ public class ClassInstanceMultiMap<T> extends AbstractCollection<T> {
}
@Override
- public boolean add(T object) {
+ public synchronized boolean add(T object) {
boolean bl = false;
for(Map.Entry<Class<?>, List<T>> entry : this.byClass.entrySet()) {
@@ -36,7 +36,7 @@ public class ClassInstanceMultiMap<T> extends AbstractCollection<T> {
}
@Override
- public boolean remove(Object object) {
+ public synchronized boolean remove(Object object) {
boolean bl = false;
for(Map.Entry<Class<?>, List<T>> entry : this.byClass.entrySet()) {
@@ -50,32 +50,32 @@ public class ClassInstanceMultiMap<T> extends AbstractCollection<T> {
}
@Override
- public boolean contains(Object object) {
+ public synchronized boolean contains(Object object) {
return this.find(object.getClass()).contains(object);
}
- public <S> Collection<S> find(Class<S> type) {
+ public synchronized <S> Collection<S> find(Class<S> type) {
if (!this.baseClass.isAssignableFrom(type)) {
throw new IllegalArgumentException("Don't know how to search for " + type);
} else {
List<? extends T> list = this.byClass.computeIfAbsent(type, (typeClass) -> {
return this.allInstances.stream().filter(typeClass::isInstance).collect(Collectors.toList());
});
- return Collections.unmodifiableCollection(list);
+ return (Collection<S>) Collections.unmodifiableCollection(list);
}
}
@Override
- public Iterator<T> iterator() {
+ public synchronized Iterator<T> iterator() {
return (Iterator<T>)(this.allInstances.isEmpty() ? Collections.emptyIterator() : Iterators.unmodifiableIterator(this.allInstances.iterator()));
}
- public List<T> getAllInstances() {
+ public synchronized List<T> getAllInstances() {
return ImmutableList.copyOf(this.allInstances);
}
@Override
- public int size() {
+ public synchronized int size() {
return this.allInstances.size();
}
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 29fa9ad2223de668c15a5e5b433704b2c4765610..9071abd67c421a528514a6437a1b8dde02e068ed 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -23,6 +23,7 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
@@ -216,12 +217,14 @@ public abstract class Mob extends LivingEntity {
public void inactiveTick() {
super.inactiveTick();
boolean isThrottled = gg.pufferfish.pufferfish.PufferfishConfig.throttleInactiveGoalSelectorTick && _pufferfish_inactiveTickDisableCounter++ % 20 != 0; // Pufferfish - throttle inactive goal selector ticking
- if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking
- this.goalSelector.tick();
- }
- if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority
- this.targetSelector.tick();
- }
+ MinecraftServer.getServer().asyncExecutor.executeWithCallBack(()->{
+ if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking
+ this.goalSelector.tick();
+ }
+ if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority
+ this.targetSelector.tick();
+ }
+ },()->{});
}
// Paper end
@@ -878,42 +881,43 @@ public abstract class Mob extends LivingEntity {
if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
//this.level.getProfiler().pop(); // Purpur
- if (i % 2 != 0 && this.tickCount > 1) {
- //this.level.getProfiler().push("targetSelector"); // Purpur
- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.targetSelector.tickRunningGoals(false);
+ MinecraftServer.getServer().asyncExecutor.executeWithCallBack(() -> {
+ if (i % 2 != 0 && this.tickCount > 1) {
+ //this.level.getProfiler().push("targetSelector"); // Purpur
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.targetSelector.tickRunningGoals(false);
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("goalSelector"); // Purpur
+ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.goalSelector.tickRunningGoals(false);
+ //this.level.getProfiler().pop(); // Purpur
+ } else {
+ //this.level.getProfiler().push("targetSelector"); // Purpur
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.targetSelector.tick();
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("goalSelector"); // Purpur
+ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.goalSelector.tick();
+ //this.level.getProfiler().pop(); // Purpur
+ }
+
+ //this.level.getProfiler().push("navigation"); // Purpur
+ this.navigation.tick();
//this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("goalSelector"); // Purpur
- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.goalSelector.tickRunningGoals(false);
+ //this.level.getProfiler().push("mob tick"); // Purpur
+ this.customServerAiStep();
//this.level.getProfiler().pop(); // Purpur
- } else {
- //this.level.getProfiler().push("targetSelector"); // Purpur
- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.targetSelector.tick();
+ //this.level.getProfiler().push("controls"); // Purpur
+ //this.level.getProfiler().push("move"); // Purpur
+ this.moveControl.tick();
+ //this.level.getProfiler().popPush("look"); // Purpur
+ this.lookControl.tick();
+ //this.level.getProfiler().popPush("jump"); // Purpur
+ this.jumpControl.tick();
//this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("goalSelector"); // Purpur
- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.goalSelector.tick();
//this.level.getProfiler().pop(); // Purpur
- }
-
- //this.level.getProfiler().push("navigation"); // Purpur
- this.navigation.tick();
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("mob tick"); // Purpur
- this.customServerAiStep();
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("controls"); // Purpur
- //this.level.getProfiler().push("move"); // Purpur
- this.moveControl.tick();
- //this.level.getProfiler().popPush("look"); // Purpur
- this.lookControl.tick();
- //this.level.getProfiler().popPush("jump"); // Purpur
- this.jumpControl.tick();
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().pop(); // Purpur
- this.sendDebugPackets();
+ }, this::sendDebugPackets);
}
protected void sendDebugPackets() {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 2d222e383d48a1a32eebdb722d770b4fc6c0aca7..eb5257fabef397566e784247922fb27e61f96313 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -274,16 +274,18 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (this.getUnhappyCounter() > 0) {
this.setUnhappyCounter(this.getUnhappyCounter() - 1);
}
- if (this.isEffectiveAi()) {
- if (level.spigotConfig.tickInactiveVillagers) {
- this.customServerAiStep();
- } else {
- this.mobTick(true);
+ MinecraftServer.getServer().asyncExecutor.executeWithCallBack(()->{
+ if (this.isEffectiveAi()) {
+ if (level.spigotConfig.tickInactiveVillagers) {
+ this.customServerAiStep();
+ } else {
+ this.mobTick(true);
+ }
}
- }
- maybeDecayGossip();
+ },()->{
+ maybeDecayGossip();
+ });
// Paper end
-
super.inactiveTick();
}
// Spigot End
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index b1c594dc6a6b8a6c737b99272acab9e7dbd0ed63..4aedee56077159aaf613033b688d2be6833f1ad1 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -3,7 +3,10 @@ package net.minecraft.world.level.redstone;
import com.mojang.logging.LogUtils;
import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.Deque;
import java.util.List;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.CopyOnWriteArrayList;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@@ -16,8 +19,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
private static final Logger LOGGER = LogUtils.getLogger();
private final Level level;
private final int maxChainedNeighborUpdates;
- private final ArrayDeque<CollectingNeighborUpdater.NeighborUpdates> stack = new ArrayDeque<>();
- private final List<CollectingNeighborUpdater.NeighborUpdates> addedThisLayer = new ArrayList<>();
+ private final Deque<NeighborUpdates> stack = new ConcurrentLinkedDeque<>();
+ private final List<CollectingNeighborUpdater.NeighborUpdates> addedThisLayer = new CopyOnWriteArrayList<>();
private int count = 0;
public CollectingNeighborUpdater(Level world, int maxChainDepth) {
@@ -26,22 +29,22 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
}
@Override
- public void shapeUpdate(Direction direction, BlockState neighborState, BlockPos pos, BlockPos neighborPos, int flags, int maxUpdateDepth) {
+ public synchronized void shapeUpdate(Direction direction, BlockState neighborState, BlockPos pos, BlockPos neighborPos, int flags, int maxUpdateDepth) {
this.addAndRun(pos, new CollectingNeighborUpdater.ShapeUpdate(direction, neighborState, pos.immutable(), neighborPos.immutable(), flags));
}
@Override
- public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos sourcePos) {
+ public synchronized void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos sourcePos) {
this.addAndRun(pos, new CollectingNeighborUpdater.SimpleNeighborUpdate(pos, sourceBlock, sourcePos.immutable()));
}
@Override
- public void neighborChanged(BlockState state, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
+ public synchronized void neighborChanged(BlockState state, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
this.addAndRun(pos, new CollectingNeighborUpdater.FullNeighborUpdate(state, pos.immutable(), sourceBlock, sourcePos.immutable(), notify));
}
@Override
- public void updateNeighborsAtExceptFromFacing(BlockPos pos, Block sourceBlock, @Nullable Direction except) {
+ public synchronized void updateNeighborsAtExceptFromFacing(BlockPos pos, Block sourceBlock, @Nullable Direction except) {
this.addAndRun(pos, new CollectingNeighborUpdater.MultiNeighborUpdate(pos.immutable(), sourceBlock, except));
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,306 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Fri, 27 Jan 2023 19:55:14 +0800
Subject: [PATCH] MikuServer: Code error fix
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
index 15eeea40bb7a44470f6f3f0e2473cb451812eec1..c256b6175f8b859883b849c6cd623f680b78be32 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
@@ -2,7 +2,6 @@ package io.papermc.paper.chunk.system.scheduling;
import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
import ca.spottedleaf.concurrentutil.map.SWMRLong2ObjectHashTable;
-import co.aikar.timings.Timing;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@@ -29,8 +28,6 @@ import net.minecraft.server.level.TicketType;
import net.minecraft.util.SortedArraySet;
import net.minecraft.util.Unit;
import net.minecraft.world.level.ChunkPos;
-import net.minecraft.world.level.chunk.ChunkAccess;
-import net.minecraft.world.level.chunk.ChunkStatus;
import org.bukkit.plugin.Plugin;
import org.slf4j.Logger;
import java.io.IOException;
diff --git a/src/main/java/io/papermc/paper/util/misc/Delayed26WayDistancePropagator3D.java b/src/main/java/io/papermc/paper/util/misc/Delayed26WayDistancePropagator3D.java
index 470402573bc31106d5a63e415b958fb7f9c36aa9..e831738a2988746fe4e065f6ded811a8bdf5dabe 100644
--- a/src/main/java/io/papermc/paper/util/misc/Delayed26WayDistancePropagator3D.java
+++ b/src/main/java/io/papermc/paper/util/misc/Delayed26WayDistancePropagator3D.java
@@ -94,24 +94,42 @@ public final class Delayed26WayDistancePropagator3D {
protected final void addToIncreaseWorkQueue(final long coordinate, final byte level) {
final Delayed8WayDistancePropagator2D.WorkQueue queue = this.levelIncreaseWorkQueues[level];
- queue.queuedCoordinates.enqueue(coordinate);
- queue.queuedLevels.enqueue(level);
+
+ final long id = queue.lock.writeLock();
+ try {
+ queue.queuedCoordinates.add(coordinate);
+ queue.queuedLevels.add(level);
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
this.levelIncreaseWorkQueueBitset |= (1L << level);
}
protected final void addToIncreaseWorkQueue(final long coordinate, final byte index, final byte level) {
final Delayed8WayDistancePropagator2D.WorkQueue queue = this.levelIncreaseWorkQueues[index];
- queue.queuedCoordinates.enqueue(coordinate);
- queue.queuedLevels.enqueue(level);
+
+ final long id = queue.lock.writeLock();
+ try {
+ queue.queuedCoordinates.add(coordinate);
+ queue.queuedLevels.add(level);
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
this.levelIncreaseWorkQueueBitset |= (1L << index);
}
protected final void addToRemoveWorkQueue(final long coordinate, final byte level) {
final Delayed8WayDistancePropagator2D.WorkQueue queue = this.levelRemoveWorkQueues[level];
- queue.queuedCoordinates.enqueue(coordinate);
- queue.queuedLevels.enqueue(level);
+
+ final long id = queue.lock.writeLock();
+ try {
+ queue.queuedCoordinates.add(coordinate);
+ queue.queuedLevels.add(level);
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
this.levelRemoveWorkQueueBitset |= (1L << level);
}
@@ -163,9 +181,20 @@ public final class Delayed26WayDistancePropagator3D {
this.levelIncreaseWorkQueueBitset ^= (1L << queueIndex), queueIndex = 63 ^ Long.numberOfLeadingZeros(this.levelIncreaseWorkQueueBitset)) {
final Delayed8WayDistancePropagator2D.WorkQueue queue = this.levelIncreaseWorkQueues[queueIndex];
- while (!queue.queuedLevels.isEmpty()) {
- final long coordinate = queue.queuedCoordinates.removeFirstLong();
- byte level = queue.queuedLevels.removeFirstByte();
+ while (true) {
+
+ long coordinate;
+ byte level;
+ final long id = queue.lock.writeLock();
+ try {
+ if (queue.queuedLevels.isEmpty()){
+ break;
+ }
+ coordinate = queue.queuedCoordinates.removeFirst();
+ level = queue.queuedLevels.removeFirst();
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
final boolean neighbourCheck = level < 0;
@@ -232,9 +261,19 @@ public final class Delayed26WayDistancePropagator3D {
this.levelRemoveWorkQueueBitset ^= (1L << queueIndex), queueIndex = 63 ^ Long.numberOfLeadingZeros(this.levelRemoveWorkQueueBitset)) {
final Delayed8WayDistancePropagator2D.WorkQueue queue = this.levelRemoveWorkQueues[queueIndex];
- while (!queue.queuedLevels.isEmpty()) {
- final long coordinate = queue.queuedCoordinates.removeFirstLong();
- final byte level = queue.queuedLevels.removeFirstByte();
+ while (true) {
+ long coordinate;
+ byte level;
+ final long id = queue.lock.writeLock();
+ try {
+ if (queue.queuedLevels.isEmpty()){
+ break;
+ }
+ coordinate = queue.queuedCoordinates.removeFirst();
+ level = queue.queuedLevels.removeFirst();
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
final byte currentLevel = this.levels.removeIfGreaterOrEqual(coordinate, level);
if (currentLevel == 0) {
diff --git a/src/main/java/io/papermc/paper/util/misc/Delayed8WayDistancePropagator2D.java b/src/main/java/io/papermc/paper/util/misc/Delayed8WayDistancePropagator2D.java
index 808d1449ac44ae86a650932365081fbaf178d141..0fa95d81bafc7fe5c1bede7a0608b54795a78fa0 100644
--- a/src/main/java/io/papermc/paper/util/misc/Delayed8WayDistancePropagator2D.java
+++ b/src/main/java/io/papermc/paper/util/misc/Delayed8WayDistancePropagator2D.java
@@ -1,12 +1,14 @@
package io.papermc.paper.util.misc;
+import io.papermc.paper.util.MCUtil;
import it.unimi.dsi.fastutil.HashCommon;
-import it.unimi.dsi.fastutil.bytes.ByteArrayFIFOQueue;
import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap;
-import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue;
import it.unimi.dsi.fastutil.longs.LongIterator;
import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet;
-import io.papermc.paper.util.MCUtil;
+
+import java.util.Deque;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.locks.StampedLock;
public final class Delayed8WayDistancePropagator2D {
@@ -356,24 +358,42 @@ public final class Delayed8WayDistancePropagator2D {
protected final void addToIncreaseWorkQueue(final long coordinate, final byte level) {
final WorkQueue queue = this.levelIncreaseWorkQueues[level];
- queue.queuedCoordinates.enqueue(coordinate);
- queue.queuedLevels.enqueue(level);
+
+ final long id = queue.lock.writeLock();
+ try {
+ queue.queuedCoordinates.add(coordinate);
+ queue.queuedLevels.add(level);
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
this.levelIncreaseWorkQueueBitset |= (1L << level);
}
protected final void addToIncreaseWorkQueue(final long coordinate, final byte index, final byte level) {
final WorkQueue queue = this.levelIncreaseWorkQueues[index];
- queue.queuedCoordinates.enqueue(coordinate);
- queue.queuedLevels.enqueue(level);
+
+ final long id = queue.lock.writeLock();
+ try {
+ queue.queuedCoordinates.add(coordinate);
+ queue.queuedLevels.add(level);
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
this.levelIncreaseWorkQueueBitset |= (1L << index);
}
protected final void addToRemoveWorkQueue(final long coordinate, final byte level) {
final WorkQueue queue = this.levelRemoveWorkQueues[level];
- queue.queuedCoordinates.enqueue(coordinate);
- queue.queuedLevels.enqueue(level);
+
+ final long id = queue.lock.writeLock();
+ try {
+ queue.queuedCoordinates.add(coordinate);
+ queue.queuedLevels.add(level);
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
this.levelRemoveWorkQueueBitset |= (1L << level);
}
@@ -425,9 +445,19 @@ public final class Delayed8WayDistancePropagator2D {
this.levelIncreaseWorkQueueBitset ^= (1L << queueIndex), queueIndex = 63 ^ Long.numberOfLeadingZeros(this.levelIncreaseWorkQueueBitset)) {
final WorkQueue queue = this.levelIncreaseWorkQueues[queueIndex];
- while (!queue.queuedLevels.isEmpty()) {
- final long coordinate = queue.queuedCoordinates.removeFirstLong();
- byte level = queue.queuedLevels.removeFirstByte();
+ while (true) {
+ byte level;
+ long coordinate;
+ final long id = queue.lock.writeLock();
+ try {
+ if (queue.queuedLevels.isEmpty()){
+ break;
+ }
+ coordinate = queue.queuedCoordinates.removeFirst();
+ level = queue.queuedLevels.removeFirst();
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
final boolean neighbourCheck = level < 0;
@@ -491,9 +521,20 @@ public final class Delayed8WayDistancePropagator2D {
this.levelRemoveWorkQueueBitset ^= (1L << queueIndex), queueIndex = 63 ^ Long.numberOfLeadingZeros(this.levelRemoveWorkQueueBitset)) {
final WorkQueue queue = this.levelRemoveWorkQueues[queueIndex];
- while (!queue.queuedLevels.isEmpty()) {
- final long coordinate = queue.queuedCoordinates.removeFirstLong();
- final byte level = queue.queuedLevels.removeFirstByte();
+ while (true) {
+ long coordinate;
+ byte level;
+
+ final long id = queue.lock.writeLock();
+ try {
+ if (queue.queuedLevels.isEmpty()){
+ break;
+ }
+ coordinate = queue.queuedCoordinates.removeFirst();
+ level = queue.queuedLevels.removeFirst();
+ }finally {
+ queue.lock.unlockWrite(id);
+ }
final byte currentLevel = this.levels.removeIfGreaterOrEqual(coordinate, level);
if (currentLevel == 0) {
@@ -678,41 +719,9 @@ public final class Delayed8WayDistancePropagator2D {
}
protected static final class WorkQueue {
-
- public final NoResizeLongArrayFIFODeque queuedCoordinates = new NoResizeLongArrayFIFODeque();
- public final NoResizeByteArrayFIFODeque queuedLevels = new NoResizeByteArrayFIFODeque();
-
+ public final Deque<Long> queuedCoordinates = new ConcurrentLinkedDeque<>();
+ public final Deque<Byte> queuedLevels = new ConcurrentLinkedDeque<>();
+ public final StampedLock lock = new StampedLock();
}
- protected static final class NoResizeLongArrayFIFODeque extends LongArrayFIFOQueue {
-
- /**
- * Assumes non-empty. If empty, undefined behaviour.
- */
- public long removeFirstLong() {
- // copied from superclass
- long t = this.array[this.start];
- if (++this.start == this.length) {
- this.start = 0;
- }
-
- return t;
- }
- }
-
- protected static final class NoResizeByteArrayFIFODeque extends ByteArrayFIFOQueue {
-
- /**
- * Assumes non-empty. If empty, undefined behaviour.
- */
- public byte removeFirstByte() {
- // copied from superclass
- byte t = this.array[this.start];
- if (++this.start == this.length) {
- this.start = 0;
- }
-
- return t;
- }
- }
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 8950b220b9a3512cd4667beb7bdec0e82e07edc6..91fe5898270495aa89586b74ebfd649ef1e0b342 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -4,8 +4,7 @@ import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
import it.unimi.dsi.fastutil.longs.Long2ByteMap;
import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap;
-import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
-import it.unimi.dsi.fastutil.longs.LongSet;
+
import java.nio.file.Path;
import java.util.Comparator;
import java.util.List;

View File

@@ -1,254 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Fri, 27 Jan 2023 20:31:46 +0800
Subject: [PATCH] MikuServer: Bug fixes in CPS and Pathfinding
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 686852f5cb6303381c45a673a0daf79a2d3a9dfe..d023e6347e78bde17c67ed299504a081fe895858 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -843,12 +843,11 @@ public class ServerChunkCache extends ChunkSource {
if (chunkMap.playerMobDistanceMap != null && _pufferfish_spawnCountsReady.getAndSet(false)) {
net.minecraft.server.MinecraftServer.getServer().mobSpawnExecutor.submit(() -> {
int mapped = distanceManager.getNaturalSpawnChunkCount();
- io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Entity> objectiterator =
- level.entityTickList.entities.iterator(io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.ITERATOR_FLAG_SEE_ADDITIONS);
+ Iterator<Entity> objectiterator =
+ level.entityTickList.entities.iterator();
gg.pufferfish.pufferfish.util.IterableWrapper<Entity> wrappedIterator =
new gg.pufferfish.pufferfish.util.IterableWrapper<>(objectiterator);
lastSpawnState = NaturalSpawner.createState(mapped, wrappedIterator, this::getFullChunk, null, true);
- objectiterator.finishedIterating();
_pufferfish_spawnCountsReady.set(true);
});
}
@@ -1031,9 +1030,11 @@ public class ServerChunkCache extends ChunkSource {
@Override
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() {
- ServerChunkCache.this.chunkMap.playerChunkManager.tickMidTick();
- if (ServerChunkCache.this.runDistanceManagerUpdates()) {
- return true;
+ synchronized (this){
+ ServerChunkCache.this.chunkMap.playerChunkManager.tickMidTick();
+ if (ServerChunkCache.this.runDistanceManagerUpdates()) {
+ return true;
+ }
}
return super.pollTask() | ServerChunkCache.this.level.chunkTaskScheduler.executeMainThreadTask(); // Paper - rewrite chunk system
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 619730e2013b4c8907ba7b7e6927b57b4ac76ec7..f5aff6d724185e1ada8736bdb6dd12b143812e83 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3029,7 +3029,7 @@ public abstract class LivingEntity extends Entity {
}
if (!this.isRemoved()) {
- this.aiStep();
+ MinecraftServer.getServer().asyncExecutor.executeWithCallBack(this::aiStep,()->{});
}
double d0 = this.getX() - this.xo;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 9071abd67c421a528514a6437a1b8dde02e068ed..ed645b74bfc6e3cffe75cb4e30277cd5e98ca9c1 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -881,43 +881,42 @@ public abstract class Mob extends LivingEntity {
if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
//this.level.getProfiler().pop(); // Purpur
- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(() -> {
- if (i % 2 != 0 && this.tickCount > 1) {
- //this.level.getProfiler().push("targetSelector"); // Purpur
- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.targetSelector.tickRunningGoals(false);
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("goalSelector"); // Purpur
- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.goalSelector.tickRunningGoals(false);
- //this.level.getProfiler().pop(); // Purpur
- } else {
- //this.level.getProfiler().push("targetSelector"); // Purpur
- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.targetSelector.tick();
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("goalSelector"); // Purpur
- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
- this.goalSelector.tick();
- //this.level.getProfiler().pop(); // Purpur
- }
-
- //this.level.getProfiler().push("navigation"); // Purpur
- this.navigation.tick();
+ if (i % 2 != 0 && this.tickCount > 1) {
+ //this.level.getProfiler().push("targetSelector"); // Purpur
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.targetSelector.tickRunningGoals(false);
//this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("mob tick"); // Purpur
- this.customServerAiStep();
+ //this.level.getProfiler().push("goalSelector"); // Purpur
+ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.goalSelector.tickRunningGoals(false);
//this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("controls"); // Purpur
- //this.level.getProfiler().push("move"); // Purpur
- this.moveControl.tick();
- //this.level.getProfiler().popPush("look"); // Purpur
- this.lookControl.tick();
- //this.level.getProfiler().popPush("jump"); // Purpur
- this.jumpControl.tick();
+ } else {
+ //this.level.getProfiler().push("targetSelector"); // Purpur
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.targetSelector.tick();
//this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("goalSelector"); // Purpur
+ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+ this.goalSelector.tick();
//this.level.getProfiler().pop(); // Purpur
- }, this::sendDebugPackets);
+ }
+
+ //this.level.getProfiler().push("navigation"); // Purpur
+ this.navigation.tick();
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("mob tick"); // Purpur
+ this.customServerAiStep();
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("controls"); // Purpur
+ //this.level.getProfiler().push("move"); // Purpur
+ this.moveControl.tick();
+ //this.level.getProfiler().popPush("look"); // Purpur
+ this.lookControl.tick();
+ //this.level.getProfiler().popPush("jump"); // Purpur
+ this.jumpControl.tick();
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().pop(); // Purpur
+ this.sendDebugPackets();
}
protected void sendDebugPackets() {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java.rej b/src/main/java/net/minecraft/world/entity/Mob.java.rej
new file mode 100644
index 0000000000000000000000000000000000000000..68eddcd9c30a0b4ab690fc54de481847107cef00
--- /dev/null
+++ b/src/main/java/net/minecraft/world/entity/Mob.java.rej
@@ -0,0 +1,59 @@
+diff a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java (rejected hunks)
+@@ -910,32 +910,31 @@ public abstract class Mob extends LivingEntity {
+ //this.level.getProfiler().pop(); // Purpur
+ int i = this.level.getServer().getTickCount() + this.getId();
+
+- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(()->{
+- if (i % 2 != 0 && this.tickCount > 1) {
+- //this.level.getProfiler().push("targetSelector"); // Purpur
+- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+- this.targetSelector.tickRunningGoals(false);
+- //this.level.getProfiler().pop(); // Purpur
+- //this.level.getProfiler().push("goalSelector"); // Purpur
+- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+- this.goalSelector.tickRunningGoals(false);
+- //this.level.getProfiler().pop(); // Purpur
+- } else {
+- //this.level.getProfiler().push("targetSelector"); // Purpur
+- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+- this.targetSelector.tick();
+- //this.level.getProfiler().pop(); // Purpur
+- //this.level.getProfiler().push("goalSelector"); // Purpur
+- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
+- this.goalSelector.tick();
+- //this.level.getProfiler().pop(); // Purpur
+- }
+- this.navigation.tick();
+- this.customServerAiStep();
+- this.moveControl.tick();
+- this.lookControl.tick();
+- this.jumpControl.tick();
+- }, this::sendDebugPackets);
++ if (i % 2 != 0 && this.tickCount > 1) {
++ //this.level.getProfiler().push("targetSelector"); // Purpur
++ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
++ this.targetSelector.tickRunningGoals(false);
++ //this.level.getProfiler().pop(); // Purpur
++ //this.level.getProfiler().push("goalSelector"); // Purpur
++ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
++ this.goalSelector.tickRunningGoals(false);
++ //this.level.getProfiler().pop(); // Purpur
++ } else {
++ //this.level.getProfiler().push("targetSelector"); // Purpur
++ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
++ this.targetSelector.tick();
++ //this.level.getProfiler().pop(); // Purpur
++ //this.level.getProfiler().push("goalSelector"); // Purpur
++ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
++ this.goalSelector.tick();
++ //this.level.getProfiler().pop(); // Purpur
++ }
++ this.navigation.tick();
++ this.customServerAiStep();
++ this.moveControl.tick();
++ this.lookControl.tick();
++ this.jumpControl.tick();
++ this.sendDebugPackets();
+ }
+
+ protected void sendDebugPackets() {
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
index 57fcf3910f45ce371ac2e237b277b1034caaac4e..13f5950bfffe49ffc3b9e57b5f6f674c70ba5e80 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
@@ -1,14 +1,18 @@
package net.minecraft.world.level.entity;
+import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
+
+import java.util.Iterator;
+import java.util.List;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import net.minecraft.world.entity.Entity;
public class EntityTickList {
- public final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking? // Pufferfish - private->public
+ public final List<Entity> entities = Lists.newCopyOnWriteArrayList();
private void ensureActiveIsNotIterated() {
// Paper - replace with better logic, do not delay removals
@@ -36,13 +40,9 @@ public class EntityTickList {
// Paper start - replace with better logic, do not delay removals/additions
// To ensure nothing weird happens with dimension travelling, do not iterate over new entries...
// (by dfl iterator() is configured to not iterate over new entries)
- io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Entity> iterator = this.entities.iterator();
- try {
- while (iterator.hasNext()) {
- action.accept(iterator.next());
- }
- } finally {
- iterator.finishedIterating();
+ Iterator<Entity> iterator = this.entities.iterator();
+ while (iterator.hasNext()) {
+ action.accept(iterator.next());
}
// Paper end - replace with better logic, do not delay removals/additions
}
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
index a8af51a25b0f99c3a64d9150fdfcd6b818aa7581..cd2592552339a79361d2a4e7936731330e15f6fa 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -31,7 +31,7 @@ public class PathFinder {
}
@Nullable
- public Path findPath(PathNavigationRegion world, Mob mob, Set<BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
+ public synchronized Path findPath(PathNavigationRegion world, Mob mob, Set<BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
this.openSet.clear();
this.nodeEvaluator.prepare(world, mob);
Node node = this.nodeEvaluator.getStart();

View File

@@ -1,627 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Sat, 28 Jan 2023 12:23:31 +0800
Subject: [PATCH] MikuServer: Fix some issue in Entity sensing and aiStep
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/co/m2ek4u/aoame/CallbackExecutor.java b/src/main/java/co/mikumc/mikuserver/concurrent/CallbackExecutor.java
similarity index 98%
rename from src/main/java/co/m2ek4u/aoame/CallbackExecutor.java
rename to src/main/java/co/mikumc/mikuserver/concurrent/CallbackExecutor.java
index b861405a7626ba8fa677c455bf6507253b33c157..678b389ef829bcda55ea06f5f19b96c81f78bd9b 100644
--- a/src/main/java/co/m2ek4u/aoame/CallbackExecutor.java
+++ b/src/main/java/co/mikumc/mikuserver/concurrent/CallbackExecutor.java
@@ -1,4 +1,4 @@
-package co.m2ek4u.aoame;
+package co.mikumc.mikuserver.concurrent;
import org.jetbrains.annotations.NotNull;
import java.util.Queue;
diff --git a/src/main/java/co/m2ek4u/aoame/AnotherTickThread.java b/src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java
similarity index 87%
rename from src/main/java/co/m2ek4u/aoame/AnotherTickThread.java
rename to src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java
index d5fe52beb25e7a95549cdf0ae19edf6029f10642..8dd4423fb1477c901e88c07537ca736eb4f9a8cc 100644
--- a/src/main/java/co/m2ek4u/aoame/AnotherTickThread.java
+++ b/src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java
@@ -1,4 +1,4 @@
-package co.m2ek4u.aoame;
+package co.mikumc.mikuserver.utils;
import io.papermc.paper.util.TickThread;
diff --git a/src/main/java/co/mikumc/mikuserver/utils/EntityPositionCache.java b/src/main/java/co/mikumc/mikuserver/utils/EntityPositionCache.java
new file mode 100644
index 0000000000000000000000000000000000000000..245fd68d040a46f58bebbbebe11ab6fa2072f08b
--- /dev/null
+++ b/src/main/java/co/mikumc/mikuserver/utils/EntityPositionCache.java
@@ -0,0 +1,60 @@
+package co.mikumc.mikuserver.utils;
+
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.phys.Vec3;
+import org.jetbrains.annotations.NotNull;
+
+public class EntityPositionCache {
+ private final double x;
+ private final double y;
+ private final double z;
+ private final LivingEntity currentEntity;
+
+ public EntityPositionCache(@NotNull LivingEntity entity){
+ this.x = entity.getX();
+ this.y = entity.getY();
+ this.z = entity.getZ();
+ this.currentEntity = entity;
+ }
+
+ public LivingEntity getCurrentEntity() {
+ return this.currentEntity;
+ }
+
+ public double getX() {
+ return this.x;
+ }
+
+ public double getY() {
+ return this.y;
+ }
+
+ public double getZ() {
+ return this.z;
+ }
+
+ public double distanceToSqr(double x, double y, double z) {
+ double d3 = this.x - x;
+ double d4 = this.y - y;
+ double d5 = this.z - z;
+
+ return d3 * d3 + d4 * d4 + d5 * d5;
+ }
+
+ public double distanceToSqr(Entity entity) {
+ return this.distanceToSqr(entity.position());
+ }
+
+ public double distanceToSqr(Vec3 vector) {
+ double d0 = this.x - vector.x;
+ double d1 = this.y - vector.y;
+ double d2 = this.z - vector.z;
+
+ return d0 * d0 + d1 * d1 + d2 * d2;
+ }
+
+ public double distanceToSqr(EntityPositionCache entityPositionCache) {
+ return this.distanceToSqr(entityPositionCache.getX(),entityPositionCache.getY(),entityPositionCache.getZ());
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9601de5775667c2d94e07b89bb7605b1e03d413d..28af12b2e670ab2a2d4dc96f340da49da0071737 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,12 +1,9 @@
package net.minecraft.server;
-import co.m2ek4u.aoame.AnotherTickThread;
-import co.m2ek4u.aoame.CallbackExecutor;
+import co.mikumc.mikuserver.utils.AnotherTickThread;
+import co.mikumc.mikuserver.concurrent.CallbackExecutor;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
-import co.aikar.timings.Timings;
-import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
-import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -86,7 +83,6 @@ import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.level.ServerPlayerGameMode;
-import net.minecraft.server.level.TicketType;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
import net.minecraft.server.network.ServerConnectionListener;
@@ -110,17 +106,14 @@ import net.minecraft.util.NativeModuleLister;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.RandomSource;
import net.minecraft.util.SignatureValidator;
-import net.minecraft.util.Unit;
import net.minecraft.util.datafix.DataFixers;
import net.minecraft.util.profiling.EmptyProfileResults;
import net.minecraft.util.profiling.ProfileResults;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.profiling.ResultField;
-import net.minecraft.util.profiling.SingleTickProfiler;
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.util.profiling.jfr.callback.ProfiledDuration;
import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder;
import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder;
import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider;
import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
@@ -184,12 +177,6 @@ import net.minecraft.world.level.levelgen.PatrolSpawner;
import net.minecraft.world.level.levelgen.PhantomSpawner;
import net.minecraft.world.level.levelgen.WorldDimensions;
import net.minecraft.world.level.levelgen.presets.WorldPresets;
-import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.craftbukkit.Main;
-import org.bukkit.craftbukkit.util.CraftChatMessage;
-import org.bukkit.craftbukkit.util.LazyPlayerSet;
-import org.bukkit.event.player.AsyncPlayerChatPreviewEvent;
import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 824f26db01750866a2d9bbeefe17457f84d19504..32ce19ff00d6a31b7dc994d3320ad967f96d4f61 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,6 +1,6 @@
package net.minecraft.server.level;
-import co.m2ek4u.aoame.AnotherTickThread;
+import co.mikumc.mikuserver.utils.AnotherTickThread;
import com.google.common.annotations.VisibleForTesting;
import co.aikar.timings.TimingHistory; // Paper
import com.google.common.collect.Lists;
@@ -51,7 +51,6 @@ import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
import net.minecraft.network.protocol.game.ClientboundBlockEventPacket;
@@ -77,7 +76,6 @@ import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
@@ -129,12 +127,10 @@ import net.minecraft.world.level.chunk.storage.EntityStorage;
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.dimension.end.EndDragonFight;
-import net.minecraft.world.level.entity.EntityPersistentStorage;
import net.minecraft.world.level.entity.EntityTickList;
import net.minecraft.world.level.entity.EntityTypeTest;
import net.minecraft.world.level.entity.LevelCallback;
import net.minecraft.world.level.entity.LevelEntityGetter;
-import net.minecraft.world.level.entity.PersistentEntitySectionManager;
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.gameevent.GameEventDispatcher;
@@ -161,16 +157,13 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.ticks.LevelTicks;
import org.slf4j.Logger;
import org.bukkit.Bukkit;
-import org.bukkit.Location;
import org.bukkit.WeatherType;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
-import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.WorldUUID;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.server.MapInitializeEvent;
import org.bukkit.event.weather.LightningStrikeEvent;
-import org.bukkit.event.world.GenericGameEvent;
import org.bukkit.event.world.TimeSkipEvent;
// CraftBukkit end
import it.unimi.dsi.fastutil.ints.IntArrayList; // Paper
@@ -994,7 +987,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (this.canSleepThroughNights()) {
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
- MutableComponent ichatmutablecomponent;
+ Component ichatmutablecomponent;
if (this.sleepStatus.areEnoughSleeping(i)) {
ichatmutablecomponent = Component.translatable("sleep.skipping_night");
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f5aff6d724185e1ada8736bdb6dd12b143812e83..cb5a4e6a071977fcf82b6b0384735a4bec3564fc 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3029,7 +3029,13 @@ public abstract class LivingEntity extends Entity {
}
if (!this.isRemoved()) {
- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(this::aiStep,()->{});
+ //MikuServer start --async AI
+ if(this instanceof net.minecraft.world.entity.player.Player){
+ this.aiStep(); //Skip player
+ }else {
+ MinecraftServer.getServer().asyncExecutor.executeWithCallBack(this::aiStep,()->{});
+ }
+ //MikuServer end
}
double d0 = this.getX() - this.xo;
@@ -3406,9 +3412,11 @@ public abstract class LivingEntity extends Entity {
this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {
if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
- this.jumpFromGround();
- this.noJumpDelay = 10;
- } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
+ this.jumpFromGround();
+ this.noJumpDelay = 10;
+ } else {
+ this.setJumping(false);
+ } // Paper - setJumping(false) stops a potential loop
}
} else {
this.noJumpDelay = 0;
@@ -3421,102 +3429,51 @@ public abstract class LivingEntity extends Entity {
this.updateFallFlying();
AABB axisalignedbb = this.getBoundingBox();
- if (this instanceof net.minecraft.world.entity.player.Player) {
- // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
- this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza));
- // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("freezing"); // Purpur
- boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
- int i;
+ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
+ this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza));
+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("freezing"); // Purpur
+ boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
+ int i;
- if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
- i = this.getTicksFrozen();
- if (this.isInPowderSnow && this.canFreeze()) {
- this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
- } else {
- this.setTicksFrozen(Math.max(0, i - 2));
- }
+ if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
+ i = this.getTicksFrozen();
+ if (this.isInPowderSnow && this.canFreeze()) {
+ this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
+ } else {
+ this.setTicksFrozen(Math.max(0, i - 2));
}
+ }
- this.removeFrost();
- this.tryAddFrost();
- if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
- i = flag1 ? 5 : 1;
- this.hurt(DamageSource.FREEZE, (float) i);
- }
+ this.removeFrost();
+ this.tryAddFrost();
+ if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
+ i = flag1 ? 5 : 1;
+ this.hurt(DamageSource.FREEZE, (float) i);
+ }
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("push"); // Purpur
- if (this.autoSpinAttackTicks > 0) {
- --this.autoSpinAttackTicks;
- this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
- }
+ //this.level.getProfiler().pop(); // Purpur
+ //this.level.getProfiler().push("push"); // Purpur
+ if (this.autoSpinAttackTicks > 0) {
+ --this.autoSpinAttackTicks;
+ this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
+ }
- this.pushEntities();
- //this.level.getProfiler().pop(); // Purpur
- // Paper start
- if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
- if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
- Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
- Location to = new Location(this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
- io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
- if (!event.callEvent()) {
- absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
- } else if (!to.equals(event.getTo())) {
- absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
- }
+ this.pushEntities();
+ //this.level.getProfiler().pop(); // Purpur
+ // Paper start
+ if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
+ Location to = new Location(this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
+ if (!event.callEvent()) {
+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ } else if (!to.equals(event.getTo())) {
+ absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
- } else {
- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(() -> {
- // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
- this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza));
- // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("freezing"); // Purpur
- boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
- int i;
-
- if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
- i = this.getTicksFrozen();
- if (this.isInPowderSnow && this.canFreeze()) {
- this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
- } else {
- this.setTicksFrozen(Math.max(0, i - 2));
- }
- }
-
- this.removeFrost();
- this.tryAddFrost();
- if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
- i = flag1 ? 5 : 1;
- this.hurt(DamageSource.FREEZE, (float) i);
- }
-
- //this.level.getProfiler().pop(); // Purpur
- //this.level.getProfiler().push("push"); // Purpur
- if (this.autoSpinAttackTicks > 0) {
- --this.autoSpinAttackTicks;
- this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
- }
-
- this.pushEntities();
- //this.level.getProfiler().pop(); // Purpur
- }, () -> {
- if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
- if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
- Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
- Location to = new Location(this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
- io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
- if (!event.callEvent()) {
- absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
- } else if (!to.equals(event.getTo())) {
- absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
- }
- }
- }
- });
}
// Paper end
if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java.rej b/src/main/java/net/minecraft/world/entity/Mob.java.rej
deleted file mode 100644
index 68eddcd9c30a0b4ab690fc54de481847107cef00..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/Mob.java.rej
+++ /dev/null
@@ -1,59 +0,0 @@
-diff a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java (rejected hunks)
-@@ -910,32 +910,31 @@ public abstract class Mob extends LivingEntity {
- //this.level.getProfiler().pop(); // Purpur
- int i = this.level.getServer().getTickCount() + this.getId();
-
-- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(()->{
-- if (i % 2 != 0 && this.tickCount > 1) {
-- //this.level.getProfiler().push("targetSelector"); // Purpur
-- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-- this.targetSelector.tickRunningGoals(false);
-- //this.level.getProfiler().pop(); // Purpur
-- //this.level.getProfiler().push("goalSelector"); // Purpur
-- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-- this.goalSelector.tickRunningGoals(false);
-- //this.level.getProfiler().pop(); // Purpur
-- } else {
-- //this.level.getProfiler().push("targetSelector"); // Purpur
-- if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-- this.targetSelector.tick();
-- //this.level.getProfiler().pop(); // Purpur
-- //this.level.getProfiler().push("goalSelector"); // Purpur
-- if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-- this.goalSelector.tick();
-- //this.level.getProfiler().pop(); // Purpur
-- }
-- this.navigation.tick();
-- this.customServerAiStep();
-- this.moveControl.tick();
-- this.lookControl.tick();
-- this.jumpControl.tick();
-- }, this::sendDebugPackets);
-+ if (i % 2 != 0 && this.tickCount > 1) {
-+ //this.level.getProfiler().push("targetSelector"); // Purpur
-+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-+ this.targetSelector.tickRunningGoals(false);
-+ //this.level.getProfiler().pop(); // Purpur
-+ //this.level.getProfiler().push("goalSelector"); // Purpur
-+ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-+ this.goalSelector.tickRunningGoals(false);
-+ //this.level.getProfiler().pop(); // Purpur
-+ } else {
-+ //this.level.getProfiler().push("targetSelector"); // Purpur
-+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-+ this.targetSelector.tick();
-+ //this.level.getProfiler().pop(); // Purpur
-+ //this.level.getProfiler().push("goalSelector"); // Purpur
-+ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
-+ this.goalSelector.tick();
-+ //this.level.getProfiler().pop(); // Purpur
-+ }
-+ this.navigation.tick();
-+ this.customServerAiStep();
-+ this.moveControl.tick();
-+ this.lookControl.tick();
-+ this.jumpControl.tick();
-+ this.sendDebugPackets();
- }
-
- protected void sendDebugPackets() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
index d8cf99a3014a4b8152ae819fa663c2fdf34dce57..e14d02c04dde5030c0dff3faea9294c87c40910d 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
@@ -1,9 +1,13 @@
package net.minecraft.world.entity.ai.sensing;
-
+import co.mikumc.mikuserver.utils.EntityPositionCache;
import com.google.common.collect.ImmutableSet;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import com.google.common.collect.Lists;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.ObjectLists;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.Brain;
@@ -12,16 +16,29 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
import net.minecraft.world.phys.AABB;
public class NearestLivingEntitySensor<T extends LivingEntity> extends Sensor<T> {
+ private final List<EntityPositionCache> entitiesCache = ObjectLists.synchronize(new ObjectArrayList<>());
+ private final AtomicBoolean calling = new AtomicBoolean(false);
+
@Override
protected void doTick(ServerLevel world, T entity) {
- AABB aABB = entity.getBoundingBox().inflate((double)this.radiusXZ(), (double)this.radiusY(), (double)this.radiusXZ());
- List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, aABB, (e) -> {
- return e != entity && e.isAlive();
- });
- list.sort(Comparator.comparingDouble(entity::distanceToSqr));
- Brain<?> brain = entity.getBrain();
- brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list);
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(entity, list));
+ if (!this.calling.get()){
+ this.calling.set(true);
+ try {
+ AABB aABB = entity.getBoundingBox().inflate(this.radiusXZ(), this.radiusY(), this.radiusXZ());
+ this.entitiesCache.clear();
+ this.entitiesCache.addAll(world.getEntitiesOfClass(LivingEntity.class, aABB, (e) -> e != entity && e.isAlive()).stream().map(EntityPositionCache::new).toList());
+ final EntityPositionCache compareCache = new EntityPositionCache(entity);
+ this.entitiesCache.sort(Comparator.comparingDouble(compareCache::distanceToSqr));
+
+ Brain<?> brain = entity.getBrain();
+ final List<LivingEntity> list = Lists.newCopyOnWriteArrayList();
+ list.addAll(this.entitiesCache.stream().map(EntityPositionCache::getCurrentEntity).toList());
+ brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES,list);
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(entity, list));
+ }finally {
+ this.calling.set(false);
+ }
+ }
}
protected int radiusXZ() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
index 75d9c4f011b5a97def215784c92bb57bbb35d06b..2a3d5085b47824c310cfaa5feec3a50965f804b0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
@@ -1,11 +1,11 @@
package net.minecraft.world.entity.ai.sensing;
+import co.mikumc.mikuserver.utils.EntityPositionCache;
import com.google.common.collect.ImmutableSet;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.ObjectLists;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.EntitySelector;
import net.minecraft.world.entity.LivingEntity;
@@ -14,6 +14,9 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.player.Player;
public class PlayerSensor extends Sensor<LivingEntity> {
+ private final List<Player> playerList = ObjectLists.synchronize(new ObjectArrayList<>());
+ private final AtomicBoolean calling = new AtomicBoolean();
+
@Override
public Set<MemoryModuleType<?>> requires() {
return ImmutableSet.of(MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER);
@@ -21,30 +24,51 @@ public class PlayerSensor extends Sensor<LivingEntity> {
@Override
protected void doTick(ServerLevel world, LivingEntity entity) {
- // Paper start - remove streams
- List<Player> players = (List)world.getNearbyPlayers(entity, entity.getX(), entity.getY(), entity.getZ(), 16.0D, EntitySelector.NO_SPECTATORS);
- players.sort((e1, e2) -> Double.compare(entity.distanceToSqr(e1), entity.distanceToSqr(e2)));
- Brain<?> brain = entity.getBrain();
-
- brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, players);
-
- Player firstTargetable = null;
- Player firstAttackable = null;
- for (int index = 0, len = players.size(); index < len; ++index) {
- Player player = players.get(index);
- if (firstTargetable == null && isEntityTargetable(entity, player)) {
- firstTargetable = player;
- }
- if (firstAttackable == null && isEntityAttackable(entity, player)) {
- firstAttackable = player;
- }
+ if (this.calling.get()){
+ return;
+ }
+
+ this.calling.set(true);
+ try {
+ // Paper start - remove streams
+ List<EntityPositionCache> playersPosCaches = new ArrayList<>(List.of(world
+ .getNearbyPlayers(entity, entity.getX(), entity.getY(), entity.getZ(), 16.0D, EntitySelector.NO_SPECTATORS)
+ .stream()
+ .map(EntityPositionCache::new)
+ .toArray(EntityPositionCache[]::new)));
+
+ final EntityPositionCache entityPositionCache = new EntityPositionCache(entity);
+
+ playersPosCaches.sort(Comparator.comparingDouble(entityPositionCache::distanceToSqr));
+
+ final List<Player> players = playersPosCaches
+ .stream()
+ .map(cache -> ((Player) cache.getCurrentEntity()))
+ .toList();
+
+ Brain<?> brain = entity.getBrain();
+
+ brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, players);
+
+ Player firstTargetable = null;
+ Player firstAttackable = null;
+ for (Player player : players) {
+ if (firstTargetable == null && isEntityTargetable(entity, player)) {
+ firstTargetable = player;
+ }
+ if (firstAttackable == null && isEntityAttackable(entity, player)) {
+ firstAttackable = player;
+ }
- if (firstAttackable != null && firstTargetable != null) {
- break;
+ if (firstAttackable != null && firstTargetable != null) {
+ break;
+ }
}
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, firstTargetable);
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, Optional.ofNullable(firstAttackable));
+ // Paper end - remove streams
+ }finally {
+ this.calling.set(false);
}
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, firstTargetable);
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, Optional.ofNullable(firstAttackable));
- // Paper end - remove streams
}
}

View File

@@ -1,195 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Sat, 28 Jan 2023 12:47:47 +0800
Subject: [PATCH] MikuServer: Refactor and fix a CME in Gossip
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/co/mikumc/mikuserver/PublicConstants.java b/src/main/java/co/mikumc/mikuserver/PublicConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..c6da0ce6b7181d3fb9b6ea8c2a600741d92e8f18
--- /dev/null
+++ b/src/main/java/co/mikumc/mikuserver/PublicConstants.java
@@ -0,0 +1,24 @@
+package co.mikumc.mikuserver;
+
+import co.mikumc.mikuserver.concurrent.CallbackExecutor;
+import co.mikumc.mikuserver.utils.AnotherTickThread;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class PublicConstants {
+ public static final AtomicInteger threadId = new AtomicInteger();
+ public static final CallbackExecutor asyncExecutor = new CallbackExecutor(
+ Runtime.getRuntime().availableProcessors(),
+ Runtime.getRuntime().availableProcessors(),
+ 50,
+ TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<>(),
+ task -> {
+ AnotherTickThread worker = new AnotherTickThread(task,"MikuServer-Async-Worker # "+threadId.getAndIncrement());
+ worker.setDaemon(true);
+ return worker;
+ }
+ );
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 28af12b2e670ab2a2d4dc96f340da49da0071737..76bc84864c306ff14c28312d9a0e923e8589ebe0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,7 +1,6 @@
package net.minecraft.server;
-import co.mikumc.mikuserver.utils.AnotherTickThread;
-import co.mikumc.mikuserver.concurrent.CallbackExecutor;
+import co.mikumc.mikuserver.PublicConstants;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
@@ -41,7 +40,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
@@ -271,21 +269,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private final StructureTemplateManager structureTemplateManager;
protected WorldData worldData;
private volatile boolean isSaving;
-
- private final AtomicInteger threadId = new AtomicInteger();
- public final CallbackExecutor asyncExecutor = new CallbackExecutor(
- Runtime.getRuntime().availableProcessors(),
- Runtime.getRuntime().availableProcessors(),
- 50,
- TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<>(),
- task -> {
- AnotherTickThread worker = new AnotherTickThread(task,"Entity-Async-Worker # "+threadId.getAndIncrement());
- worker.setDaemon(true);
- return worker;
- }
- );
-
// CraftBukkit start
public final WorldLoader.DataLoadContext worldLoader;
public org.bukkit.craftbukkit.CraftServer server;
@@ -1390,8 +1373,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
- if (this.asyncExecutor.isSubmittingStarted()){
- this.asyncExecutor.stopSubmitting();
+ if (PublicConstants.asyncExecutor.isSubmittingStarted()){
+ PublicConstants.asyncExecutor.stopSubmitting();
}
//co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur
long i = Util.getNanos();
@@ -1406,7 +1389,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
++this.tickCount;
- this.asyncExecutor.startSubmitting();
+ PublicConstants.asyncExecutor.startSubmitting();
this.tickChildren(shouldKeepTicking);
if (i - this.lastServerStatus >= 5000000000L) {
this.lastServerStatus = i;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cb5a4e6a071977fcf82b6b0384735a4bec3564fc..3aac9b26d5e94b4c3cf8951f0806458be0920c57 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1,5 +1,6 @@
package net.minecraft.world.entity;
+import co.mikumc.mikuserver.PublicConstants;
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
@@ -44,7 +45,6 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -3033,7 +3033,7 @@ public abstract class LivingEntity extends Entity {
if(this instanceof net.minecraft.world.entity.player.Player){
this.aiStep(); //Skip player
}else {
- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(this::aiStep,()->{});
+ PublicConstants.asyncExecutor.executeWithCallBack(this::aiStep,()->{});
}
//MikuServer end
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index ed645b74bfc6e3cffe75cb4e30277cd5e98ca9c1..70800e37d8d89fda17adefc6e1cb470413b24864 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1,5 +1,6 @@
package net.minecraft.world.entity;
+import co.mikumc.mikuserver.PublicConstants;
import com.google.common.collect.Maps;
import java.util.Arrays;
import java.util.Iterator;
@@ -23,7 +24,6 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
@@ -217,7 +217,7 @@ public abstract class Mob extends LivingEntity {
public void inactiveTick() {
super.inactiveTick();
boolean isThrottled = gg.pufferfish.pufferfish.PufferfishConfig.throttleInactiveGoalSelectorTick && _pufferfish_inactiveTickDisableCounter++ % 20 != 0; // Pufferfish - throttle inactive goal selector ticking
- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(()->{
+ PublicConstants.asyncExecutor.executeWithCallBack(()->{
if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking
this.goalSelector.tick();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
index 097007c1c25ba55d9916fc820dd1d1149d81f6f4..16eec12db529dd513e0971289a9326652369de58 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -30,11 +30,11 @@ import org.slf4j.Logger;
public class GossipContainer {
private static final Logger LOGGER = LogUtils.getLogger();
public static final int DISCARD_THRESHOLD = 2;
- public final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap();
+ public final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newConcurrentMap();
@VisibleForDebug
public Map<UUID, Object2IntMap<GossipType>> getGossipEntries() {
- Map<UUID, Object2IntMap<GossipType>> map = Maps.newHashMap();
+ Map<UUID, Object2IntMap<GossipType>> map = Maps.newConcurrentMap();
this.gossips.keySet().forEach((uuid) -> {
GossipContainer.EntityGossips entityGossips = this.gossips.get(uuid);
map.put(uuid, entityGossips.entries);
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index eb5257fabef397566e784247922fb27e61f96313..69da89c25d23f071497eca9f26cd0fbc404035f5 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -1,5 +1,6 @@
package net.minecraft.world.entity.npc;
+import co.mikumc.mikuserver.PublicConstants;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -274,7 +275,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (this.getUnhappyCounter() > 0) {
this.setUnhappyCounter(this.getUnhappyCounter() - 1);
}
- MinecraftServer.getServer().asyncExecutor.executeWithCallBack(()->{
+ PublicConstants.asyncExecutor.executeWithCallBack(()->{
if (this.isEffectiveAi()) {
if (level.spigotConfig.tickInactiveVillagers) {
this.customServerAiStep();

View File

@@ -1,53 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Sat, 28 Jan 2023 12:51:08 +0800
Subject: [PATCH] MikuServer: Add shutdown hook to async executor and refactor
thread id counter
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/co/mikumc/mikuserver/PublicConstants.java b/src/main/java/co/mikumc/mikuserver/PublicConstants.java
index c6da0ce6b7181d3fb9b6ea8c2a600741d92e8f18..3f2e2e2be1d53b9257f99fb19a50491efc629925 100644
--- a/src/main/java/co/mikumc/mikuserver/PublicConstants.java
+++ b/src/main/java/co/mikumc/mikuserver/PublicConstants.java
@@ -8,17 +8,22 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class PublicConstants {
- public static final AtomicInteger threadId = new AtomicInteger();
+ private static final AtomicInteger asyncWorkerThreadIdCounter = new AtomicInteger();
public static final CallbackExecutor asyncExecutor = new CallbackExecutor(
Runtime.getRuntime().availableProcessors(),
Runtime.getRuntime().availableProcessors(),
50,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(),
- task -> {
- AnotherTickThread worker = new AnotherTickThread(task,"MikuServer-Async-Worker # "+threadId.getAndIncrement());
- worker.setDaemon(true);
- return worker;
- }
+ task -> new AnotherTickThread(task,"MikuServer-Async-Worker # "+ asyncWorkerThreadIdCounter.getAndIncrement())
);
+
+ static {
+ Runtime.getRuntime().addShutdownHook(new Thread(()->{
+ if (asyncExecutor.isSubmittingStarted()){
+ asyncExecutor.stopSubmitting();
+ }
+ asyncExecutor.shutdownNow();
+ }));
+ }
}
diff --git a/src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java b/src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java
index 8dd4423fb1477c901e88c07537ca736eb4f9a8cc..b3ea36c67e9eb5dafd1c7ff5abdf1233dfbd562b 100644
--- a/src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java
+++ b/src/main/java/co/mikumc/mikuserver/utils/AnotherTickThread.java
@@ -9,5 +9,6 @@ public class AnotherTickThread extends TickThread {
public AnotherTickThread(Runnable run, String name) {
super(run, name);
+ this.setPriority(Thread.NORM_PRIORITY - 2);
}
}

View File

@@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Sat, 28 Jan 2023 13:05:12 +0800
Subject: [PATCH] MikuServer: Fix threading issue in event system
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 96cde1f86ca073e7e9e5799bcb12a10adf9230b2..30509d85391ce2fb170751170f3d4310ef856aea 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit;
+import co.mikumc.mikuserver.utils.AnotherTickThread;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
@@ -415,6 +416,11 @@ public final class CraftServer implements Server {
}
}
+ @Override
+ public boolean isCurrentThreadWorker(){
+ return Thread.currentThread() instanceof AnotherTickThread;
+ }
+
private void saveCommandsConfig() {
try {
this.commandsConfiguration.save(this.getCommandsConfigFile());

View File

@@ -1,44 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wangxyper <wangxyper@163.com>
Date: Tue, 31 Jan 2023 09:17:46 +0800
Subject: [PATCH] MikuServer: Some crash issue fixes
Original license: MIT
Original project: https://github.com/MikuMC/MikuServer
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 07b2cd85956dda47ed0a026cd837c5b9498213ac..7bcf64908bbd49131524e227b4f5ac274c175a55 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1500,7 +1500,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final Entity entity;
private final int range;
SectionPos lastSectionPos;
- public final Set<ServerPlayerConnection> seenBy = new ReferenceOpenHashSet<>(); // Paper - optimise map impl
+ public final Set<ServerPlayerConnection> seenBy = ReferenceSets.synchronize(new ReferenceOpenHashSet<>()); // Paper - optimise map impl //MikuServer
public TrackedEntity(Entity entity, int i, int j, boolean flag) {
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
index 004091f2026f3c58d9bce49f1b07f6441df8da8a..7999e27d5dc86ff5d3d827fa2de1307317b46c70 100644
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
@@ -4,6 +4,9 @@ import com.google.common.collect.ImmutableList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;
+
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.ObjectLists;
import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
@@ -49,7 +52,7 @@ public class Inventory implements Container, Nameable {
private int timesChanged;
// CraftBukkit start - add fields and methods
- public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ public List<HumanEntity> transaction = ObjectLists.synchronize(new ObjectArrayList<>());
private int maxStack = MAX_STACK;
public List<ItemStack> getContents() {

View File

@@ -1,127 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Fri, 11 Oct 2019 00:17:39 -0500
Subject: [PATCH] Gale: Send multiple keep-alive packets
Original license: GPL v3
Original project: https://github.com/GaleMC/Gale
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Alternative Keepalive Handling"
By: William Blake Galbreath <blake.galbreath@gmail.com>
As part of: Purpur (https://github.com/PurpurMC/Purpur)
Licensed under: MIT (https://opensource.org/licenses/MIT)
* Purpur copyright *
MIT License
Copyright (c) 2019-2022 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b2d7db36a801464c3be6fd27ee8b6e11e8426240..41b7f22e518afd93c2d2f2b71e644edea597382f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader;
import com.mojang.logging.LogUtils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
+import it.unimi.dsi.fastutil.longs.LongArrayList;
+import it.unimi.dsi.fastutil.longs.LongList;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.time.Duration;
@@ -260,6 +262,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private long keepAliveTime = Util.getMillis();
private boolean keepAlivePending;
private long keepAliveChallenge;
+ private LongList keepAlives = new LongArrayList(); // Gale - Purpur - send multiple keep-alive packets
// CraftBukkit start - multithreaded fields
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
@@ -297,7 +300,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private final LastSeenMessagesValidator lastSeenMessages;
private final MessageSignatureCache messageSignatureCache;
private final FutureChain chatMessageChain;
- private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
+ // Gale start - Purpur - send multiple keep-alive packets
+ private static final long KEEPALIVE_LIMIT_IN_SECONDS = Long.getLong("paper.playerconnection.keepalive", 30); // Paper - provide property to set keepalive limit
+ private static final long KEEPALIVE_LIMIT = KEEPALIVE_LIMIT_IN_SECONDS * 1000;
+ // Gale end - Purpur - send multiple keep-alive packets
private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
private String clientBrandName = null; // Paper - Brand name
@@ -397,6 +403,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
long currentTime = Util.getMillis();
long elapsedTime = currentTime - this.keepAliveTime;
+ // Gale start - Purpur - send multiple keep-alive packets
+ if (LeafConfig.sendMultiple) {
+ if (elapsedTime >= 1000L) { // 1 second
+ if (!this.processedDisconnect && this.keepAlives.size() >= KEEPALIVE_LIMIT_IN_SECONDS) {
+ LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName());
+ disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT);
+ } else {
+ this.keepAliveTime = currentTime; // hijack this field for 1 second intervals
+ this.keepAlives.add(currentTime); // currentTime is ID
+ send(new ClientboundKeepAlivePacket(currentTime));
+ }
+ }
+ } else
+ // Gale end - Purpur - send multiple keep-alive packets
+
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@@ -3465,6 +3486,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
+ // Gale start - Purpur - send multiple keep-alive packets
+ if (LeafConfig.sendMultiple) {
+ long id = packet.getId();
+ if (!this.keepAlives.isEmpty() && this.keepAlives.contains(id)) {
+ int ping = (int) (Util.getMillis() - id);
+ this.player.latency = (this.player.latency * 3 + ping) / 4;
+ this.keepAlives.clear(); // We got a valid response, let's roll with it and forget the rest
+ }
+ } else
+ // Gale end - Purpur - send multiple keep-alive packets
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index dcac5cf6eb0992b3b3d51222f328b7f87936322a..d8b0e6d0043adc1b9f07cb90cd23a665ae44ba26 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -285,4 +285,9 @@ public class LeafConfig {
private static void networkSettings() {
kickForOutOfOrderChat = getBoolean("settings.network.kick-for-out-of-order-chat", kickForOutOfOrderChat);
}
+
+ public static boolean sendMultiple = false;
+ private static void sendMultiple() {
+ sendMultiple = getBoolean("settings.send-Multiple-keepalive", sendMultiple);
+ }
}