9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Updated Upstream (Gale/Paper/Purpur/Leaves/Dependencies)

This commit is contained in:
Dreeam
2023-10-09 19:26:27 -04:00
parent 92ca61a049
commit 088b2916b4
41 changed files with 1129 additions and 680 deletions

View File

@@ -4,7 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- uses: gradle/wrapper-validation-action@main
- name: Set up JDK
uses: graalvm/setup-graalvm@main
@@ -23,13 +23,13 @@ jobs:
- name: Rename Paperclip Jar
run: mv build/libs/Leaf-paperclip-1.20.2-R0.1-SNAPSHOT-reobf.jar ./leaf-1.20.2.jar
- name: Upload Leaf
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@main
with:
name: Leaf
path: ./leaf-1.20.2.jar
- name: Release Leaf
if: github.ref_name == 'ver/1.20.2'
uses: marvinpinto/action-automatic-releases@latest
uses: marvinpinto/action-automatic-releases@master
with:
title: "Leaf 1.20.2"
automatic_release_tag: "ver-1.20.2"

View File

@@ -1,10 +1,8 @@
import io.papermc.paperweight.util.constants.*
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.7-SNAPSHOT"
id("io.papermc.paperweight.patcher") version "1.5.8-SNAPSHOT"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
@@ -17,7 +15,7 @@ repositories {
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.9:fat")
remapper("net.fabricmc:tiny-remapper:0.8.10:fat")
decompiler("org.vineflower:vineflower:1.9.3")
paperclip("io.papermc:paperclip:3.0.4-SNAPSHOT")
}
@@ -63,7 +61,7 @@ paperweight {
decompileRepo.set("https://maven.quiltmc.org/")
useStandardUpstream("Gale") {
url.set(github("GaleMC", "Gale"))
url.set(github("Dreeam-qwq", "Gale"))
ref.set(providers.gradleProperty("galeCommit"))
withStandardPatcher {

View File

@@ -1,7 +1,7 @@
group = org.dreeam.leaf
version = 1.20.2-R0.1-SNAPSHOT
galeCommit = 276e903b2688f23b19bdc8d493c0bf87656d2400
galeCommit = 059cbce88f62a7685d1ca31788e1b903cc63e905
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -7,14 +7,14 @@ Original license: GPL v3
Original project: https://github.com/pufferfish-gg/Pufferfish
diff --git a/build.gradle.kts b/build.gradle.kts
index a2f7dbcd9ab971e5c4b809e7c9dd39e9b1077af6..2f8d0f4a592536ab8d3b5a95093d118137ba65de 100644
index d5d99ee9dca23783f5b70b96790143e689a49ae4..d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -46,6 +46,7 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
api("org.apache.logging.log4j:log4j-api:$log4jVersion")
api("org.slf4j:slf4j-api:$slf4jVersion")
+ api("io.sentry:sentry:6.29.0") // Pufferfish
+ api("io.sentry:sentry:7.0.0-beta.1") // Pufferfish
implementation("org.ow2.asm:asm:9.4")
implementation("org.ow2.asm:asm-commons:9.4")

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
Commit: e068628a9f2c66ba9dca5875ce8604db01e82bdb
Commit: 69d6fae0647074feeb4eb7a2b98fcc2979cc9f92
Patches below are removed in this patch:
Pufferfish-API-Changes.patch
@@ -279,7 +279,7 @@ index 918a045165cdcde264bc24082b7afebb407271de..687d11619379aead7f665d4a5f8f8bcc
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 8a948a61d0bdb06b0b9a6eac8a27baeb35a7d36c..f6e0b39ba9ea34613ecb22c55d5c38d5dcad9a82 100644
index da6e36a16e609272b60fc41ff69a6fa3c34926c0..eba4e7ebe3530fd8cb3ecbe72f703932df8721c9 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -11050,4 +11050,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -817,10 +817,10 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c
// Paper start
/**
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 762cb07861ca8ff058ce8d57ea6c15df1e588bf3..52867495d0f746ff40e802c4f1018511e58fd03e 100644
index d340ddcf6924cc834455de3acbbac91ab9c66e39..ee3ca27a5406024ed71cce14b0891266b64e6fdf 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1049,4 +1049,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -1065,4 +1065,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull String getScoreboardEntryName();
// Paper end - entity scoreboard name
@@ -1027,7 +1027,7 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 4c33eac096619af16d571dca28411c4fff6f00f4..2156418958fb25eb9de08e39e42b90a5337bf92e 100644
index a8bd76124340cbee9e68b5924c8cee44b16a3fe4..e63dc87f0c4d110b71dfd589f4a299772171c304 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3290,4 +3290,122 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1294,10 +1294,30 @@ index c60be4fd24c7fdf65251dd6169e5e1ac3b588d95..569deccd2f1cf21da9b5906433ac493c
+ boolean canDoUnsafeEnchants();
+
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index ab73893656932f54009340df59293df2a732be51..2ac5b6b3fe9d8c3c68504cff485a516f38da9956 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -298,4 +298,15 @@ public interface ItemFactory {
@Deprecated
net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName);
// Paper end - bungee hover events
+
+ // Purpur start
+ /**
+ * Returns the lines of text shown when hovering over an item
+ *
+ * @param itemStack The ItemStack
+ * @param advanced Whether advanced tooltips are shown
+ * @return the list of Components
+ */
+ @NotNull java.util.List<net.kyori.adventure.text.@NotNull Component> getHoverLines(@NotNull ItemStack itemStack, boolean advanced);
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a129033b7 100644
index 0af73cc04edb93b9772136d4d808f657ea40e733..085d98b30afa51e7665cb01bdd80b21f82771b95 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -17,6 +17,18 @@ import org.bukkit.inventory.meta.ItemMeta;
@@ -1319,7 +1339,7 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a
/**
* Represents a stack of items.
@@ -1005,4 +1017,626 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -1005,4 +1017,636 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return type.isAir() || amount <= 0;
}
// Paper end
@@ -1944,6 +1964,16 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a
+ }
+ return random.nextInt(unbreaking + 1) > 0;
+ }
+
+ /**
+ * Returns the lines of text shown when hovering over the item
+ *
+ * @param advanced Whether advanced tooltips are shown
+ * @return the list of Components
+ */
+ public @NotNull List<net.kyori.adventure.text.@NotNull Component> getHoverLines(boolean advanced) {
+ return Bukkit.getItemFactory().getHoverLines(this, advanced);
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java

View File

@@ -2830,7 +2830,7 @@ index 3e61a926620a67daec3af54b72a1b911eaef2ed4..00000000000000000000000000000000
- }
-}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index de36dab37d3af249cf51573d163731c12346066a..aa3f38adb930bb06f4131a5a9b9b1c0d8a97b999 100644
index 9237e2fca0557890b718de9029207a552396e45a..359c72a5fc0a98a71429907a437a1c7be03ed64c 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -35,7 +35,6 @@ public interface UnsafeValues {
@@ -2841,7 +2841,7 @@ index de36dab37d3af249cf51573d163731c12346066a..aa3f38adb930bb06f4131a5a9b9b1c0d
Material toLegacy(Material material);
Material fromLegacy(Material material);
@@ -114,11 +113,6 @@ public interface UnsafeValues {
@@ -113,11 +112,6 @@ public interface UnsafeValues {
// Paper end
// Paper start

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0680ee517 100644
index d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352..f6f8fc879d938d31b184216eaccb477637be5a13 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,8 +11,8 @@ java {
@@ -30,22 +30,22 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0
apiAndDocs("net.kyori:adventure-text-minimessage")
@@ -48,30 +48,32 @@ dependencies {
api("org.slf4j:slf4j-api:$slf4jVersion")
api("io.sentry:sentry:6.29.0") // Pufferfish
api("io.sentry:sentry:7.0.0-beta.1") // Pufferfish
- implementation("org.ow2.asm:asm:9.4")
- implementation("org.ow2.asm:asm-commons:9.4")
+ // Leaf start - Bump Dependencies
+ implementation("org.ow2.asm:asm:9.5")
+ implementation("org.ow2.asm:asm-commons:9.5")
+ implementation("org.ow2.asm:asm:9.6")
+ implementation("org.ow2.asm:asm-commons:9.6")
// Paper end
- api("org.apache.maven:maven-resolver-provider:3.8.5")
- compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
- compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
- compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
+ api("org.apache.maven:maven-resolver-provider:3.9.4")
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.15")
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.15")
+ api("org.apache.maven:maven-resolver-provider:3.9.5")
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.16")
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.16")
+ compileOnly("com.google.code.findbugs:jsr305:3.0.2") // Paper
val annotations = "org.jetbrains:annotations:$annotationsVersion" // Paper - we don't want Java 5 annotations...
@@ -54,7 +54,7 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0
// Paper start - add checker
- val checkerQual = "org.checkerframework:checker-qual:3.21.0"
+ val checkerQual = "org.checkerframework:checker-qual:3.38.0" // Leaf - Bump Dependencies
+ val checkerQual = "org.checkerframework:checker-qual:3.39.0" // Leaf - Bump Dependencies
compileOnlyApi(checkerQual)
testCompileOnly(checkerQual)
// Paper end
@@ -63,8 +63,10 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0
+ testImplementation("org.apache.commons:commons-lang3:3.13.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
testImplementation("org.mockito:mockito-core:5.5.0")
testImplementation("org.ow2.asm:asm-tree:9.5")
- testImplementation("org.mockito:mockito-core:5.5.0")
- testImplementation("org.ow2.asm:asm-tree:9.5")
+ testImplementation("org.mockito:mockito-core:5.6.0")
+ testImplementation("org.ow2.asm:asm-tree:9.6")
+ // Leaf end
}
@@ -74,11 +76,11 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0
"https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/",
// Paper end
- "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.15", // Paper // Leaf - Bump Dependencies
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.16", // Paper // Leaf - Bump Dependencies
)
options.tags("apiNote:a:API Note:")
@@ -174,6 +176,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.
@@ -184,6 +186,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}

View File

@@ -833,23 +833,27 @@ index b66a7d4aab887309579154815a0d4abf9de506b0..78cb9d7da9bb025ea362028fdc9d0317
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 5013dd1d875f7ca56ac36ef5f5505227018cb1f2..d375d0bc4aab326ad26f7a18c040f5a6c7dbf705 100644
index d840237674c67c739e0f990a89f77a31cb706558..942c2a826f9a4f8c66f2dcd0e7f25432edc4e836 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -1,6 +1,5 @@
@@ -1,7 +1,7 @@
package io.papermc.paper.configuration;
-import co.aikar.timings.MinecraftTimings;
import io.papermc.paper.configuration.constraint.Constraint;
import com.mojang.logging.LogUtils;
+import io.papermc.paper.configuration.constraint.Constraint;
import io.papermc.paper.configuration.constraint.Constraints;
import io.papermc.paper.configuration.type.IntOr;
@@ -87,37 +86,6 @@ public class GlobalConfiguration extends ConfigurationPart {
import io.papermc.paper.configuration.type.number.IntOr;
import net.kyori.adventure.text.Component;
@@ -90,39 +90,6 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean useDisplayNameInQuitMessage = false;
}
- @Deprecated(forRemoval = true)
- public Timings timings;
-
- public class Timings extends ConfigurationPart.Post {
- @Deprecated(forRemoval = true)
- public class Timings extends ConfigurationPart {
- // Gale start - recommend disabling timings on startup
- public boolean enabled = false; // Gale - set default value to false
- public boolean warnIfEnabled = true;
@@ -865,8 +869,8 @@ index 5013dd1d875f7ca56ac36ef5f5505227018cb1f2..d375d0bc4aab326ad26f7a18c040f5a6
- public int historyLength = 3600;
- public String serverName = "Unknown Server";
-
- @Override
- public void postProcess() {
- @PostProcess
- private void postProcess() {
- // Gale start - recommend disabling timings on startup
- if (enabled && warnIfEnabled) {
- net.minecraft.server.MinecraftServer.LOGGER.warn("To improve performance, we recommend setting timings.enabled to false in paper-global.yml");
@@ -958,7 +962,7 @@ index 9a49f5271ec1d9de17632bfffe8309cb1ba0d8b1..1bf374d482acba25614ae303d1fa72ed
} catch (Exception exception) {
if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af84d29f25d 100644
index bc886017d72ca26655478c5f48f2b79689ab908c..6ff78398c0726714ae6cc0cc8da35503d18fcb78 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -179,8 +179,6 @@ import org.bukkit.craftbukkit.Main;
@@ -970,7 +974,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable {
public static final int SERVER_THREAD_PRIORITY = Integer.getInteger("gale.thread.priority.server", -1); // Gale - server thread priority environment variable
@@ -917,7 +915,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -915,7 +913,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
@@ -978,7 +982,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
// Purpur start
if (upnp) {
if (dev.omega24.upnp4j.UPnP4J.close(this.getPort(), dev.omega24.upnp4j.util.Protocol.TCP)) {
@@ -1281,7 +1278,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1279,7 +1276,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void waitUntilNextTick() {
@@ -987,7 +991,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
long tickOversleepStart = System.nanoTime(); // Gale - YAPFA - last tick time
this.managedBlock(() -> {
return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick
@@ -1377,15 +1374,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1375,15 +1372,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
@@ -1005,7 +1009,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
// Paper end
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
@@ -1417,11 +1413,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1415,11 +1411,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end
io.papermc.paper.util.CachedLists.reset(); // Paper
@@ -1017,7 +1021,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
// Paper start
long endTime = System.nanoTime();
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
@@ -1439,7 +1430,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1437,7 +1428,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end
this.logTickTime(k - i);
org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -1025,7 +1029,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
}
protected void logTickTime(long nanos) {}
@@ -1476,9 +1466,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1474,9 +1464,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
@@ -1035,7 +1039,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
getAllLevels().forEach(level -> {
@@ -1494,20 +1482,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1492,20 +1480,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
});
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
@@ -1056,7 +1060,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
// 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 level : this.getAllLevels()) {
@@ -1527,7 +1510,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1525,7 +1508,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end
@@ -1064,7 +1068,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
this.isIteratingOverLevels = true; // Paper
net.minecraft.network.FriendlyByteBuf.hasItemSerializeEvent = org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
@@ -1547,14 +1529,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1545,14 +1527,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end */
try {
@@ -1079,7 +1083,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
} catch (Throwable throwable) {
// Spigot Start
CrashReport crashreport;
@@ -1574,21 +1554,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1572,21 +1552,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.isIteratingOverLevels = false; // Paper
@@ -1101,7 +1105,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
iterator = this.playerList.getPlayers().iterator();
@@ -1598,7 +1572,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1596,7 +1570,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.chunkSender.sendNextChunks(entityplayer);
entityplayer.connection.resumeFlushing();
}
@@ -1109,7 +1113,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
}
private void synchronizeTime(ServerLevel world) {
@@ -2664,8 +2637,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2662,8 +2635,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return;
}
@@ -1118,7 +1122,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8
for (;;) {
boolean moreTasks = this.tickMidTickTasks();
long currTime = System.nanoTime();
@@ -2690,9 +2661,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2688,9 +2659,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return;
}
}
@@ -1142,7 +1146,7 @@ index 0d1d4d2b1ed46a9f4ee383112ea20ac68295f026..662ad3887cc4a6fe3084ba63895e3f0c
i = this.context.runTopCommand(customfunction1, 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 7b703cd286b3819eb67b6ee95605d95ef9c44af4..2d9bf21bc0e947d221ab237da24d730560591a10 100644
index 4706f54a2fd7eb489d02371873d08807576dfa38..688a52a6efd932e29b4a357a9a4536afa2d03d01 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -57,7 +57,6 @@ import org.apache.logging.log4j.Level;
@@ -1153,7 +1157,7 @@ index 7b703cd286b3819eb67b6ee95605d95ef9c44af4..2d9bf21bc0e947d221ab237da24d7305
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.craftbukkit.util.Waitable; // Paper
import org.bukkit.event.server.RemoteServerCommandEvent;
@@ -533,7 +532,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -532,7 +531,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInputs() {
@@ -1161,7 +1165,7 @@ index 7b703cd286b3819eb67b6ee95605d95ef9c44af4..2d9bf21bc0e947d221ab237da24d7305
// Paper start - use proper queue
ConsoleInput servercommand;
while ((servercommand = this.serverCommandQueue.poll()) != null) {
@@ -549,8 +547,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -548,8 +546,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
server.dispatchServerCommand(console, servercommand);
// CraftBukkit end
}
@@ -1170,7 +1174,7 @@ index 7b703cd286b3819eb67b6ee95605d95ef9c44af4..2d9bf21bc0e947d221ab237da24d7305
}
@Override
@@ -819,23 +815,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -818,23 +814,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return;
}
@@ -1246,10 +1250,10 @@ index 1d6b75467166def7f0573f5cabe19aafb18de3c7..727a5120f16c30a0393b25a762f031eb
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7f844f065 100644
index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af8c183fbd 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -293,10 +293,8 @@ public class ServerChunkCache extends ChunkSource {
@@ -290,10 +290,8 @@ 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
@@ -1260,7 +1264,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
} // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
@@ -445,17 +443,13 @@ public class ServerChunkCache extends ChunkSource {
@@ -442,17 +440,13 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
@@ -1278,7 +1282,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
}
// Paper end
@@ -481,20 +475,14 @@ public class ServerChunkCache extends ChunkSource {
@@ -478,20 +472,14 @@ public class ServerChunkCache extends ChunkSource {
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
@@ -1299,7 +1303,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
this.clearCache();
}
@@ -520,7 +508,6 @@ public class ServerChunkCache extends ChunkSource {
@@ -517,7 +505,6 @@ public class ServerChunkCache extends ChunkSource {
boolean flag2AndHasNaturalSpawn = flag2 && this.anySpawnCategoryIsSpawnedThisTick();
if (flag2AndHasNaturalSpawn) {
// Gale end - MultiPaper - skip unnecessary mob spawning computations
@@ -1307,15 +1311,15 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
@@ -550,7 +537,6 @@ public class ServerChunkCache extends ChunkSource {
// Pufferfish end
@@ -540,7 +527,6 @@ public class ServerChunkCache extends ChunkSource {
spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
}
// Paper end
- this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
//this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
this.lastSpawnState = spawnercreature_d;
// Paper - optimise chunk tick iteration
@@ -560,9 +546,6 @@ public class ServerChunkCache extends ChunkSource {
@@ -550,9 +536,6 @@ public class ServerChunkCache extends ChunkSource {
spawnercreature_d = null;
}
// Gale end - MultiPaper - skip unnecessary mob spawning computations
@@ -1325,7 +1329,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
// Paper start - optimise chunk tick iteration
ChunkMap playerChunkMap = this.chunkMap;
@@ -663,15 +646,10 @@ public class ServerChunkCache extends ChunkSource {
@@ -653,15 +636,10 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
@@ -1341,7 +1345,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
// Paper start - optimise chunk tick iteration
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
@@ -685,7 +663,6 @@ public class ServerChunkCache extends ChunkSource {
@@ -675,7 +653,6 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
@@ -1350,7 +1354,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7
this.chunkMap.tick();
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8541270a3 100644
index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ffa9c76a0c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,7 +1,6 @@
@@ -1397,9 +1401,9 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
- timings.entityTick.startTiming(); // Spigot
this.entityTickList.forEach((entity) -> {
entity.activatedPriorityReset = false; // Pufferfish - DAB
if (!entity.isRemoved()) {
@@ -920,8 +909,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -919,8 +908,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
});
@@ -1408,7 +1412,7 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8
this.tickBlockEntities();
}
@@ -1054,7 +1041,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1053,7 +1040,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
} // Paper
// Paper start - optimise random block ticking
@@ -1416,7 +1420,7 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
@@ -1086,8 +1072,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1085,8 +1071,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise random block ticking
@@ -1528,7 +1532,7 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8
} 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 c82a310bd69abf30b39e4b96d1ef2b43283ecdbe..ef84bdb881160bbe7b2ceb97f0ea9f35d50f96f1 100644
index 9d5f3bd830b547ff238dcef60aa00121038ba5f8..32c4e1c1157151e954ee7f99a9dedbb1741f7a6d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2480,7 +2480,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1584,10 +1588,10 @@ index b1a327b0208a30bc44e97dfd5c5e38014aafc197..20c061849cbb424fee66a47d9339cfd8
}
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4303b0e56 100644
index a9f69e4f880711c21ef28bd079960ef8f12da25c..4f031c68fa0788d782dd0124fe3b9669b8f1639d 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -336,15 +336,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -334,15 +334,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
@@ -1603,7 +1607,7 @@ index 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4
this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this);
this.factory = factory;
this.category = spawnGroup;
@@ -714,12 +705,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -712,12 +703,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return this.updateInterval;
}
@@ -1616,7 +1620,7 @@ index 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4
public boolean trackDeltas() {
return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
}
@@ -829,7 +814,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -827,7 +812,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
Util.fetchChoiceType(References.ENTITY_TREE, id);
}
@@ -1870,7 +1874,7 @@ index 648481ad582e855e348dee28fa1cdd752ff6761b..f7958733a2321b34fbcb660e9c29fc14
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 47794e6f0fed60b361bb330dff411af0e93becdf..0a27a839d33c95d89aa352f374aa1877fb99acca 100644
index a50d36ab25d379239088f89b451f525bc57a3306..76621b258b2d63099959e77d113f279aa71d7d4f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -475,7 +475,6 @@ public final class CraftServer implements Server {
@@ -1882,7 +1886,7 @@ index 47794e6f0fed60b361bb330dff411af0e93becdf..0a27a839d33c95d89aa352f374aa1877
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 05f6d24ff60809e270e3c2300e2f2aa38176ae41..6d6e5ff97cb6a0cd1897c7c32341f67364f5693d 100644
index 9213110d0084ff06657e08437ae079f1c5a9cb66..bb42788a84cd161d22f29e271da7373df50cac21 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -371,8 +371,6 @@ public class Main {
@@ -2065,10 +2069,10 @@ index 7f4e0a4bff74bcb56f455f3ea76bb1d96d71e1ad..e0d631c2e692fa61e252a418a5eebf78
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 5b7e2afd8ecc5b8bbe524d4ba6e1d0ac0282878b..3f12cf7608f8966b8a4279c17f86c5d7e1002714 100644
index 104316a79771cfd9fce6883499fca268eed223c4..357dafd28c77b3fdd16f51381d59c6c40dcfd1d1 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -79,41 +79,6 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
@@ -80,41 +80,6 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
public int premiumAccountSlowLoginTimeout = -1; // Gale - make slow login timeout configurable
public boolean ignoreNullLegacyStructureData = false; // Gale - MultiPaper - ignore null legacy structure data
@@ -2271,7 +2275,7 @@ index 139d946346594d2a59a8b2930c4eae794c880dbc..00000000000000000000000000000000
-
-}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d704f2869 100644
index f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a..2ab536b4fb94f9c5f2e60b2b3e9f5ab13e03c73c 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -35,7 +35,6 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
@@ -2282,7 +2286,7 @@ index 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d
import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
@@ -184,7 +183,6 @@ public class ActivationRange
@@ -181,7 +180,6 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
@@ -2290,7 +2294,7 @@ index 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
@@ -264,7 +262,6 @@ public class ActivationRange
@@ -242,7 +240,6 @@ public class ActivationRange
}
// Paper end
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Purpur: Configurable server mod name
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 233325eab66a856eaa56abc3f0cc8af84d29f25d..b54a764c2a24f8e09792ade7a9a4ebb17d9d4e7b 100644
index 6ff78398c0726714ae6cc0cc8da35503d18fcb78..dfe06a0f0d3c6ed0ce89c632a8b2cd050cc2e6a7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1662,7 +1662,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1660,7 +1660,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
@@ -18,10 +18,10 @@ index 233325eab66a856eaa56abc3f0cc8af84d29f25d..b54a764c2a24f8e09792ade7a9a4ebb1
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 9299d2fe1cda71b6881fd8bd65d3d74b1189a196..80a196442edbc6b4eb44bb6a405100871aea2f6a 100644
index b1fcd3588c22143f9852805a6cea3b6cf6c33a1f..c9c926ec7129eaf235803a8b48a014e74385ac23 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -164,6 +164,11 @@ public class LeafConfig {
@@ -160,6 +160,11 @@ public class LeafConfig {
return builder.build();
}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index 1b402ea22d93f46a5ce4b9722e74b3d911eb2e52..e069a6e36a1562c3acfb0939328efb59b94df0f7 100644
index d356988d21896ac06b5cc2e54785813b7d30233c..fa745abebf14fee0ca56cadc98822be62b647edf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -22,7 +22,7 @@ dependencies {
@@ -29,23 +29,26 @@ index 1b402ea22d93f46a5ce4b9722e74b3d911eb2e52..e069a6e36a1562c3acfb0939328efb59
runtimeOnly(log4jPlugins.output)
alsoShade(log4jPlugins.output)
- implementation("io.netty:netty-codec-haproxy:4.1.87.Final") // Paper - Add support for proxy protocol
+ implementation("io.netty:netty-codec-haproxy:4.1.98.Final") // Paper - Add support for proxy protocol
+ implementation("io.netty:netty-codec-haproxy:4.1.99.Final") // Paper - Add support for proxy protocol
// Paper end
- implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.20.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm:9.5")
implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation
- implementation("org.ow2.asm:asm:9.5")
- implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation
- testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito
- implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
+ testImplementation("org.mockito:mockito-core:5.5.0") // Paper - switch to mockito
+ implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.20.0") // Paper - remove exclusion
+ implementation("org.ow2.asm:asm:9.6")
+ implementation("org.ow2.asm:asm-commons:9.6") // Paper - ASM event executor generation
+ testImplementation("org.mockito:mockito-core:5.6.0") // Paper - switch to mockito
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
- implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
+ implementation("net.fabricmc:mapping-io:0.4.2") // Paper - needed to read mappings for stacktrace deobfuscation
runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0")
- runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
+ implementation("net.fabricmc:mapping-io:0.5.0-beta.1") // Paper - needed to read mappings for stacktrace deobfuscation
+ runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
- runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper // Leaf - Bump Dependencies - Waiting Log4j support disruptor 4.0.0
+ // Leaf end
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
// Paper start - Use Velocity cipher
- implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {
+ implementation("com.velocitypowered:velocity-native:3.2.0-SNAPSHOT") { // Leaf - Bump Dependencies
@@ -57,9 +60,9 @@ index 1b402ea22d93f46a5ce4b9722e74b3d911eb2e52..e069a6e36a1562c3acfb0939328efb59
- runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
- runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+ // Leaf start - Bump Dependencies
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.4")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.15")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.15")
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.5")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.16")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.16")
+ // Leaf end
// Pufferfish start
@@ -75,12 +78,12 @@ index 1b402ea22d93f46a5ce4b9722e74b3d911eb2e52..e069a6e36a1562c3acfb0939328efb59
testImplementation("org.hamcrest:hamcrest:2.2")
- implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
+ implementation("io.netty:netty-all:4.1.98.Final"); // Paper - Bump netty
+ implementation("io.netty:netty-all:4.1.99.Final"); // Paper - Bump netty
+ // Leaf end
}
val craftbukkitPackageVersion = "1_20_R2" // Paper
@@ -269,3 +275,7 @@ sourceSets {
@@ -265,3 +271,7 @@ sourceSets {
}
}
// Gale end - package license into jar
@@ -88,3 +91,16 @@ index 1b402ea22d93f46a5ce4b9722e74b3d911eb2e52..e069a6e36a1562c3acfb0939328efb59
+repositories {
+ mavenCentral()
+}
diff --git a/src/main/java/io/papermc/paper/util/ObfHelper.java b/src/main/java/io/papermc/paper/util/ObfHelper.java
index b8b17d046f836c8652ab094db00ab1af84971b2c..e856d7ce39e388f8bf45d394fd2fb586e3370c27 100644
--- a/src/main/java/io/papermc/paper/util/ObfHelper.java
+++ b/src/main/java/io/papermc/paper/util/ObfHelper.java
@@ -93,7 +93,7 @@ public enum ObfHelper {
return null;
}
final MemoryMappingTree tree = new MemoryMappingTree();
- MappingReader.read(new InputStreamReader(mappingsInputStream, StandardCharsets.UTF_8), MappingFormat.TINY_2, tree);
+ MappingReader.read(new InputStreamReader(mappingsInputStream, StandardCharsets.UTF_8), MappingFormat.TINY_2_FILE, tree); // Leaf - Use mapping-io 0.5.0-beta.1
final Set<ClassMapping> classes = new HashSet<>();
final StringPool pool = new StringPool();

View File

@@ -22,10 +22,10 @@ index 744f44e33578b56bbfd48fe27509e887716b3310..4cecb53d3792f02f8f76c26190583831
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 80a196442edbc6b4eb44bb6a405100871aea2f6a..1e9a440d790bdd521c58dfc9c1575e2759006d02 100644
index c9c926ec7129eaf235803a8b48a014e74385ac23..540b137c7f697001a325f57d06e2a0d69fae37ce 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -169,7 +169,11 @@ public class LeafConfig {
@@ -165,7 +165,11 @@ public class LeafConfig {
serverModName = getString("server-mod-name", serverModName);
}
@@ -36,4 +36,4 @@ index 80a196442edbc6b4eb44bb6a405100871aea2f6a..1e9a440d790bdd521c58dfc9c1575e27
+ "enabling all characters as username");
}
public static boolean enableAsyncMobSpawning = true;
private static void performance() {

View File

@@ -18,10 +18,10 @@ index b76f4b62d58087325d01983effe0a508d551d4ab..eb84043a3b39d899b83c8168e17fa19b
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
this.connection.disconnect(chatmessage);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 1e9a440d790bdd521c58dfc9c1575e2759006d02..267f88d799fe98d1741a837c33d8c748362077ee 100644
index 540b137c7f697001a325f57d06e2a0d69fae37ce..1955a44a2cd178818bc53f4a56d7d0350cef80c8 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -170,10 +170,14 @@ public class LeafConfig {
@@ -166,10 +166,14 @@ public class LeafConfig {
}
public static boolean removeMojangUsernameCheck = true;
@@ -35,4 +35,4 @@ index 1e9a440d790bdd521c58dfc9c1575e2759006d02..267f88d799fe98d1741a837c33d8c748
+ "without backend server enabling its bungee mode");
}
public static boolean enableAsyncMobSpawning = true;
private static void performance() {

View File

@@ -7,7 +7,7 @@ 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 ef84bdb881160bbe7b2ceb97f0ea9f35d50f96f1..aa8f5320d027518dfe28548424c4a6477deeb45e 100644
index 32c4e1c1157151e954ee7f99a9dedbb1741f7a6d..c005afe12d775036d11b04189167f2476e66a30f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1977,7 +1977,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -20,10 +20,10 @@ index ef84bdb881160bbe7b2ceb97f0ea9f35d50f96f1..aa8f5320d027518dfe28548424c4a647
this.player.resetLastActionTime();
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03ffbac2a7d 100644
index 1955a44a2cd178818bc53f4a56d7d0350cef80c8..9a29a8c414b32376f7398e96a27eda1e477cb83e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -171,6 +171,8 @@ public class LeafConfig {
@@ -167,6 +167,8 @@ public class LeafConfig {
public static boolean removeMojangUsernameCheck = true;
public static boolean removeSpigotCheckBungeeConfig = true;
@@ -32,7 +32,7 @@ index 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03f
private static void removal() {
removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", removeMojangUsernameCheck,
"Remove username check of Mojang",
@@ -178,6 +180,9 @@ public class LeafConfig {
@@ -174,6 +176,9 @@ public class LeafConfig {
removeSpigotCheckBungeeConfig = getBoolean("remove-Spigot-check-bungee-config", removeSpigotCheckBungeeConfig,
"Enable player enter backend server through proxy",
"without backend server enabling its bungee mode");
@@ -41,4 +41,4 @@ index 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03f
+ maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
}
public static boolean enableAsyncMobSpawning = true;
private static void performance() {

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 28910943e5efcdf24865b961fba161b7d1e4a8f5..f8cbec0c5dee624280f3c28f4b1b7de4f2ee8c8f 100644
index b6515c469ae3ff06daf631f0d5e5f792b41f8e48..1c06a414abe91085216c07b12cd4310b586fecb3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -29,6 +29,11 @@ import java.util.Optional;

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index 4a4a8360c4286e06d88049512bf44237d2622f01..582640872ead7b9b4107fa5cc8f4e204b9d8bcc7 100644
index 5fe6f626b63274e33f7c8b46441d17cf4ff9d533..1b1bf657993c2a96d7168e3b1161872839a6e67a 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -139,7 +139,7 @@ public class GaleWorldConfiguration extends ConfigurationPart {
@@ -140,7 +140,7 @@ public class GaleWorldConfiguration extends ConfigurationPart {
public boolean loadPortalDestinationChunkBeforeEntityTeleport = false; // Gale - MultiPaper - load portal destination chunk before entity teleport
}

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 3ff5c2a4a2cca5c9a89ceafd9fddeb1012344433..90ab4610026b23ac84e6c941c6581d13fe3565a2 100644
index 07f1f6c9613150fd1cdd460a940629a67539d8db..0fe02df86483809cef22fca2e2ce0af7b4a5c6d5 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -331,7 +331,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -20,21 +20,15 @@ index 3ff5c2a4a2cca5c9a89ceafd9fddeb1012344433..90ab4610026b23ac84e6c941c6581d13
} else {
ItemEntity.merge(other, itemstack1, this, itemstack);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 83fee46886a21349d652b6bc871bd03ffbac2a7d..fc3938c16c43277e22b7a322177fa2a9150f1ff8 100644
index 9a29a8c414b32376f7398e96a27eda1e477cb83e..4b6ba35724d364da8397d991ba8453f22911ed07 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -194,6 +194,7 @@ public class LeafConfig {
public static int activationDistanceMod = 8;
public static boolean throttleInactiveGoalSelectorTick = true;
public static Map<String, Integer> projectileTimeouts;
@@ -181,7 +181,9 @@ public class LeafConfig {
maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
}
+ public static boolean useSpigotItemMergingMechanism = true;
private static void performance() {
boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
"Whether or not asynchronous mob spawning should be enabled.",
@@ -242,6 +243,7 @@ public class LeafConfig {
String type = EntityType.getKey(entityType).getPath().toUpperCase(Locale.ROOT);
entityType.ttl = config.getInt("entity_timeouts." + type, -1);
}
+ useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
}

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 849a740430abc4ed762adcfefa6b5b10515b3bff..ab2a7440afd2ef6fa0c78888c5072012e73fddc7 100644
index e0fdc3156bec8c39a23c322f888826f710e36ddd..3c29dd986d8de2844087a479372ce4865bdf2bfe 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -278,6 +278,7 @@ public class ServerPlayer extends Player {
@@ -279,6 +279,7 @@ public class ServerPlayer extends Player {
private boolean tpsBar = false; // Purpur
private boolean compassBar = false; // Purpur
private boolean ramBar = false; // Purpur
@@ -36,7 +36,7 @@ index 20c061849cbb424fee66a47d9339cfd8a1920660..d20eed35c85cf5118206dbf9ca2c706b
entityplayer1.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
entityplayer1.connection.send(new ClientboundSetExperiencePacket(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel));
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f8cbec0c5dee624280f3c28f4b1b7de4f2ee8c8f..762edca984d02b8a2a4224adba1f240fa9ea0661 100644
index 1c06a414abe91085216c07b12cd4310b586fecb3..57d3b887b606800d0d1e12b46ae793c50f09bee3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1267,6 +1267,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@@ -7,7 +7,7 @@ Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1fe5d4141 100644
index a025d009dc277b7e850cabd6fbbcca119f85a9b6..da016b3fceef0d2bac3ca9a0692f3deb04d82abf 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -418,6 +418,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -18,7 +18,7 @@ index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -2474,6 +2475,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2463,6 +2464,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
nbt.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -26,7 +26,7 @@ index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1
return nbt;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2642,6 +2644,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2631,6 +2633,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
@@ -38,7 +38,7 @@ index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -5034,4 +5041,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -5023,4 +5030,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return false;
}
// Purpur end
@@ -265,28 +265,3 @@ index 0000000000000000000000000000000000000000..b684d8f576acbc5de8d06b0ff779c257
+ return backingMap.size();
+ }
+}
diff --git a/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java b/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..5ce52537e5a05a72ef29a66857920ebd86ff930c
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java
@@ -0,0 +1,19 @@
+package top.leavesmc.leaves.util;
+
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
+import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.level.ServerPlayer;
+import org.jetbrains.annotations.NotNull;
+
+public class ProtocolUtils {
+
+ public static void sendPayloadPacket(@NotNull ServerPlayer player, ResourceLocation channel, FriendlyByteBuf data) {
+ player.connection.send(new ClientboundCustomPayloadPacket(data.writeResourceLocation(channel)));
+ }
+
+ public static boolean isNamespacePacket(@NotNull ServerboundCustomPayloadPacket packet, String namespace) {
+ return packet.payload().id().getNamespace().equals(namespace);
+ }
+}

View File

@@ -0,0 +1,532 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Tue, 26 Sep 2023 19:00:41 +0800
Subject: [PATCH] Leaves Protocol Core
Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
diff --git a/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java b/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java
index 975da2529d18391ed4ecc7359a2d7319129bd872..ae5590b015a2b018188bd7a45b44ec4d4af048a5 100644
--- a/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java
@@ -20,7 +20,12 @@ public record ServerboundCustomPayloadPacket(CustomPacketPayload payload) implem
private static CustomPacketPayload readPayload(ResourceLocation id, FriendlyByteBuf buf) {
FriendlyByteBuf.Reader<? extends CustomPacketPayload> packetdataserializer_a = (FriendlyByteBuf.Reader) ServerboundCustomPayloadPacket.KNOWN_TYPES.get(id);
-
+ // Leaves start - protocol
+ CustomPacketPayload leavesPayload = top.leavesmc.leaves.protocol.core.LeavesProtocolManager.getPayload(id, buf);
+ if (leavesPayload != null) {
+ return leavesPayload;
+ }
+ // Leaves end - protocol
return (CustomPacketPayload) (packetdataserializer_a != null ? (CustomPacketPayload) packetdataserializer_a.apply(buf) : readUnknownPayload(id, buf));
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dfe06a0f0d3c6ed0ce89c632a8b2cd050cc2e6a7..32cbb5a838152616e049f9a0e2623aab9a01c55a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1558,6 +1558,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick();
}
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
+
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 1eef67ca260434e8627dba35792a7c5d97df891f..69be29fcd38876e70db9df440869bee1b3c75f00 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -135,6 +135,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePayload(player, packet.payload()); // Leaves - protocol
// Paper start - handle brand payload packet
if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload brandPayload) {
this.player.clientBrandName = brandPayload.brand();
@@ -152,6 +153,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
for (String channel : channels.split("\0")) {
this.getCraftPlayer().addChannel(channel);
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleMinecraftRegister(channel, player); // Leaves - protocol
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d20eed35c85cf5118206dbf9ca2c706b51d4460e..963d5b4d2bc44c32d23da0f45480e0b0bd293ec2 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -342,6 +342,7 @@ public abstract class PlayerList {
}
player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
@@ -601,6 +602,7 @@ public abstract class PlayerList {
return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())));
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerLeave(entityplayer); // Leaves - protocol
// Paper end
org.purpurmc.purpur.task.BossBarTask.removeFromAll(entityplayer.getBukkitEntity()); // Purpur
ServerLevel worldserver = entityplayer.serverLevel();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 76621b258b2d63099959e77d113f279aa71d7d4f..c5308e8104fe16d1c529e220e9714770a470fdbd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -487,6 +487,7 @@ public final class CraftServer implements Server {
MapPalette.setMapColorCache(new CraftMapColorCache(this.logger));
}
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.init(); // Leaves - protocol
}
public boolean getCommandBlockOverride(String command) {
@@ -1092,6 +1093,7 @@ public final class CraftServer implements Server {
org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleServerReload(); // Leaves - protocol
int pollCount = 0;
diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..64a1d25973b032e8cab64bbffa6824a131676773
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocol.java
@@ -0,0 +1,16 @@
+package top.leavesmc.leaves.protocol.core;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LeavesProtocol {
+
+ String namespace() default "minecraft";
+
+ String[] namespaces() default {};
+
+}
diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb8bec80870bbe8a6b6aea324376485875a30d00
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
@@ -0,0 +1,292 @@
+package top.leavesmc.leaves.protocol.core;
+
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.level.ServerPlayer;
+import org.apache.commons.lang.ArrayUtils;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class LeavesProtocolManager {
+
+ private static final Map<LeavesProtocol, Map<ProtocolHandler.PayloadReceiver, Constructor<? extends CustomPacketPayload>>> KNOWN_TYPES = new HashMap<>();
+ private static final Map<LeavesProtocol, Map<ProtocolHandler.PayloadReceiver, Method>> KNOW_RECEIVERS = new HashMap<>();
+
+ private static final List<Method> TICKERS = new ArrayList<>();
+ private static final List<Method> PLAYER_JOIN = new ArrayList<>();
+ private static final List<Method> PLAYER_LEAVE = new ArrayList<>();
+ private static final List<Method> RELOAD_SERVER = new ArrayList<>();
+ private static final Map<ProtocolHandler.MinecraftRegister, Method> MINECRAFT_REGISTER = new HashMap<>();
+
+ public static void init() {
+ for (Class<?> clazz : getClasses("top.leavesmc.leaves.protocol")) {
+ final LeavesProtocol protocol = clazz.getAnnotation(LeavesProtocol.class);
+ if (protocol != null) {
+ Set<Method> methods;
+ try {
+ Method[] publicMethods = clazz.getMethods();
+ Method[] privateMethods = clazz.getDeclaredMethods();
+ methods = new HashSet<>(publicMethods.length + privateMethods.length, 1.0f);
+ Collections.addAll(methods, publicMethods);
+ Collections.addAll(methods, privateMethods);
+ } catch (NoClassDefFoundError e) {
+ e.printStackTrace();
+ return;
+ }
+
+ Map<ProtocolHandler.PayloadReceiver, Constructor<? extends CustomPacketPayload>> map = new HashMap<>();
+ for (final Method method : methods) {
+ if (method.isBridge() || method.isSynthetic() || !Modifier.isStatic(method.getModifiers())) {
+ continue;
+ }
+
+ method.setAccessible(true);
+
+ final ProtocolHandler.Init init = method.getAnnotation(ProtocolHandler.Init.class);
+ if (init != null) {
+ try {
+ method.invoke(null);
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ continue;
+ }
+
+ final ProtocolHandler.PayloadReceiver receiver = method.getAnnotation(ProtocolHandler.PayloadReceiver.class);
+ if (receiver != null) {
+ try {
+ map.put(receiver, receiver.payload().getConstructor(ResourceLocation.class, FriendlyByteBuf.class));
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ continue;
+ }
+
+ if (!KNOW_RECEIVERS.containsKey(protocol)) {
+ KNOW_RECEIVERS.put(protocol, new HashMap<>());
+ }
+
+ KNOW_RECEIVERS.get(protocol).put(receiver, method);
+ continue;
+ }
+
+ final ProtocolHandler.Ticker ticker = method.getAnnotation(ProtocolHandler.Ticker.class);
+ if (ticker != null) {
+ TICKERS.add(method);
+ continue;
+ }
+
+ final ProtocolHandler.PlayerJoin playerJoin = method.getAnnotation(ProtocolHandler.PlayerJoin.class);
+ if (playerJoin != null) {
+ PLAYER_JOIN.add(method);
+ continue;
+ }
+
+ final ProtocolHandler.PlayerLeave playerLeave = method.getAnnotation(ProtocolHandler.PlayerLeave.class);
+ if (playerLeave != null) {
+ PLAYER_LEAVE.add(method);
+ continue;
+ }
+
+ final ProtocolHandler.ReloadServer reloadServer = method.getAnnotation(ProtocolHandler.ReloadServer.class);
+ if (reloadServer != null) {
+ RELOAD_SERVER.add(method);
+ continue;
+ }
+
+ final ProtocolHandler.MinecraftRegister minecraftRegister = method.getAnnotation(ProtocolHandler.MinecraftRegister.class);
+ if (minecraftRegister != null) {
+ MINECRAFT_REGISTER.put(minecraftRegister, method);
+ }
+ }
+ KNOWN_TYPES.put(protocol, map);
+ }
+ }
+ }
+
+ public static CustomPacketPayload getPayload(ResourceLocation id, FriendlyByteBuf buf) {
+ for (LeavesProtocol protocol : KNOWN_TYPES.keySet()) {
+ if (!protocol.namespace().equals(id.getNamespace()) && !ArrayUtils.contains(protocol.namespaces(), id.getNamespace())) {
+ continue;
+ }
+
+ Map<ProtocolHandler.PayloadReceiver, Constructor<? extends CustomPacketPayload>> map = KNOWN_TYPES.get(protocol);
+ for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) {
+ if (receiver.ignoreId() || receiver.payloadId().equals(id.getPath()) || ArrayUtils.contains(receiver.payloadIds(), id.getPath())) {
+ try {
+ return map.get(receiver).newInstance(id, buf);
+ } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void handlePayload(ServerPlayer player, CustomPacketPayload payload) {
+ for (LeavesProtocol protocol : KNOW_RECEIVERS.keySet()) {
+ if (!protocol.namespace().equals(payload.id().getNamespace()) && !ArrayUtils.contains(protocol.namespaces(), payload.id().getNamespace())) {
+ continue;
+ }
+
+ Map<ProtocolHandler.PayloadReceiver, Method> map = KNOW_RECEIVERS.get(protocol);
+ for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) {
+ if (payload.getClass() == receiver.payload()) {
+ if (receiver.ignoreId() || receiver.payloadId().equals(payload.id().getPath()) ||
+ ArrayUtils.contains(receiver.payloadIds(), payload.id().getPath())) {
+ try {
+ map.get(receiver).invoke(player, payload);
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public static void handleTick() {
+ if (!TICKERS.isEmpty()) {
+ try {
+ for (Method method : TICKERS) {
+ method.invoke(null);
+ }
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void handlePlayerJoin(ServerPlayer player) {
+ if (!PLAYER_JOIN.isEmpty()) {
+ try {
+ for (Method method : PLAYER_JOIN) {
+ method.invoke(player);
+ }
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void handlePlayerLeave(ServerPlayer player) {
+ if (!PLAYER_LEAVE.isEmpty()) {
+ try {
+ for (Method method : PLAYER_LEAVE) {
+ method.invoke(player);
+ }
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void handleServerReload() {
+ if (!RELOAD_SERVER.isEmpty()) {
+ try {
+ for (Method method : RELOAD_SERVER) {
+ method.invoke(null);
+ }
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void handleMinecraftRegister(String channel, ServerPlayer player) {
+ if (!MINECRAFT_REGISTER.isEmpty()) {
+ for (ProtocolHandler.MinecraftRegister register : MINECRAFT_REGISTER.keySet()) {
+ if (register.ignoreId() || register.channelId().equals(channel) ||
+ ArrayUtils.contains(register.channelIds(), channel)) {
+ try {
+ MINECRAFT_REGISTER.get(register).invoke(player);
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ private static List<Class<?>> getClasses(String packageName) {
+ List<Class<?>> classes = new ArrayList<>();
+ String packageDirName = packageName.replace('.', '/');
+ Enumeration<URL> dirs;
+ try {
+ dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName);
+ while (dirs.hasMoreElements()) {
+ URL url = dirs.nextElement();
+ findClassInPackageByFile(packageName, URLDecoder.decode(url.getFile(), StandardCharsets.UTF_8), classes);
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return classes;
+ }
+
+ private static void findClassInPackageByFile(String packageName, String filePath, List<Class<?>> classes) {
+ File dir = new File(filePath);
+ if (!dir.exists() || !dir.isDirectory()) {
+ return;
+ }
+
+ File[] dirFiles = dir.listFiles(file -> file.getName().endsWith("class") || file.isDirectory());
+ if (dirFiles != null) {
+ for (File file : dirFiles) {
+ if (file.isDirectory()) {
+ if (!file.getName().equals("core")) {
+ findClassInPackageByFile(packageName + "." + file.getName(), file.getPath(), classes);
+ }
+ continue;
+ }
+ String className = file.getName().substring(0, file.getName().length() - 6);
+ try {
+ classes.add(Thread.currentThread().getContextClassLoader().loadClass(packageName + "." + className));
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ public record EmptyPayload(ResourceLocation id) implements CustomPacketPayload {
+
+ public EmptyPayload(ResourceLocation location, FriendlyByteBuf buf) {
+ this(location);
+ }
+
+ @Override
+ public void write(@NotNull FriendlyByteBuf buf) {
+ }
+ }
+
+ public record LeavesPayload(FriendlyByteBuf data, ResourceLocation id) implements CustomPacketPayload {
+
+ public LeavesPayload(ResourceLocation location, FriendlyByteBuf buf) {
+ this(new FriendlyByteBuf(buf.readBytes(buf.readableBytes())), location);
+ }
+
+ @Override
+ public void write(FriendlyByteBuf buf) {
+ buf.writeBytes(data);
+ }
+ }
+}
diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolHandler.java b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..d696f001d2576d1b61cc732c81f22eb52205072b
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolHandler.java
@@ -0,0 +1,65 @@
+package top.leavesmc.leaves.protocol.core;
+
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+public class ProtocolHandler {
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Init {
+
+ }
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface PayloadReceiver {
+
+ Class<? extends CustomPacketPayload> payload();
+
+ String[] payloadIds() default {};
+
+ String payloadId() default "";
+
+ boolean ignoreId() default false;
+ }
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Ticker {
+ int delay() default 0;
+ }
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface PlayerJoin {
+
+ }
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface PlayerLeave {
+
+ }
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface ReloadServer {
+
+ }
+
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface MinecraftRegister {
+
+ String channelId() default "";
+
+ String[] channelIds() default {};
+
+ boolean ignoreId() default false;
+ }
+}
diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolUtils.java b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..5282c5ad3d26d06ab685ddaaf6fd9a4d49559717
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolUtils.java
@@ -0,0 +1,36 @@
+package top.leavesmc.leaves.protocol.core;
+
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.level.ServerPlayer;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.function.Consumer;
+
+public class ProtocolUtils {
+
+ public static void sendEmptyPayloadPacket(ServerPlayer player, ResourceLocation id) {
+ player.connection.send(new ClientboundCustomPayloadPacket(new LeavesProtocolManager.EmptyPayload(id)));
+ }
+
+ public static void sendPayloadPacket(ServerPlayer player, ResourceLocation id, Consumer<FriendlyByteBuf> consumer) {
+ player.connection.send(new ClientboundCustomPayloadPacket(new CustomPacketPayload() {
+ @Override
+ public void write(@NotNull FriendlyByteBuf buf) {
+ consumer.accept(buf);
+ }
+
+ @Override
+ @NotNull
+ public ResourceLocation id() {
+ return id;
+ }
+ }));
+ }
+
+ public static void sendPayloadPacket(ServerPlayer player, CustomPacketPayload payload) {
+ player.connection.send(new ClientboundCustomPayloadPacket(payload));
+ }
+}

View File

@@ -8,58 +8,11 @@ Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by Jade(https://github.com/Snownee/Jade)
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 004c6fde273599d9a7449c95480951d894ceae76..ec99c3d5808c36d3a1c9107ae34dc3875f828027 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -43,6 +43,7 @@ import org.bukkit.craftbukkit.util.CraftLocation;
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
+import top.leavesmc.leaves.util.ProtocolUtils;
// CraftBukkit end
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
@@ -184,6 +185,9 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
// Paper end
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
+ if (org.dreeam.leaf.LeafConfig.jadeProtocol && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.JadeProtocol.PROTOCOL_ID)) {
+ top.leavesmc.leaves.protocol.JadeProtocol.handlePacket(server, player, packet);
+ }
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aa8f5320d027518dfe28548424c4a6477deeb45e..3d651ad8b6d2feb3327ec29fb5e622e4d93ef63b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -242,6 +242,7 @@ import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.SmithingInventory;
+import top.leavesmc.leaves.util.ProtocolUtils;
// CraftBukkit end
public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl implements ServerGamePacketListener, ServerPlayerConnection, TickablePacketListener {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d20eed35c85cf5118206dbf9ca2c706b51d4460e..2504f80358fd561f4c195569dc6fb32215bf8f6b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -343,6 +343,8 @@ public abstract class PlayerList {
player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined
+ top.leavesmc.leaves.protocol.JadeProtocol.onPlayerJoin(player); // Leaves - Jade
+
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
index e91b4d63d42276f8a498cab7c439c785730f3f6f..a2d7c5008c6d6716d9530e00de0db0276cc0d9fc 100644
index f39710854ddf1cec2abc1efe39b9399f1528fc62..c92ca5954fd929b0a51b0d39db665bede80f075a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -288,7 +288,7 @@ public class Tadpole extends AbstractFish {
@@ -287,7 +287,7 @@ public class Tadpole extends AbstractFish {
}
@@ -68,35 +21,11 @@ index e91b4d63d42276f8a498cab7c439c785730f3f6f..a2d7c5008c6d6716d9530e00de0db027
return Math.max(0, Tadpole.ticksToBeFrog - this.age);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0a27a839d33c95d89aa352f374aa1877fb99acca..fcb500e993820477706ed66943f864be2d637a39 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -487,6 +487,7 @@ public final class CraftServer implements Server {
MapPalette.setMapColorCache(new CraftMapColorCache(this.logger));
}
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
+ top.leavesmc.leaves.protocol.JadeProtocol.init(); // Leaves - Jade
}
public boolean getCommandBlockOverride(String command) {
@@ -1058,6 +1059,11 @@ public final class CraftServer implements Server {
this.console.paperConfigurations.reloadConfigs(this.console);
this.console.galeConfigurations.reloadConfigs(this.console); // Gale - Gale configuration
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
+ // Leaves start - Jade
+ if (org.dreeam.leaf.LeafConfig.jadeProtocol) {
+ top.leavesmc.leaves.protocol.JadeProtocol.enableAllPlayer();
+ }
+ // Leaves end - Jade
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index fc3938c16c43277e22b7a322177fa2a9150f1ff8..9445177d2cb64ae1cd0bd88d0c0b2ad89ef924f6 100644
index 4b6ba35724d364da8397d991ba8453f22911ed07..fffa8e74d1ae895758fdbcb3e573004be3f7dfdb 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -246,7 +246,9 @@ public class LeafConfig {
@@ -186,7 +186,9 @@ public class LeafConfig {
useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
}
@@ -108,10 +37,10 @@ index fc3938c16c43277e22b7a322177fa2a9150f1ff8..9445177d2cb64ae1cd0bd88d0c0b2ad8
public static String sentryDsn = "";
diff --git a/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be370232079095f
index 0000000000000000000000000000000000000000..ebd34c2f0f8db4b43022cb436a047a0bf652acbb
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java
@@ -0,0 +1,577 @@
@@ -0,0 +1,616 @@
+package top.leavesmc.leaves.protocol;
+
+import com.google.common.cache.Cache;
@@ -121,14 +50,15 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Lists;
+import com.mojang.authlib.GameProfile;
+import io.netty.buffer.Unpooled;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.ListTag;
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.chat.CommonComponents;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
+import net.minecraft.network.chat.MutableComponent;
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerLevel;
@@ -173,18 +103,16 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+import net.minecraft.world.level.block.state.properties.BlockStateProperties;
+import net.minecraft.world.phys.BlockHitResult;
+import org.apache.commons.lang3.mutable.MutableInt;
+import org.apache.logging.log4j.util.TriConsumer;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import top.leavesmc.leaves.LeavesLogger;
+import top.leavesmc.leaves.util.ProtocolUtils;
+import top.leavesmc.leaves.protocol.core.LeavesProtocol;
+import top.leavesmc.leaves.protocol.core.ProtocolHandler;
+import top.leavesmc.leaves.protocol.core.ProtocolUtils;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
@@ -192,6 +120,7 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+@LeavesProtocol(namespace = "jade")
+public class JadeProtocol {
+
+ public static final String PROTOCOL_ID = "jade";
@@ -199,9 +128,6 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ // send
+ public static final ResourceLocation PACKET_SERVER_PING = id("server_ping");
+ public static final ResourceLocation PACKET_RECEIVE_DATA = id("receive_data");
+ // call
+ public static final ResourceLocation PACKET_REQUEST_ENTITY = id("request_entity");
+ public static final ResourceLocation PACKET_REQUEST_TILE = id("request_tile");
+
+ private static final HierarchyLookup<IJadeProvider<Entity>> entityDataProviders = new HierarchyLookup<>(Entity.class);
+ private static final HierarchyLookup<IJadeProvider<BlockEntity>> tileDataProviders = new HierarchyLookup<>(BlockEntity.class);
@@ -213,37 +139,12 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ return new ResourceLocation(PROTOCOL_ID, path);
+ }
+
+ public static void onPlayerJoin(ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.jadeProtocol) {
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
+ buf.writeUtf("{}");
+ ProtocolUtils.sendPayloadPacket(player, PACKET_SERVER_PING, buf);
+ }
+ }
+
+ public static void enableAllPlayer() {
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().players) {
+ onPlayerJoin(player);
+ }
+ }
+
+ private static final Map<ResourceLocation, TriConsumer<MinecraftServer, ServerPlayer, FriendlyByteBuf>> globalReceivers = new HashMap<>();
+
+ private static void registerGlobalReceiver(ResourceLocation identifier, TriConsumer<MinecraftServer, ServerPlayer, FriendlyByteBuf> consumer) {
+ globalReceivers.put(identifier, consumer);
+ }
+
+ public static void handlePacket(MinecraftServer server, ServerPlayer player, ServerboundCustomPayloadPacket packet) {
+ globalReceivers.getOrDefault(packet.payload().id(), ((server1, player1, buf) -> LeavesLogger.LOGGER.severe("NullPotion"))).accept(server, player, (FriendlyByteBuf) packet.payload());
+ }
+
+ @ProtocolHandler.Init
+ public static void init() {
+ entityDataProviders.register(Entity.class, ((data, player, world, entity, showDetails) -> {
+ UUID ownerUUID = null;
+ if (entity instanceof OwnableEntity) {
+ ownerUUID = ((OwnableEntity) entity).getOwnerUUID();
+ } else if (entity instanceof AbstractHorse) {
+ ownerUUID = ((AbstractHorse) entity).getOwnerUUID();
+ }
+ if (ownerUUID != null) {
+ MinecraftServer.getServer().getProfileCache().get(ownerUUID).map(GameProfile::getName).ifPresent(name -> data.putString("OwnerName", name));
@@ -258,14 +159,16 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ ListTag list = new ListTag();
+ for (MobEffectInstance effect : effects) {
+ CompoundTag compound = new CompoundTag();
+ compound.putString("Name", effect.getDescriptionId());
+ compound.putInt("Amplifier", effect.getAmplifier());
+ int duration = Math.min(32767, effect.getDuration());
+ compound.putInt("Duration", duration);
+ compound.putString("Name", Component.Serializer.toJson(getEffectName(effect)));
+ if (effect.isInfiniteDuration()) {
+ compound.putBoolean("Infinite", true);
+ } else {
+ compound.putInt("Duration", effect.getDuration());
+ }
+ compound.putBoolean("Bad", effect.getEffect().getCategory() == MobEffectCategory.HARMFUL);
+ list.add(compound);
+ }
+ data.put("Potions", list);
+ data.put("StatusEffects", list);
+ }));
+ entityDataProviders.register(AgeableMob.class, ((data, player, world, entity, showDetails) -> {
+ int time = -((AgeableMob) entity).getAge();
@@ -423,19 +326,25 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ }
+ }
+ }));
+
+ registerGlobalReceiver(PACKET_REQUEST_TILE, JadeProtocol::requestTileData);
+ registerGlobalReceiver(PACKET_REQUEST_ENTITY, JadeProtocol::requestEntityData);
+ }
+
+ public static void requestEntityData(MinecraftServer server, ServerPlayer player, FriendlyByteBuf buf) {
+ @ProtocolHandler.PlayerJoin
+ public static void onPlayerJoin(ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.jadeProtocol) {
+ ProtocolUtils.sendPayloadPacket(player, PACKET_SERVER_PING, buf -> buf.writeUtf("{}"));
+ }
+ }
+
+ @ProtocolHandler.PayloadReceiver(payload = RequestEntityPayload.class, payloadId = "request_entity")
+ public static void requestEntityData(ServerPlayer player, RequestEntityPayload payload) {
+ if (!org.dreeam.leaf.LeafConfig.jadeProtocol) {
+ return;
+ }
+
+ MinecraftServer server = MinecraftServer.getServer();
+ Level world = player.level();
+ boolean showDetails = buf.readBoolean();
+ Entity entity = world.getEntity(buf.readVarInt());
+ boolean showDetails = payload.showDetails;
+ Entity entity = world.getEntity(payload.entityId);
+ if (entity == null || player.distanceToSqr(entity) > MAX_DISTANCE_SQR) {
+ return;
+ }
@@ -456,19 +365,19 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ }
+ tag.putInt("WailaEntityID", entity.getId());
+
+ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer());
+ buf1.writeNbt(tag);
+ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf1);
+ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf -> buf.writeNbt(tag));
+ });
+ }
+
+ public static void requestTileData(MinecraftServer server, ServerPlayer player, FriendlyByteBuf buf) {
+ @ProtocolHandler.PayloadReceiver(payload = RequestTilePayload.class, payloadId = "request_tile")
+ public static void requestTileData(ServerPlayer player, RequestTilePayload payload) {
+ if (!org.dreeam.leaf.LeafConfig.jadeProtocol) {
+ return;
+ }
+
+ boolean showDetails = buf.readBoolean();
+ BlockHitResult result = buf.readBlockHitResult();
+ MinecraftServer server = MinecraftServer.getServer();
+ boolean showDetails = payload.showDetails;
+ BlockHitResult result = payload.hitResult;
+ BlockPos pos = result.getBlockPos();
+ Level world = player.level();
+ if (pos.distSqr(player.blockPosition()) > MAX_DISTANCE_SQR || !world.isLoaded(pos)) {
@@ -498,19 +407,79 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ tag.putInt("z", pos.getZ());
+ tag.putString("id", BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(tile.getType()).toString());
+
+ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer());
+ buf1.writeNbt(tag);
+ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf1);
+ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf -> buf.writeNbt(tag));
+ });
+ }
+
+ @ProtocolHandler.ReloadServer
+ public static void onServerReload() {
+ if (org.dreeam.leaf.LeafConfig.jadeProtocol) {
+ enableAllPlayer();
+ }
+ }
+
+ public static void enableAllPlayer() {
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().players) {
+ onPlayerJoin(player);
+ }
+ }
+
+ public interface IJadeProvider<T> {
+ public void saveData(CompoundTag data, ServerPlayer player, Level world, T object, boolean showDetails);
+ void saveData(CompoundTag data, ServerPlayer player, Level world, T object, boolean showDetails);
+ }
+
+ public record RequestEntityPayload(boolean showDetails, int entityId) implements CustomPacketPayload {
+
+ private static final ResourceLocation PACKET_REQUEST_ENTITY = JadeProtocol.id("request_entity");
+
+ public RequestEntityPayload(ResourceLocation id, FriendlyByteBuf buf) {
+ this(buf.readBoolean(), buf.readInt());
+ }
+
+ @Override
+ public void write(FriendlyByteBuf buf) {
+ buf.writeBoolean(showDetails);
+ buf.writeInt(entityId);
+ }
+
+ @Override
+ @NotNull
+ public ResourceLocation id() {
+ return PACKET_REQUEST_ENTITY;
+ }
+ }
+
+ public record RequestTilePayload(boolean showDetails, BlockHitResult hitResult) implements CustomPacketPayload {
+
+ private static final ResourceLocation PACKET_REQUEST_TILE = JadeProtocol.id("request_tile");
+
+ public RequestTilePayload(ResourceLocation id, FriendlyByteBuf buf) {
+ this(buf.readBoolean(), buf.readBlockHitResult());
+ }
+
+ @Override
+ public void write(FriendlyByteBuf buf) {
+ buf.writeBoolean(showDetails);
+ buf.writeBlockHitResult(hitResult);
+ }
+
+ @Override
+ @NotNull
+ public ResourceLocation id() {
+ return PACKET_REQUEST_TILE;
+ }
+ }
+
+ // Power by Jade
+
+ public static Component getEffectName(MobEffectInstance mobEffectInstance) {
+ MutableComponent mutableComponent = mobEffectInstance.getEffect().getDisplayName().copy();
+ if (mobEffectInstance.getAmplifier() >= 1 && mobEffectInstance.getAmplifier() <= 9) {
+ mutableComponent.append(CommonComponents.SPACE).append(Component.translatable("enchantment.level." + (mobEffectInstance.getAmplifier() + 1)));
+ }
+ return mutableComponent;
+ }
+
+ public static List<ViewGroup<ItemStack>> getGroups(ServerPlayer player, ServerLevel world, Object target, boolean showDetails) {
+ if (target instanceof RandomizableContainerBlockEntity te && te.lootTable != null) {
+ return List.of();
@@ -687,5 +656,4 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023
+ list.addAll(objects.get(clazz));
+ }
+ }
+
+}

View File

@@ -6,61 +6,11 @@ Subject: [PATCH] Leaves: Appleskin Protocol
Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b54a764c2a24f8e09792ade7a9a4ebb17d9d4e7b..e4455fcee23ea7511fdacd3ef9c6dd2353fc6191 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1560,6 +1560,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick();
}
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.tick(); // Leaves - appleskin
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2504f80358fd561f4c195569dc6fb32215bf8f6b..f5f9fa9dff79a7ad4c92e58f8e4f5a821145933a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -344,6 +344,7 @@ public abstract class PlayerList {
player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined
top.leavesmc.leaves.protocol.JadeProtocol.onPlayerJoin(player); // Leaves - Jade
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedIn(player); // Leaves - appleskin
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
@@ -603,6 +604,7 @@ public abstract class PlayerList {
return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())));
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedOut(entityplayer); // Leaves - appleskin
// Paper end
org.purpurmc.purpur.task.BossBarTask.removeFromAll(entityplayer.getBukkitEntity()); // Purpur
ServerLevel worldserver = entityplayer.serverLevel();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index fcb500e993820477706ed66943f864be2d637a39..15fe870aa382d5ad01445331181f75256bf4b97f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1064,6 +1064,13 @@ public final class CraftServer implements Server {
top.leavesmc.leaves.protocol.JadeProtocol.enableAllPlayer();
}
// Leaves end - Jade
+ // Leaves start - appleskin
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.enableAllPlayer();
+ } else {
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.disableAllPlayer();
+ }
+ // Leaves end - appleskin
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 9445177d2cb64ae1cd0bd88d0c0b2ad89ef924f6..56dc6cb0b5659619ec5df42088fbecf758e652c6 100644
index fffa8e74d1ae895758fdbcb3e573004be3f7dfdb..ae57267a0bc005519eb8bdb9313812fbecd30ac2 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -247,8 +247,10 @@ public class LeafConfig {
@@ -187,8 +187,10 @@ public class LeafConfig {
}
public static boolean jadeProtocol = false;
@@ -73,21 +23,21 @@ index 9445177d2cb64ae1cd0bd88d0c0b2ad89ef924f6..56dc6cb0b5659619ec5df42088fbecf7
public static String sentryDsn = "";
diff --git a/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..e471fb844c34294886b6668b04ec50986c47f9ca
index 0000000000000000000000000000000000000000..ccc143344041b183912294f7e749f4b0506c063b
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
@@ -0,0 +1,94 @@
@@ -0,0 +1,111 @@
+package top.leavesmc.leaves.protocol;
+
+import io.netty.buffer.Unpooled;
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.food.FoodData;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import top.leavesmc.leaves.util.ProtocolUtils;
+import top.leavesmc.leaves.protocol.core.LeavesProtocol;
+import top.leavesmc.leaves.protocol.core.ProtocolHandler;
+import top.leavesmc.leaves.protocol.core.ProtocolUtils;
+
+import java.util.HashMap;
+import java.util.HashSet;
@@ -95,6 +45,7 @@ index 0000000000000000000000000000000000000000..e471fb844c34294886b6668b04ec5098
+import java.util.Set;
+import java.util.UUID;
+
+@LeavesProtocol(namespace = "appleskin")
+public class AppleSkinProtocol {
+
+ public static final String PROTOCOL_ID = "appleskin";
@@ -114,6 +65,62 @@ index 0000000000000000000000000000000000000000..e471fb844c34294886b6668b04ec5098
+ return new ResourceLocation(PROTOCOL_ID, path);
+ }
+
+ @ProtocolHandler.PlayerJoin
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ players.add(player);
+ resetPlayerData(player);
+ }
+ }
+
+ @ProtocolHandler.PlayerLeave
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ players.remove(player);
+ resetPlayerData(player);
+ }
+ }
+
+ @ProtocolHandler.Ticker
+ public static void tick() {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ for (ServerPlayer player : players) {
+ if (!player.getBukkitEntity().getListeningPluginChannels().contains(SATURATION_KEY.toString())) {
+ continue;
+ }
+
+ FoodData data = player.getFoodData();
+
+ float saturation = data.getSaturationLevel();
+ Float previousSaturation = previousSaturationLevels.get(player.getUUID());
+ if (previousSaturation == null || saturation != previousSaturation) {
+ ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf -> {
+ buf.writeFloat(saturation);
+ });
+ previousSaturationLevels.put(player.getUUID(), saturation);
+ }
+
+ float exhaustion = data.getExhaustionLevel();
+ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) {
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> {
+ buf.writeFloat(exhaustion);
+ });
+ previousExhaustionLevels.put(player.getUUID(), exhaustion);
+ }
+ }
+ }
+ }
+
+ @ProtocolHandler.ReloadServer
+ public static void onServerReload() {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ enableAllPlayer();
+ } else {
+ disableAllPlayer();
+ }
+ }
+
+ public static void enableAllPlayer() {
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
+ onPlayerLoggedIn(player);
@@ -126,48 +133,8 @@ index 0000000000000000000000000000000000000000..e471fb844c34294886b6668b04ec5098
+ }
+ }
+
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ players.add(player);
+ resetPlayerData(player);
+ }
+ }
+
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ players.remove(player);
+ resetPlayerData(player);
+ }
+ }
+
+ private static void resetPlayerData(@NotNull ServerPlayer player) {
+ previousExhaustionLevels.remove(player.getUUID());
+ previousSaturationLevels.remove(player.getUUID());
+ }
+
+ public static void tick() {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ for (ServerPlayer player : players) {
+ FoodData data = player.getFoodData();
+
+ float saturation = data.getSaturationLevel();
+ Float previousSaturation = previousSaturationLevels.get(player.getUUID());
+ if (previousSaturation == null || saturation != previousSaturation) {
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
+ buf.writeFloat(saturation);
+ ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf);
+ previousSaturationLevels.put(player.getUUID(), saturation);
+ }
+
+ float exhaustion = data.getExhaustionLevel();
+ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) {
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
+ buf.writeFloat(exhaustion);
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf);
+ previousExhaustionLevels.put(player.getUUID(), exhaustion);
+ }
+ }
+ }
+ }
+}

View File

@@ -7,10 +7,10 @@ Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f5f9fa9dff79a7ad4c92e58f8e4f5a821145933a..cb2388ae2868a49aa0236844c104f12cfa61f190 100644
index 963d5b4d2bc44c32d23da0f45480e0b0bd293ec2..8042254407f7aabfa41483ef6b5661ca7cb11a75 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1353,6 +1353,7 @@ public abstract class PlayerList {
@@ -1351,6 +1351,7 @@ public abstract class PlayerList {
player.connection.send(new ClientboundInitializeBorderPacket(worldborder));
player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle()));
@@ -19,18 +19,18 @@ index f5f9fa9dff79a7ad4c92e58f8e4f5a821145933a..cb2388ae2868a49aa0236844c104f12c
// CraftBukkit start - handle player weather
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 56dc6cb0b5659619ec5df42088fbecf758e652c6..4cf74bc39f61e024b7d453759cdc9397f0e3d4f5 100644
index ae57267a0bc005519eb8bdb9313812fbecd30ac2..080cf996ee41503c6adc1d66e19be219102cbbcd 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -19,6 +19,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -1,6 +1,7 @@
package org.dreeam.leaf;
import com.google.common.collect.ImmutableMap;
+import java.util.Random;
public class LeafConfig {
@@ -248,9 +249,13 @@ public class LeafConfig {
import net.minecraft.server.MinecraftServer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
@@ -188,9 +189,13 @@ public class LeafConfig {
public static boolean jadeProtocol = false;
public static boolean appleskinProtocol = false;
@@ -46,20 +46,20 @@ index 56dc6cb0b5659619ec5df42088fbecf758e652c6..4cf74bc39f61e024b7d453759cdc9397
public static String sentryDsn = "";
diff --git a/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..461f9f947f14c4eb86f80b644628cebbe6fb3619
index 0000000000000000000000000000000000000000..68dce7130b97270840405eadf0677ab5ffd6b3b8
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java
@@ -0,0 +1,38 @@
@@ -0,0 +1,41 @@
+package top.leavesmc.leaves.protocol;
+
+import io.netty.buffer.Unpooled;
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.level.ServerPlayer;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import top.leavesmc.leaves.util.ProtocolUtils;
+import top.leavesmc.leaves.protocol.core.LeavesProtocol;
+import top.leavesmc.leaves.protocol.core.ProtocolUtils;
+
+@LeavesProtocol(namespaces = {"xaerominimap", "xaeroworldmap"})
+public class XaeroMapProtocol {
+
+ public static final String PROTOCOL_ID_MINI = "xaerominimap";
@@ -80,11 +80,14 @@ index 0000000000000000000000000000000000000000..461f9f947f14c4eb86f80b644628cebb
+
+ public static void onSendWorldInfo(@NotNull ServerPlayer player) {
+ if (org.dreeam.leaf.LeafConfig.xaeroMapProtocol) {
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
+ buf.writeByte(0);
+ buf.writeInt(org.dreeam.leaf.LeafConfig.xaeroMapServerID);
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf);
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf);
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf -> {
+ buf.writeByte(0);
+ buf.writeInt(org.dreeam.leaf.LeafConfig.xaeroMapServerID);
+ });
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf -> {
+ buf.writeByte(0);
+ buf.writeInt(org.dreeam.leaf.LeafConfig.xaeroMapServerID);
+ });
+ }
+ }
+}

View File

@@ -14,10 +14,10 @@ This patch was ported downstream from the Petal fork.
Makes most pathfinding-related work happen asynchronously
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d6009cf7ea6857e98f86b6bd71e34d0f137921ad..4a029f394e9df35a5bcbc42f8e2731fc2d789326 100644
index fd3b14649d4ba0212ec3e3d2cd36cf79b070b835..b333e08e4988438609e4c327dd101a546734c1b3 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -293,6 +293,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -291,6 +291,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Nullable
@Override
public LivingEntity getTarget() {
@@ -591,7 +591,7 @@ index 8db20db72cd51046213625fac46c35854c59ec5d..fc99483dfe248d26885c904b72c93b0d
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 6c04c8e7776b2830ac368229da834532e8ce163e..abf25dfbf33be9be1875470448ebef8547b5aa2c 100644
index 38a3dcec138d9233a46e5d523bcc6d64bc7fffd0..4f53747d6b90db92ae12f656c3525c45fb051d3f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -1147,7 +1147,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -613,7 +613,7 @@ index 6c04c8e7776b2830ac368229da834532e8ce163e..abf25dfbf33be9be1875470448ebef85
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e90aa3e58 100644
index ec508548ba24162913d7ec112b48a4ae18f5a43e..d08721d1ab8538decffad3717962442e281bb49c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -66,6 +66,8 @@ import net.minecraft.world.level.pathfinder.Node;
@@ -625,7 +625,7 @@ index afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e
public class Frog extends Animal implements VariantHolder<FrogVariant> {
public static final Ingredient TEMPTATION_ITEM = Ingredient.of(Items.SLIME_BALL);
@@ -439,6 +441,17 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
@@ -438,6 +440,17 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
super(frog, world);
}
@@ -643,7 +643,7 @@ index afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e
@Override
public boolean canCutCorner(BlockPathTypes nodeType) {
return nodeType != BlockPathTypes.WATER_BORDER && super.canCutCorner(nodeType);
@@ -448,6 +461,11 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
@@ -447,6 +460,11 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new Frog.FrogNodeEvaluator(true);
this.nodeEvaluator.setCanPassDoors(true);
@@ -717,10 +717,10 @@ index 2f49b528601a1feb7246fe7a9b83ce828c2d78fc..a29f212f3b38f1d80d7d5023f86a7acf
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
index 9e2498f8cb4a1a309aa037c01aa3039924f5b29e..2df6e3772ffb79f17c1e4097cbf3ea1ebc2a82ae 100644
index a82805a771fa4d1a9eceb8b5778fad30000e974e..3e1d2908cbfc5dd467443729fe9f3cc888af0016 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -622,6 +622,16 @@ public class Warden extends Monster implements VibrationSystem {
@@ -620,6 +620,16 @@ public class Warden extends Monster implements VibrationSystem {
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new WalkNodeEvaluator();
this.nodeEvaluator.setCanPassDoors(true);
@@ -935,38 +935,33 @@ index 0e2b14e7dfedf209d63279c81723fd7955122d78..079b278e2e262af433bb5bd0c12b3d8d
public SwimNodeEvaluator(boolean canJumpOutOfWater) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 4cf74bc39f61e024b7d453759cdc9397f0e3d4f5..4ec2954384a7c99b4f489b1b2a666f93ee69e98f 100644
index 080cf996ee41503c6adc1d66e19be219102cbbcd..245bf3d0c17e91c24ff28e53f0ee73b66b4d5e50 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.core.registries.BuiltInRegistries;
@@ -3,6 +3,7 @@ package org.dreeam.leaf;
import com.google.common.collect.ImmutableMap;
import java.util.Random;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.EntityType;
+import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.jetbrains.annotations.Nullable;
@@ -20,6 +21,7 @@ import java.util.List;
import java.util.Locale;
@@ -16,6 +17,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.logging.Level;
public class LeafConfig {
@@ -196,6 +198,9 @@ public class LeafConfig {
public static boolean throttleInactiveGoalSelectorTick = true;
public static Map<String, Integer> projectileTimeouts;
@@ -183,8 +185,22 @@ public class LeafConfig {
}
public static boolean useSpigotItemMergingMechanism = true;
+ public static boolean asyncPathfinding = false;
+ public static int asyncPathfindingMaxThreads = 0;
+ public static int asyncPathfindingKeepalive = 60;
private static void performance() {
boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
"Whether or not asynchronous mob spawning should be enabled.",
@@ -245,6 +250,17 @@ public class LeafConfig {
entityType.ttl = config.getInt("entity_timeouts." + type, -1);
}
useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
+ asyncPathfinding = getBoolean("performance.async-pathfinding.enable", asyncPathfinding);
+ asyncPathfindingMaxThreads = getInt("performance.async-pathfinding.max-threads", asyncPathfindingMaxThreads);

View File

@@ -27,7 +27,7 @@ index 727a5120f16c30a0393b25a762f031eb40dd69b4..0380672e1ba184720acb35a630722bc6
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/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index acaa1575a2d7164174d9514d750696d7f844f065..bb55302e3f846961c026e0607f04366756921dc1 100644
index 8cf0d4e03726b4e4340850715b6ab1af8c183fbd..0f17b1f50d369c46526d14eefdd9e0a498c11528 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -10,6 +10,7 @@ import java.util.Arrays;
@@ -38,7 +38,7 @@ index acaa1575a2d7164174d9514d750696d7f844f065..bb55302e3f846961c026e0607f043667
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@@ -652,7 +653,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -642,7 +643,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - optimise chunk tick iteration
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sat, 10 Jun 2023 11:28:24 +0800
Subject: [PATCH] Fix compile error
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java
index d1088e4b7fa5f8e689f23b150b83645ce1ae5a0e..f951f4024745503e9cdfa7ff17b9313ac6d7b4c4 100644
--- a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java
@@ -39,7 +39,7 @@ public class PermissionConfigurationSerializer {
try {
result.add(Permission.loadPermission(entry.getKey().toString(), (Map<?, ?>) entry.getValue(), permissionDefault, result));
} catch (Throwable ex) {
- throw new SerializationException(null, "Error loading permission %s".formatted(entry.getKey()), ex);
+ throw new SerializationException((Type) null, "Error loading permission %s".formatted(entry.getKey()), ex);
}
}
}

View File

@@ -35,7 +35,7 @@ index ed2bfe717406741583b9c261c6ba18cd4a47f67b..1916e5f1d6bc4c2b14a138a46477adea
return false;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 762edca984d02b8a2a4224adba1f240fa9ea0661..f9abae6d2f1e28e36919e32e298d85494cae62ab 100644
index 57d3b887b606800d0d1e12b46ae793c50f09bee3..af472e1532000a764eb7464a1661fbcce561a8e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -580,12 +580,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@@ -30,7 +30,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 064281266350872693029069ee732bd4ff66448a..35515563d498a6e9817d9bd92ff5eda959de212a 100644
index fbfef5678423f1224bfcfe62073e0603bb0bd58d..ccbc0c3d4f151194fb937aed75837ca1afa1306b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -864,6 +864,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -295,7 +295,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..812313bb3aade49c4afa2eec9be1f9cc
this.assignProfessionWhenSpawned = false;
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 5d161351e7517acf57e98203bab8c9f9ab9d4005..47c7b75b721bb2210eded56a7590612fbc3a395c 100644
index b1fcd3588c22143f9852805a6cea3b6cf6c33a1f..7aa266b6cecb7e8d2bed41ec2e68f057deb99d05 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -1,7 +1,9 @@
@@ -316,22 +316,16 @@ index 5d161351e7517acf57e98203bab8c9f9ab9d4005..47c7b75b721bb2210eded56a7590612f
import java.util.List;
import java.util.Map;
@@ -165,6 +168,11 @@ public class LeafConfig {
@@ -163,7 +166,33 @@ public class LeafConfig {
private static void removal() {
}
public static boolean enableAsyncMobSpawning = true;
public static boolean asyncMobSpawningInitialized;
+ public static boolean dabEnabled = true;
+ public static int startDistance = 12;
+ public static int startDistanceSquared;
+ public static int maximumActivationPrio = 20;
+ public static int activationDistanceMod = 8;
private static void performance() {
boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
"Whether or not asynchronous mob spawning should be enabled.",
@@ -177,6 +185,27 @@ public class LeafConfig {
asyncMobSpawningInitialized = true;
enableAsyncMobSpawning = asyncMobSpawning;
}
+ dabEnabled = getBoolean("performance.dab.enabled", "dab.enabled", dabEnabled);
+ startDistance = getInt("performance.dab.start-distance", "dab.start-distance", startDistance,
+ "This value determines how far away an entity has to be",

View File

@@ -26,18 +26,18 @@ index bb32b2d71b65254ccfa6a73e7debc63f801e7dc5..db0fb4cd2041b456269479bd97751bd7
}
if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 47c7b75b721bb2210eded56a7590612fbc3a395c..9a11228726c9a489181fc8a0c511ea83cdcf0f6e 100644
index 7aa266b6cecb7e8d2bed41ec2e68f057deb99d05..9cfa1d626c83a5c2fb1ae7db4746a4cb07262778 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -173,6 +173,7 @@ public class LeafConfig {
@@ -171,6 +171,7 @@ public class LeafConfig {
public static int startDistanceSquared;
public static int maximumActivationPrio = 20;
public static int activationDistanceMod = 8;
+ public static boolean throttleInactiveGoalSelectorTick = true;
private static void performance() {
boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
"Whether or not asynchronous mob spawning should be enabled.",
@@ -206,6 +207,9 @@ public class LeafConfig {
dabEnabled = getBoolean("performance.dab.enabled", "dab.enabled", dabEnabled);
startDistance = getInt("performance.dab.start-distance", "dab.start-distance", startDistance,
@@ -193,6 +194,9 @@ public class LeafConfig {
entityType.dabEnabled = false;
}, () -> MinecraftServer.LOGGER.warn("Unknown entity \"" + name + "\"")));
setComment("performance.dab", "Optimizes entity brains when", "they're far away from the player");

View File

@@ -36,7 +36,7 @@ index ebf05a484175548c0e411adfd35fd1f648925fed..2561e74ffdf595a9b6ae13dcd738662c
private String descriptionId;
@Nullable
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 9a11228726c9a489181fc8a0c511ea83cdcf0f6e..9299d2fe1cda71b6881fd8bd65d3d74b1189a196 100644
index 9cfa1d626c83a5c2fb1ae7db4746a4cb07262778..c135a861217d0ae43cf1b84e5bf259b41a0bf92e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -17,6 +17,7 @@ import java.lang.reflect.Method;
@@ -47,15 +47,15 @@ index 9a11228726c9a489181fc8a0c511ea83cdcf0f6e..9299d2fe1cda71b6881fd8bd65d3d74b
import java.util.Map;
public class LeafConfig {
@@ -174,6 +175,7 @@ public class LeafConfig {
@@ -172,6 +173,7 @@ public class LeafConfig {
public static int maximumActivationPrio = 20;
public static int activationDistanceMod = 8;
public static boolean throttleInactiveGoalSelectorTick = true;
+ public static Map<String, Integer> projectileTimeouts;
private static void performance() {
boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
"Whether or not asynchronous mob spawning should be enabled.",
@@ -210,6 +212,18 @@ public class LeafConfig {
dabEnabled = getBoolean("performance.dab.enabled", "dab.enabled", dabEnabled);
startDistance = getInt("performance.dab.start-distance", "dab.start-distance", startDistance,
@@ -197,6 +199,18 @@ public class LeafConfig {
throttleInactiveGoalSelectorTick = getBoolean("performance.inactive-goal-selector-throttle", "inactive-goal-selector-throttle", throttleInactiveGoalSelectorTick,
"Throttles the AI goal selector in entity inactive ticks.",
"This can improve performance by a few percent, but has minor gameplay implications.");