mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Update 1.20.2 (#139)
This commit is contained in:
@@ -29,7 +29,7 @@ maven {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("top.leavesmc.leaves:leaves-api:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("top.leavesmc.leaves:leaves-api:1.20.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -39,7 +39,7 @@ Each time you want to update your dependency, you must re-build Leaves.
|
||||
Leaves-Server:
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("top.leavesmc.leaves:leaves:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("top.leavesmc.leaves:leaves:1.20.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ maven {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("top.leavesmc.leaves:leaves-api:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("top.leavesmc.leaves:leaves-api:1.20.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -38,7 +38,7 @@ dependencies {
|
||||
Leaves-Server:
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("top.leavesmc.leaves:leaves:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("top.leavesmc.leaves:leaves:1.20.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -67,3 +67,7 @@ paperweight {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<io.papermc.paperweight.tasks.RebuildGitPatches> {
|
||||
filterPatches.set(false)
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
group=top.leavesmc.leaves
|
||||
version=1.20.1-R0.1-SNAPSHOT
|
||||
version=1.20.2-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.20.1
|
||||
packageVersion=1_20_R1
|
||||
mcVersion=1.20.2
|
||||
packageVersion=1_20_R2
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
paperRef=773dd724469bae89d0c2075edc3d1ddc8d5b0b18
|
||||
preVersion=false
|
||||
paperRef=fe54a13b1301312304d9c1e46ad91b039657120b
|
||||
preVersion=true
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Hide irrelevant compilation warnings
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index aed834334385ff3038ae69f3f34d129ad2507960..5ff778a10d46a75687da1c4705669416c8fdb456 100644
|
||||
index 639651972fddce4dff63a0f0a7e566a15b9e2dd6..580a37740f04a4aad435fc50b521a59a772f16af 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -89,6 +89,15 @@ val generateApiVersioningFile by tasks.registering {
|
||||
@@ -32,4 +32,4 @@ index aed834334385ff3038ae69f3f34d129ad2507960..5ff778a10d46a75687da1c4705669416
|
||||
+ options.addStringOption("Xdoclint:none", "-quiet") // Leaves - hide irrelevant compilation warnings
|
||||
}
|
||||
|
||||
// Paper start
|
||||
tasks.test {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] SIMD support
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 5ff778a10d46a75687da1c4705669416c8fdb456..ea64daa8af9630433ea3a1053d3246f0b16aceb6 100644
|
||||
index 580a37740f04a4aad435fc50b521a59a772f16af..45c2e0b9417cc5e0d54dc007f1259c0568966aab 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -95,6 +95,7 @@ tasks.withType<JavaCompile> {
|
||||
@@ -23,4 +23,4 @@ index 5ff778a10d46a75687da1c4705669416c8fdb456..ea64daa8af9630433ea3a1053d3246f0
|
||||
+ options.addStringOption("-add-modules", "jdk.incubator.vector") // Leaves - SIMD support
|
||||
}
|
||||
|
||||
// Paper start
|
||||
tasks.test {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Leaves API publish
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index ea64daa8af9630433ea3a1053d3246f0b16aceb6..e4fd455f0019c24fa78ae1c9bf48f2ca0c5594e5 100644
|
||||
index 45c2e0b9417cc5e0d54dc007f1259c0568966aab..7c50ed670facceac89df004416ce417237d88d11 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -171,3 +171,14 @@ tasks.check {
|
||||
@@ -181,3 +181,14 @@ tasks.check {
|
||||
dependsOn(scanJar)
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Force peaceful mode switch
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index b8b97df069b28fa3cf32f1ad1f01f586a0cfbc78..ba45d4eed9f7663da54ce2f702853941d6c24184 100644
|
||||
index da524a71af74b02515b037f7fe09ba6988e2c8bf..649a80fc7cb12c4d2fe2c472178b6ca3b16372f7 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -4016,6 +4016,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 7e0580bbd0a557c7bb269507a99d25db07bf31f1..8833737c364f53b18e74c86ceb21899d5da6c70d 100644
|
||||
index 683159586641dd9aa42ae96fa51602469755723f..a0fbd152b6933e198b47abb13acec9004c91d27f 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
@@ -16,7 +16,7 @@ index 7e0580bbd0a557c7bb269507a99d25db07bf31f1..8833737c364f53b18e74c86ceb21899d
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ implementation(project(":leaves-api")) // Leaves
|
||||
+ // Leaves start
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.1-R0.1-SNAPSHOT") {
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") {
|
||||
+ exclude("io.papermc.paper", "paper-api")
|
||||
+ }
|
||||
+ // Leaves end
|
||||
@@ -26,7 +26,7 @@ index 7e0580bbd0a557c7bb269507a99d25db07bf31f1..8833737c364f53b18e74c86ceb21899d
|
||||
@@ -60,19 +64,29 @@ dependencies {
|
||||
}
|
||||
|
||||
val craftbukkitPackageVersion = "1_20_R1" // Paper
|
||||
val craftbukkitPackageVersion = "1_20_R2" // Paper
|
||||
+
|
||||
+// Leaves start - hide irrelevant compilation warnings
|
||||
+tasks.withType<JavaCompile> {
|
||||
@@ -55,7 +55,7 @@ index 7e0580bbd0a557c7bb269507a99d25db07bf31f1..8833737c364f53b18e74c86ceb21899d
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -149,7 +163,7 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -156,7 +170,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
@@ -64,6 +64,15 @@ index 7e0580bbd0a557c7bb269507a99d25db07bf31f1..8833737c364f53b18e74c86ceb21899d
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
@@ -212,7 +226,6 @@ val runtimeClasspathForRunDev = sourceSets.main.flatMap { src ->
|
||||
}
|
||||
tasks.registerRunTask("runDev") {
|
||||
description = "Spin up a non-relocated Mojang-mapped test server"
|
||||
- classpath(tasks.filterProjectDir.flatMap { it.outputJar })
|
||||
- classpath(runtimeClasspathForRunDev)
|
||||
+ classpath(sourceSets.main.map { it.runtimeClasspath }) // Leaves - fix it for windows
|
||||
jvmArgs("-DPaper.isRunDev=true")
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..9ce4d3d96d2d5fbde1f0af599209c6c55038fb58 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -153,10 +162,10 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..9ce4d3d96d2d5fbde1f0af599209c6c5
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 67ee3a4ca8a6cdeb275653d492a1fea8037c51fb..6b487cf1045b8ea6cda589c7c0d5467c528bbfe8 100644
|
||||
index 97745f0bab8d82d397c6c2a5775aed92bca0a034..2a473825144f69968635d8894f1499af1c39481a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1692,7 +1692,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1697,7 +1697,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -166,7 +175,7 @@ index 67ee3a4ca8a6cdeb275653d492a1fea8037c51fb..6b487cf1045b8ea6cda589c7c0d5467c
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index c49802c936ae8e3f4dc1badd98414d96714ecd60..b0e3ac5b92f0f45a47e2972d3baa8dd86d77de30 100644
|
||||
index dbccbcb9b44e4efacdf53c2d161115cc20b36cff..81e3d3dbc74e238c76ead4a0b6efaa2ada3cc49d 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -217,11 +217,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -184,10 +193,10 @@ index c49802c936ae8e3f4dc1badd98414d96714ecd60..b0e3ac5b92f0f45a47e2972d3baa8dd8
|
||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 74d06790de674cbd230a0b14ac9a6b614c9f84ef..6358daff1af6c0094f469966bc94b8b5583c4f15 100644
|
||||
index fcd5096d64edfaf6bce3ecce8c9b9afb84462786..fab14ca6965d903df220e0f7d0e73e20cfb5f2b1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -267,7 +267,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
@@ -197,7 +206,7 @@ index 74d06790de674cbd230a0b14ac9a6b614c9f84ef..6358daff1af6c0094f469966bc94b8b5
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 7c29d92362a82330440dff151bcf421f15c68f71..dc13164f498eeb1d52c08f9180c44e96c0478b2e 100644
|
||||
index e7746952417a3ca4ea97103e38568db42039f717..cd92954cb2f622fbbfa8b0a9ec82bb15fd5af371 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -300,7 +300,7 @@ public class Main {
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Delete Timings
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
deleted file mode 100644
|
||||
index 112029cb275d45dced60807820f1bfe9f394496d..0000000000000000000000000000000000000000
|
||||
index e6452bb4f29bf32600dbf8654365826600189bb5..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
+++ /dev/null
|
||||
@@ -1,181 +0,0 @@
|
||||
@@ -1,182 +0,0 @@
|
||||
-package co.aikar.timings;
|
||||
-
|
||||
-import com.google.common.collect.MapMaker;
|
||||
@@ -58,8 +58,9 @@ index 112029cb275d45dced60807820f1bfe9f394496d..00000000000000000000000000000000
|
||||
-
|
||||
- public static final Timing antiXrayUpdateTimer = Timings.ofSafe("anti-xray - update");
|
||||
- public static final Timing antiXrayObfuscateTimer = Timings.ofSafe("anti-xray - obfuscate");
|
||||
- public static final Timing distanceManagerTick = Timings.ofSafe("Distance Manager Tick"); // Paper - add timings for distance manager
|
||||
- public static final Timing scoreboardScoreSearch = Timings.ofSafe("Scoreboard score search"); // Paper - add timings for scoreboard search
|
||||
- public static final Timing distanceManagerTick = Timings.ofSafe("Distance Manager Tick"); // Paper - add timings for distance manager
|
||||
-
|
||||
-
|
||||
- public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks");
|
||||
-
|
||||
@@ -193,10 +194,10 @@ index 112029cb275d45dced60807820f1bfe9f394496d..00000000000000000000000000000000
|
||||
-}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
deleted file mode 100644
|
||||
index 45897b81a822b9523c16658ca46a507729f8d0d3..0000000000000000000000000000000000000000
|
||||
index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ /dev/null
|
||||
@@ -1,391 +0,0 @@
|
||||
@@ -1,390 +0,0 @@
|
||||
-/*
|
||||
- * This file is licensed under the MIT License (MIT).
|
||||
- *
|
||||
@@ -441,8 +442,7 @@ index 45897b81a822b9523c16658ca46a507729f8d0d3..00000000000000000000000000000000
|
||||
- parent.put("config", createObject(
|
||||
- pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
||||
- pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
||||
- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Leaves - add config to timings report
|
||||
- pair("leaves", mapAsJSON(Bukkit.spigot().getLeavesConfig(), null)) // Leaves - add config to timings report
|
||||
- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null))
|
||||
- ));
|
||||
-
|
||||
- new TimingsExport(listeners, parent, history).start();
|
||||
@@ -735,7 +735,7 @@ index 22687667ec69a954261e55e59261286ac1b8b8cd..00000000000000000000000000000000
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
||||
index f2659e1973e7ef5c5b64ba0bf3b27e5da1f53905..b9a45dfd024c966ac93eaa15a42f4e2c5338829f 100644
|
||||
index abd0217cf0bff183c8e262edc173a53403797c1a..8e52ebe8d12f5da3d877b0e4ff3723229fb47db1 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
||||
@@ -1315,9 +1315,7 @@ public final class ChunkHolderManager {
|
||||
@@ -749,7 +749,7 @@ index f2659e1973e7ef5c5b64ba0bf3b27e5da1f53905..b9a45dfd024c966ac93eaa15a42f4e2c
|
||||
|
||||
private static final ThreadLocal<List<ChunkProgressionTask>> CURRENT_TICKET_UPDATE_SCHEDULING = new ThreadLocal<>();
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
index 51304c5cf4b0ac7646693ef97ef4a3847d3342b5..546a3a551f8b6e786e6644bb91e49905d744088f 100644
|
||||
index b66a7d4aab887309579154815a0d4abf9de506b0..e4d3f280b35d977f28233b1db1dc855cb252e827 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
@@ -1779,19 +1779,17 @@ public final class NewChunkHolder {
|
||||
@@ -784,7 +784,7 @@ index 51304c5cf4b0ac7646693ef97ef4a3847d3342b5..546a3a551f8b6e786e6644bb91e49905
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index b58bb019dd0fc2c5e19fc5122219e689456f6373..ba7cb3d9a059f80ba746705e68b17b3021ad0cd5 100644
|
||||
index 97a9ce438afc9094dca4a44cb25b37d5f88dcf43..330413408d8e3c69ca6f0725f810de2f4b00824c 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 @@
|
||||
@@ -844,10 +844,10 @@ index dab211c458311869c61779305580a1c7da830f71..193a527c8ebd3b8772820883046de7e9
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandFunction.java b/src/main/java/net/minecraft/commands/CommandFunction.java
|
||||
index 8273ee1c5e513f02c9743ee38c9b7cf700e2ecad..3ceeddf4c2898172d24db9ee1bab8d6b17e36128 100644
|
||||
index 956cddf5d975b91619316b9b6779cf51575cfc0a..0e460de37ac2ae8accbd0d3da73faac6cd7df8e0 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandFunction.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandFunction.java
|
||||
@@ -16,15 +16,6 @@ import net.minecraft.server.ServerFunctionManager;
|
||||
@@ -32,15 +32,6 @@ import net.minecraft.server.ServerFunctionManager;
|
||||
public class CommandFunction {
|
||||
private final CommandFunction.Entry[] entries;
|
||||
final ResourceLocation id;
|
||||
@@ -864,21 +864,21 @@ index 8273ee1c5e513f02c9743ee38c9b7cf700e2ecad..3ceeddf4c2898172d24db9ee1bab8d6b
|
||||
public CommandFunction(ResourceLocation id, CommandFunction.Entry[] elements) {
|
||||
this.id = id;
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
index 9c7fb1b7c2ff458e72bdcfa80c49252cd78e7d14..e5622ec12fc930f1f17b599c486366cf7f7a8d26 100644
|
||||
index 9a49f5271ec1d9de17632bfffe8309cb1ba0d8b1..8055ebf912ea595b6c70c6e6fcda14f3b2516077 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
@@ -46,8 +46,7 @@ public class PacketUtils {
|
||||
@@ -48,8 +48,7 @@ public class PacketUtils {
|
||||
try { // Paper - detailed watchdog information
|
||||
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (listener.isAcceptingMessages()) {
|
||||
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (listener.shouldHandleMessage(packet)) {
|
||||
- co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
|
||||
- try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
|
||||
+ try {
|
||||
packet.handle(listener);
|
||||
// Leaves start - update suppression crash fix
|
||||
} catch (top.leavesmc.leaves.util.UpdateSuppressionException exception) {
|
||||
} 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 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c76a72c7ef 100644
|
||||
index 2a473825144f69968635d8894f1499af1c39481a..d75338a60cc830dde5f505b83e9f43856e0204be 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -3,9 +3,6 @@ package net.minecraft.server;
|
||||
@@ -899,7 +899,7 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
||||
import net.minecraft.server.network.ServerConnectionListener;
|
||||
@@ -110,7 +106,6 @@ import net.minecraft.util.NativeModuleLister;
|
||||
@@ -109,7 +105,6 @@ import net.minecraft.util.NativeModuleLister;
|
||||
import net.minecraft.util.ProgressListener;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.SignatureValidator;
|
||||
@@ -907,39 +907,24 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
import net.minecraft.util.datafix.DataFixers;
|
||||
import net.minecraft.util.profiling.EmptyProfileResults;
|
||||
import net.minecraft.util.profiling.ProfileResults;
|
||||
@@ -127,7 +122,6 @@ import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
|
||||
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.RandomSequences;
|
||||
-import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.ai.village.VillageSiege;
|
||||
import net.minecraft.world.entity.npc.CatSpawner;
|
||||
@@ -185,15 +179,9 @@ import net.minecraft.world.level.validation.ContentValidationException;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.bukkit.Bukkit;
|
||||
-import org.bukkit.craftbukkit.CraftServer;
|
||||
-import org.bukkit.craftbukkit.Main;
|
||||
-import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
-import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
||||
-import org.bukkit.event.player.AsyncPlayerChatPreviewEvent;
|
||||
@@ -188,8 +183,6 @@ import org.bukkit.craftbukkit.Main;
|
||||
import org.bukkit.event.server.ServerLoadEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-import co.aikar.timings.MinecraftTimings; // Paper
|
||||
import top.leavesmc.leaves.util.TickStatus; // Leaves - tick command
|
||||
-
|
||||
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable {
|
||||
|
||||
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable {
|
||||
@@ -942,7 +930,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private static MinecraftServer SERVER; // Paper
|
||||
@@ -924,7 +917,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
|
||||
- MinecraftTimings.stopServer(); // Paper
|
||||
top.leavesmc.leaves.bot.ServerBot.saveOrRemoveAllBot(); // Leaves - save or remove bot
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
@@ -1413,15 +1400,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.server.disablePlugins();
|
||||
@@ -1363,15 +1355,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public void onServerExit() {}
|
||||
|
||||
public void tickServer(BooleanSupplier shouldKeepTicking) {
|
||||
@@ -957,7 +942,7 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
// Paper end
|
||||
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
|
||||
|
||||
@@ -1456,9 +1442,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1406,9 +1397,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end
|
||||
io.papermc.paper.util.CachedLists.reset(); // Paper
|
||||
// Paper start - move executeAll() into full server tick timing
|
||||
@@ -968,25 +953,25 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
// Paper end
|
||||
// Paper start
|
||||
long endTime = System.nanoTime();
|
||||
@@ -1479,7 +1463,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.frameTimer.logFrameDuration(k - i);
|
||||
@@ -1429,7 +1418,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.logTickTime(k - i);
|
||||
this.profiler.pop();
|
||||
org.spigotmc.WatchdogThread.tick(); // Spigot
|
||||
- co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
|
||||
}
|
||||
|
||||
private ServerStatus buildServerStatus() {
|
||||
@@ -1511,9 +1494,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
public void tickChildren(BooleanSupplier shouldKeepTicking) {
|
||||
protected void logTickTime(long nanos) {}
|
||||
@@ -1466,9 +1454,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
|
||||
entityplayer.connection.suspendFlushing();
|
||||
});
|
||||
- MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
|
||||
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
||||
- MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
|
||||
// Paper start - Folia scheduler API
|
||||
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
||||
getAllLevels().forEach(level -> {
|
||||
@@ -1530,21 +1511,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1485,21 +1471,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end - Folia scheduler API
|
||||
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||
this.profiler.push("commandFunctions");
|
||||
@@ -1008,7 +993,7 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
// 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()) {
|
||||
@@ -1564,7 +1540,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1519,7 +1500,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
@@ -1016,15 +1001,14 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
|
||||
this.isIteratingOverLevels = true; // Paper
|
||||
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
|
||||
@@ -1588,7 +1563,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1544,14 +1524,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.push("tick");
|
||||
|
||||
try {
|
||||
- worldserver.timings.doTick.startTiming(); // Spigot
|
||||
// Leaves start
|
||||
try {
|
||||
worldserver.tick(shouldKeepTicking);
|
||||
@@ -1601,7 +1575,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.tick(shouldKeepTicking);
|
||||
// Paper start
|
||||
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
|
||||
regionManager.recalculateRegions();
|
||||
}
|
||||
// Paper end
|
||||
@@ -1032,7 +1016,7 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
} catch (Throwable throwable) {
|
||||
// Spigot Start
|
||||
CrashReport crashreport;
|
||||
@@ -1624,13 +1597,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1574,24 +1552,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.isIteratingOverLevels = false; // Paper
|
||||
|
||||
this.profiler.popPush("connection");
|
||||
@@ -1046,9 +1030,8 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
GameTestTicker.SINGLETON.tick();
|
||||
}
|
||||
@@ -1642,11 +1611,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
top.leavesmc.leaves.util.BreakBedrockList.endTick(); // Leaves - break bedrock list
|
||||
top.leavesmc.leaves.protocol.bladeren.MsptSyncProtocol.tick(this); // Leaves - mspt sync
|
||||
|
||||
this.profiler.popPush("server gui refresh");
|
||||
|
||||
- MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
||||
for (int i = 0; i < this.tickables.size(); ++i) {
|
||||
@@ -1056,9 +1039,9 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
}
|
||||
- MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
|
||||
|
||||
this.profiler.pop();
|
||||
}
|
||||
@@ -2828,34 +2795,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.popPush("send chunks");
|
||||
iterator = this.playerList.getPlayers().iterator();
|
||||
@@ -2779,34 +2751,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1113,20 +1096,20 @@ index 5f61f4861254fb05f069f8e95a3e84c4109fe5c2..fba016014ffc628887dc873cfa54f8c7
|
||||
}
|
||||
// Paper end - execute chunk tasks mid tick
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
||||
index 4a610b712acfe0b1b4dcf4988bc22c6a71616050..562fb1601db7e04899d4313fe4a32f02488d87ce 100644
|
||||
index d10abd28c522612934aada8124e5bb67a9b4e9da..4a87d5d7f0bfa777ba311ac021d887847aeaf335 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
||||
@@ -89,7 +89,7 @@ public class ServerFunctionManager {
|
||||
@@ -97,7 +97,7 @@ public class ServerFunctionManager {
|
||||
} else {
|
||||
int i;
|
||||
|
||||
- try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
|
||||
+ try { // Paper
|
||||
this.context = new ServerFunctionManager.ExecutionContext(tracer);
|
||||
i = this.context.runTopCommand(function, source);
|
||||
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 f8edbc95ffe7de0341e5724ad3efe69c74e95a07..2390788d6a472d900e1cf014e4c4a6834518af21 100644
|
||||
index 81e3d3dbc74e238c76ead4a0b6efaa2ada3cc49d..6e42c5b72598aaff4a4d3c4ebb9c7bd20bc2639a 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -58,7 +58,6 @@ import org.apache.logging.log4j.Level;
|
||||
@@ -1137,7 +1120,7 @@ index f8edbc95ffe7de0341e5724ad3efe69c74e95a07..2390788d6a472d900e1cf014e4c4a683
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.craftbukkit.util.Waitable; // Paper
|
||||
import org.bukkit.event.server.RemoteServerCommandEvent;
|
||||
@@ -495,7 +494,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -485,7 +484,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
}
|
||||
|
||||
public void handleConsoleInputs() {
|
||||
@@ -1145,7 +1128,7 @@ index f8edbc95ffe7de0341e5724ad3efe69c74e95a07..2390788d6a472d900e1cf014e4c4a683
|
||||
// Paper start - use proper queue
|
||||
ConsoleInput servercommand;
|
||||
while ((servercommand = this.serverCommandQueue.poll()) != null) {
|
||||
@@ -512,7 +510,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -502,7 +500,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1153,7 +1136,7 @@ index f8edbc95ffe7de0341e5724ad3efe69c74e95a07..2390788d6a472d900e1cf014e4c4a683
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -778,21 +775,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -773,21 +770,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
// Paper start
|
||||
command.set(event.getCommand());
|
||||
@@ -1178,7 +1161,7 @@ index f8edbc95ffe7de0341e5724ad3efe69c74e95a07..2390788d6a472d900e1cf014e4c4a683
|
||||
// Paper start
|
||||
if (waitableArray[0] != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e7434ab05c90 100644
|
||||
index 0c2617574e21037d94ac56ad08b490f9bca5c5af..8bb72e567633dff5d5748b221771d16d25bf8e39 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1,13 +1,10 @@
|
||||
@@ -1208,7 +1191,7 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
@@ -35,7 +26,6 @@ import java.util.BitSet;
|
||||
@@ -34,7 +25,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -1216,7 +1199,7 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -44,7 +34,6 @@ import java.util.Set;
|
||||
@@ -43,7 +33,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
@@ -1224,23 +1207,14 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@@ -52,7 +41,6 @@ import java.util.function.Consumer;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.function.Supplier;
|
||||
-import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
@@ -66,22 +54,15 @@ import net.minecraft.nbt.CompoundTag;
|
||||
@@ -63,15 +52,14 @@ import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
-import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
|
||||
-import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
|
||||
-import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import io.papermc.paper.util.MCUtil;
|
||||
+import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
+import net.minecraft.network.protocol.game.DebugPackets;
|
||||
+import io.papermc.paper.util.MCUtil;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import net.minecraft.server.network.ServerPlayerConnection;
|
||||
-import net.minecraft.util.CsvOutput;
|
||||
@@ -1251,11 +1225,8 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
-import net.minecraft.util.thread.ProcessorMailbox;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
-import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.village.poi.PoiManager;
|
||||
import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
@@ -90,7 +71,6 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
@@ -82,7 +70,6 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGeneratorStructureState;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
@@ -1263,7 +1234,7 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
@@ -103,16 +83,13 @@ import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
@@ -95,15 +82,13 @@ import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.RandomState;
|
||||
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
||||
@@ -1273,14 +1244,14 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
-import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
+import org.apache.commons.lang3.mutable.MutableObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
|
||||
-import org.bukkit.entity.Player;
|
||||
// CraftBukkit end
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper
|
||||
@@ -642,15 +619,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
|
||||
@@ -468,15 +453,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
protected void tick(BooleanSupplier shouldKeepTicking) {
|
||||
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||
|
||||
@@ -1296,37 +1267,7 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
}
|
||||
|
||||
gameprofilerfiller.pop();
|
||||
@@ -1274,24 +1247,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
// Paper start - optimised tracker
|
||||
private final void processTrackQueue() {
|
||||
- this.level.timings.tracker1.startTiming();
|
||||
- try {
|
||||
- for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
- // update tracker entry
|
||||
- tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
|
||||
- }
|
||||
- } finally {
|
||||
- this.level.timings.tracker1.stopTiming();
|
||||
+ for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
+ // update tracker entry
|
||||
+ tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
|
||||
}
|
||||
|
||||
|
||||
- this.level.timings.tracker2.startTiming();
|
||||
- try {
|
||||
- for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
- tracker.serverEntity.sendChanges();
|
||||
- }
|
||||
- } finally {
|
||||
- this.level.timings.tracker2.stopTiming();
|
||||
+ for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
+ tracker.serverEntity.sendChanges();
|
||||
}
|
||||
}
|
||||
// Paper end - optimised tracker
|
||||
@@ -1306,7 +1269,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1090,7 +1071,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
List<ServerPlayer> list = Lists.newArrayList();
|
||||
List<ServerPlayer> list1 = this.level.players();
|
||||
ObjectIterator objectiterator = this.entityMap.values().iterator();
|
||||
@@ -1334,7 +1275,7 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
|
||||
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
|
||||
|
||||
@@ -1331,17 +1293,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1115,17 +1095,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
playerchunkmap_entitytracker.serverEntity.sendChanges();
|
||||
}
|
||||
}
|
||||
@@ -1353,10 +1294,10 @@ index 625e23b098fe65ffed839953550c0465d07fb1f8..e4571ebeb757ae7c0d2bd42821d5e743
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 126b68df7a7f9d10db7a3ffc5fa07ff19ebecf4e..93ed1e1d871f0405e764215f30e953633a9bd7bb 100644
|
||||
index 17b6925b46f8386dcfc561483693de516465ec12..950b9d4ef4a9cb0e3f2ff083d84f1ebb2c642ebd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -307,10 +307,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -295,10 +295,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
|
||||
@@ -1367,7 +1308,7 @@ index 126b68df7a7f9d10db7a3ffc5fa07ff19ebecf4e..93ed1e1d871f0405e764215f30e95363
|
||||
} // Paper
|
||||
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
return ichunkaccess1;
|
||||
@@ -459,17 +457,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -447,17 +445,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
public void save(boolean flush) {
|
||||
this.runDistanceManagerUpdates();
|
||||
@@ -1386,7 +1327,7 @@ index 126b68df7a7f9d10db7a3ffc5fa07ff19ebecf4e..93ed1e1d871f0405e764215f30e95363
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -499,22 +493,16 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -487,22 +481,16 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@Override
|
||||
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -1409,31 +1350,29 @@ index 126b68df7a7f9d10db7a3ffc5fa07ff19ebecf4e..93ed1e1d871f0405e764215f30e95363
|
||||
this.level.getProfiler().pop();
|
||||
this.clearCache();
|
||||
}
|
||||
@@ -594,7 +582,6 @@ public class ServerChunkCache extends ChunkSource {
|
||||
boolean flag2AndHasNaturalSpawn = flag2 && this.anySpawnCategoryIsSpawnedThisTick();
|
||||
if (!top.leavesmc.leaves.LeavesConfig.skipUnnecessaryMobSpawningComputations || flag2AndHasNaturalSpawn) {
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
- this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
// Paper start - per player mob spawning
|
||||
if ((this.spawnFriendlies || this.spawnEnemies) && this.chunkMap.playerMobDistanceMap != null) { // don't count mobs when animals and monsters are disabled
|
||||
@@ -625,7 +612,6 @@ public class ServerChunkCache extends ChunkSource {
|
||||
// Leaves end - optimize mob spawning
|
||||
}
|
||||
// Paper end
|
||||
- this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
||||
@@ -525,7 +513,6 @@ public class ServerChunkCache extends ChunkSource {
|
||||
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
|
||||
// this.lastSpawnState = spawnercreature_d; // Leaves - optimize mob spawning
|
||||
gameprofilerfiller.popPush("filteringLoadedChunks");
|
||||
@@ -633,7 +619,6 @@ public class ServerChunkCache extends ChunkSource {
|
||||
spawnercreature_d = null;
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
- this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
// Paper start - per player mob spawning
|
||||
NaturalSpawner.SpawnState spawnercreature_d; // moved down
|
||||
@@ -549,13 +536,11 @@ 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 - moved down
|
||||
// Paper end
|
||||
- this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
||||
|
||||
this.lastSpawnState = spawnercreature_d;
|
||||
gameprofilerfiller.popPush("filteringLoadedChunks");
|
||||
// Paper - optimise chunk tick iteration
|
||||
// Paper - optimise chunk tick iteration
|
||||
- this.level.timings.chunkTicks.startTiming(); // Paper
|
||||
|
||||
// Paper - moved down
|
||||
// Paper - optimise chunk tick iteration
|
||||
|
||||
@@ -699,17 +684,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -661,17 +646,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
}
|
||||
// Paper end - optimise chunk tick iteration
|
||||
@@ -1444,23 +1383,24 @@ index 126b68df7a7f9d10db7a3ffc5fa07ff19ebecf4e..93ed1e1d871f0405e764215f30e95363
|
||||
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
|
||||
- } // Paper - timings
|
||||
}
|
||||
gameprofilerfiller.pop();
|
||||
// Paper start - use set of chunks requiring updates, rather than iterating every single one loaded
|
||||
|
||||
gameprofilerfiller.popPush("broadcast");
|
||||
- this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
|
||||
- // Paper - optimise chunk tick iteration
|
||||
- this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
|
||||
// Paper start - optimise chunk tick iteration
|
||||
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
|
||||
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
|
||||
this.chunkMap.needsChangeBroadcasting.clear();
|
||||
@@ -721,7 +702,6 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
|
||||
@@ -685,8 +665,6 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
}
|
||||
- this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
|
||||
// Paper end - optimise chunk tick iteration
|
||||
- this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
|
||||
- // Paper - optimise chunk tick iteration
|
||||
gameprofilerfiller.pop();
|
||||
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
|
||||
// Paper start - controlled flush for entity tracker packets
|
||||
gameprofilerfiller.pop();
|
||||
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 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fdceaa233e 100644
|
||||
index 868951dc21aff541765b1f58f08cdf3c47446d25..8d4d9af86f0d6e479607d69d6acfcc3dc04e7af9 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 @@
|
||||
@@ -1484,7 +1424,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.gameevent.GameEventDispatcher;
|
||||
@@ -168,15 +165,12 @@ import org.bukkit.Location;
|
||||
@@ -168,12 +165,10 @@ import org.bukkit.Location;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
|
||||
@@ -1496,11 +1436,8 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
-import org.bukkit.event.world.GenericGameEvent;
|
||||
import org.bukkit.event.world.TimeSkipEvent;
|
||||
// CraftBukkit end
|
||||
-import it.unimi.dsi.fastutil.ints.IntArrayList; // Paper
|
||||
import top.leavesmc.leaves.util.ArrayConstants;
|
||||
|
||||
public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -808,7 +802,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList; // Paper
|
||||
@@ -835,7 +830,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.updateSkyBrightness();
|
||||
this.tickTime();
|
||||
gameprofilerfiller.popPush("tickPending");
|
||||
@@ -1508,7 +1445,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
if (!this.isDebug()) {
|
||||
j = this.getGameTime();
|
||||
gameprofilerfiller.push("blockTicks");
|
||||
@@ -817,20 +810,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -844,20 +838,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.fluidTicks.tick(j, 65536, this::tickFluid);
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
@@ -1529,7 +1466,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
@@ -841,7 +827,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -868,7 +855,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
if (flag || this.emptyTime++ < 300) {
|
||||
gameprofilerfiller.push("entities");
|
||||
@@ -1537,7 +1474,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
if (this.dragonFight != null) {
|
||||
gameprofilerfiller.push("dragonFight");
|
||||
this.dragonFight.tick();
|
||||
@@ -849,7 +834,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -876,7 +862,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
@@ -1545,7 +1482,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
@@ -893,8 +877,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -903,8 +888,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1554,23 +1491,23 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
gameprofilerfiller.pop();
|
||||
this.tickBlockEntities();
|
||||
}
|
||||
@@ -1052,7 +1034,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1016,7 +999,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
// Paper start - optimise random block ticking
|
||||
gameprofilerfiller.popPush("randomTick");
|
||||
gameprofilerfiller.popPush("tickBlocks");
|
||||
- timings.chunkTicksBlocks.startTiming(); // Paper
|
||||
if (randomTickSpeed > 0) {
|
||||
LevelChunkSection[] sections = chunk.getSections();
|
||||
int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
||||
@@ -1086,7 +1067,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
||||
@@ -1049,7 +1031,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
// Paper end - optimise random block ticking
|
||||
|
||||
- timings.chunkTicksBlocks.stopTiming(); // Paper
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
|
||||
@@ -1348,9 +1328,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1356,9 +1337,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
currentlyTickingEntity.lazySet(entity);
|
||||
}
|
||||
// Paper end - log detailed entity tick information
|
||||
@@ -1580,7 +1517,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
/*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below
|
||||
entity.tickCount++;
|
||||
timer = entity.getType().inactiveTickTimer.startTiming(); try { // Paper - timings
|
||||
@@ -1359,11 +1337,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1367,11 +1346,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return;
|
||||
}*/ // Paper - comment out EAR 2
|
||||
// Spigot end
|
||||
@@ -1592,7 +1529,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
entity.setOldPosAndRot();
|
||||
ProfilerFiller gameprofilerfiller = this.getProfiler();
|
||||
|
||||
@@ -1373,12 +1347,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1381,12 +1356,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
if (isActive) { // Paper - EAR 2
|
||||
@@ -1605,7 +1542,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1401,8 +1373,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1409,8 +1382,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
|
||||
// Paper - EAR 2
|
||||
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
|
||||
@@ -1614,7 +1551,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
// Paper end
|
||||
passenger.setOldPosAndRot();
|
||||
++passenger.tickCount;
|
||||
@@ -1431,8 +1401,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1439,8 +1410,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
this.tickPassenger(passenger, entity2);
|
||||
}
|
||||
@@ -1623,7 +1560,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
}
|
||||
} else {
|
||||
passenger.stopRiding();
|
||||
@@ -1452,26 +1420,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1460,26 +1429,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
|
||||
}
|
||||
|
||||
@@ -1662,7 +1599,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -1485,7 +1449,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1493,7 +1458,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
if (!savingDisabled) {
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
|
||||
@@ -1670,7 +1607,7 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
if (progressListener != null) {
|
||||
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -1495,11 +1458,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1503,11 +1467,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
progressListener.progressStage(Component.translatable("menu.savingChunks"));
|
||||
}
|
||||
|
||||
@@ -1683,10 +1620,10 @@ index 4c86d1836c8b4ac9c535cf5bccd71decf996278b..9c90318d1b0dca4d58ceb705a6a377fd
|
||||
|
||||
} 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 172d8c9d8c46e242f467fd8a6c89b40e3419a8e5..9b4bdbd98ed4d2a39d5908b0ba29f85ec6d45799 100644
|
||||
index 8bd243a8d5a4be54f907af2b02e96ea833cee62f..6c704b32091b2d7db742e1a68404ba6db1f9154f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2567,7 +2567,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2388,7 +2388,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
public void handleCommand(String s) { // Paper - private -> public
|
||||
org.spigotmc.AsyncCatcher.catchOp("Command Dispatched Async: " + s); // Paper - Add async catcher
|
||||
@@ -1694,7 +1631,7 @@ index 172d8c9d8c46e242f467fd8a6c89b40e3419a8e5..9b4bdbd98ed4d2a39d5908b0ba29f85e
|
||||
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
|
||||
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
|
||||
|
||||
@@ -2577,20 +2576,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2398,20 +2397,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@@ -1717,7 +1654,7 @@ index 172d8c9d8c46e242f467fd8a6c89b40e3419a8e5..9b4bdbd98ed4d2a39d5908b0ba29f85e
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 6f609ec7a9814a44afc82aa504010519d614b796..cf4ea675119d3c1a12435a6f00309ea2023e0a71 100644
|
||||
index 48d1444fbad1c57738807d0128b94160a5a17a4d..699ad5ac3c0428c9f41626e43c16c211aec5d409 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1,6 +1,5 @@
|
||||
@@ -1727,7 +1664,7 @@ index 6f609ec7a9814a44afc82aa504010519d614b796..cf4ea675119d3c1a12435a6f00309ea2
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -1426,7 +1425,6 @@ public abstract class PlayerList {
|
||||
@@ -1211,7 +1210,6 @@ public abstract class PlayerList {
|
||||
|
||||
public void saveAll(int interval) {
|
||||
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
|
||||
@@ -1735,7 +1672,7 @@ index 6f609ec7a9814a44afc82aa504010519d614b796..cf4ea675119d3c1a12435a6f00309ea2
|
||||
int numSaved = 0;
|
||||
long now = MinecraftServer.currentTick;
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
@@ -1437,7 +1435,6 @@ public abstract class PlayerList {
|
||||
@@ -1222,7 +1220,6 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
@@ -1744,10 +1681,10 @@ index 6f609ec7a9814a44afc82aa504010519d614b796..cf4ea675119d3c1a12435a6f00309ea2
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..2d2e69c5bf7439009d7108a8e651ee30baf5734b 100644
|
||||
index 73871f456a85bda1e51f54986d0e61fb629822e8..7dbb55953ce9fb489c8a6706bc8a64fd3fe0e2a3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -326,10 +326,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
@@ -327,10 +327,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, maxTrackDistance, trackTickInterval, requiredFeatures, "custom");
|
||||
}
|
||||
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, String id) {
|
||||
@@ -1758,7 +1695,7 @@ index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..2d2e69c5bf7439009d7108a8e651ee30
|
||||
// Paper end
|
||||
this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this);
|
||||
this.factory = factory;
|
||||
@@ -684,12 +680,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
@@ -685,12 +681,6 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
return this.updateInterval;
|
||||
}
|
||||
|
||||
@@ -1772,7 +1709,7 @@ index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..2d2e69c5bf7439009d7108a8e651ee30
|
||||
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;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6d34badf1078126451f92ad3ce04494b1e30169c..7329b19fd023de20ed56e2b8d11cf9116522ac3f 100644
|
||||
index c039c77d0dd6ec1d336948ca6b5351d6fae1d8bb..3920d629a8db4f5e029bddb2da51772e328cf937 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -142,7 +142,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
@@ -1859,7 +1796,7 @@ index fcdb9bde8e1605e30dde3e580491522d4b62cdc0..b68c69a7ab71926ecf478d8daa5ec5ac
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index e126c62ecb9ca29c97a6b3ff4264adb177d352ea..04891bbab0259060af2c0ac87550b77a76ee71e4 100644
|
||||
index ea8a0961190e9aafda4fed6fecd85097c141040a..0cd2163fcca1908f4b0a1dea952afc968cf16a3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1,10 +1,7 @@
|
||||
@@ -1898,7 +1835,7 @@ index e126c62ecb9ca29c97a6b3ff4264adb177d352ea..04891bbab0259060af2c0ac87550b77a
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -92,17 +85,14 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket;
|
||||
@@ -91,17 +84,14 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDelayPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePacket;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -1914,17 +1851,17 @@ index e126c62ecb9ca29c97a6b3ff4264adb177d352ea..04891bbab0259060af2c0ac87550b77a
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
-import org.bukkit.event.world.GenericGameEvent;
|
||||
// CraftBukkit end
|
||||
import top.leavesmc.leaves.util.ArrayConstants;
|
||||
|
||||
@@ -179,7 +169,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -176,7 +166,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final top.leavesmc.leaves.LeavesConfig.WorldConfig leavesConfig; // Leaves - World Config
|
||||
- public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
private org.spigotmc.TickLimiter tileLimiter;
|
||||
@@ -367,7 +356,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -292,7 +281,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {}
|
||||
});
|
||||
// CraftBukkit end
|
||||
@@ -1932,7 +1869,7 @@ index e126c62ecb9ca29c97a6b3ff4264adb177d352ea..04891bbab0259060af2c0ac87550b77a
|
||||
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
@@ -969,15 +957,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1256,15 +1244,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
ProfilerFiller gameprofilerfiller = this.getProfiler();
|
||||
|
||||
gameprofilerfiller.push("blockEntities");
|
||||
@@ -1948,7 +1885,7 @@ index e126c62ecb9ca29c97a6b3ff4264adb177d352ea..04891bbab0259060af2c0ac87550b77a
|
||||
// Spigot start
|
||||
// Iterator iterator = this.blockEntityTickers.iterator();
|
||||
int tilesThisCycle = 0;
|
||||
@@ -1010,9 +995,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1297,9 +1282,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
this.blockEntityTickers.removeAll(toRemove);
|
||||
|
||||
@@ -1959,18 +1896,18 @@ index e126c62ecb9ca29c97a6b3ff4264adb177d352ea..04891bbab0259060af2c0ac87550b77a
|
||||
spigotConfig.currentPrimedTnt = 0; // Spigot
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 541f0e76a19fbd08cf2a2a8b4372f7de99c3e46e..c2b098b38d85dfee66441bd476b756e8f000961e 100644
|
||||
index 3cdddda9c0618e95288b81b975d499c8dd30c05f..aec5396b7dea8ba45f82f487719d42a1ab0794ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -140,7 +140,6 @@ public final class NaturalSpawner {
|
||||
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn, boolean peacefulModeSwitch) {
|
||||
// Leaves end - peaceful mode switch
|
||||
@@ -133,7 +133,6 @@ public final class NaturalSpawner {
|
||||
|
||||
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
|
||||
world.getProfiler().push("spawner");
|
||||
- world.timings.mobSpawn.startTiming(); // Spigot
|
||||
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
|
||||
int i = aenumcreaturetype.length;
|
||||
|
||||
@@ -200,7 +199,6 @@ public final class NaturalSpawner {
|
||||
@@ -186,7 +185,6 @@ public final class NaturalSpawner {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1979,10 +1916,10 @@ index 541f0e76a19fbd08cf2a2a8b4372f7de99c3e46e..c2b098b38d85dfee66441bd476b756e8
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 94fadc3814cef56d08d6ca4e932e806c1eadb4a8..648f9e53ac47a690910dac3b5ee36c049e2ee8fa 100644
|
||||
index d4cbff18adb62073a1dceb189043789620af6877..3ed0c227e1df184a84ecf1bdde9c598fabc329c7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -108,13 +108,6 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -101,13 +101,6 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
this != Blocks.STRUCTURE_BLOCK &&
|
||||
this != Blocks.JIGSAW;
|
||||
}
|
||||
@@ -2016,10 +1953,10 @@ index 370a25d2deb54f10a35ee24d9e7e92fbfde60edf..ca8a5ae1df1761588233068f9c8288d0
|
||||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
public CraftPersistentDataContainer persistentDataContainer;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 767ea67271b618d28aa77af683a1889917847e65..e34e6fa60cedb925e2cb6f3a031d4157a9633eb5 100644
|
||||
index 4abec88caab4116cfa318f7b66c6b1a8346a7401..8bb33965605ee1fdd5d37662f147dcc4a3fc4877 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -899,7 +899,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -790,7 +790,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
|
||||
|
||||
if (this.needsDecoration) {
|
||||
@@ -2027,7 +1964,7 @@ index 767ea67271b618d28aa77af683a1889917847e65..e34e6fa60cedb925e2cb6f3a031d4157
|
||||
this.needsDecoration = false;
|
||||
java.util.Random random = new java.util.Random();
|
||||
random.setSeed(this.level.getSeed());
|
||||
@@ -919,7 +918,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -810,7 +809,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||
@@ -2035,7 +1972,7 @@ index 767ea67271b618d28aa77af683a1889917847e65..e34e6fa60cedb925e2cb6f3a031d4157
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1282,7 +1280,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1168,7 +1166,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
|
||||
|
||||
gameprofilerfiller.push(this::getType);
|
||||
@@ -2043,7 +1980,7 @@ index 767ea67271b618d28aa77af683a1889917847e65..e34e6fa60cedb925e2cb6f3a031d4157
|
||||
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
||||
|
||||
if (this.blockEntity.getType().isValid(iblockdata)) {
|
||||
@@ -1303,9 +1300,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1189,9 +1186,6 @@ public class LevelChunk extends ChunkAccess {
|
||||
LevelChunk.this.removeBlockEntity(this.getPos());
|
||||
// Paper end
|
||||
// Spigot start
|
||||
@@ -2054,10 +1991,10 @@ index 767ea67271b618d28aa77af683a1889917847e65..e34e6fa60cedb925e2cb6f3a031d4157
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 6f69686d07e92ee4c82c54ccf4a93f01fc5769cf..0ff5f39589c33a885f18fdd5d04016b02100b9c3 100644
|
||||
index cd92954cb2f622fbbfa8b0a9ec82bb15fd5af371..07b79c811727e8a26f7c34908e9b2a6eb2fbea9e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -350,8 +350,8 @@ public class Main {
|
||||
@@ -342,8 +342,8 @@ public class Main {
|
||||
tryPreloadClass("org.jline.terminal.impl.MouseSupport");
|
||||
tryPreloadClass("org.jline.terminal.impl.MouseSupport$1");
|
||||
tryPreloadClass("org.jline.terminal.Terminal$MouseTracking");
|
||||
@@ -2068,7 +2005,7 @@ index 6f69686d07e92ee4c82c54ccf4a93f01fc5769cf..0ff5f39589c33a885f18fdd5d04016b0
|
||||
tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext");
|
||||
tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext$11");
|
||||
tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext$12");
|
||||
@@ -364,7 +364,7 @@ public class Main {
|
||||
@@ -356,7 +356,7 @@ public class Main {
|
||||
tryPreloadClass("org.bukkit.craftbukkit.scheduler.CraftScheduler$1");
|
||||
tryPreloadClass("org.bukkit.craftbukkit.scheduler.CraftScheduler$2");
|
||||
tryPreloadClass("org.bukkit.craftbukkit.scheduler.CraftScheduler$3");
|
||||
@@ -2191,7 +2128,7 @@ index 3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f..df837f9c33cf6be0f2d8a4e00138ba33
|
||||
|
||||
long getCreatedAt() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
index 500f2eb0df5a07637cd278c263e95592b0037eb6..b5da282cf7c551008d0e7657b81fbe63c817243b 100644
|
||||
index 7a2f46579352870cfbb32c343d7c68919758ffe3..c583ad62d70ab073a1dd95b11b5bd2bfe4115c27 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
@@ -115,16 +115,9 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
||||
@@ -2212,10 +2149,10 @@ index 500f2eb0df5a07637cd278c263e95592b0037eb6..b5da282cf7c551008d0e7657b81fbe63
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 719e7103f7dfdc30f1cefd24a3fa572fa0ac8b1e..5fb2645b786c3539b8503282e11cd55ee006264d 100644
|
||||
index 96f6e0554baf5915dd1f5b93f3bcfe7a13393c29..ed2783e633e28e891778213a1b8248c7f3252ea6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -227,7 +227,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -209,7 +209,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
// Paper start
|
||||
@Override
|
||||
public void reportTimings() {
|
||||
@@ -2224,7 +2161,7 @@ index 719e7103f7dfdc30f1cefd24a3fa572fa0ac8b1e..5fb2645b786c3539b8503282e11cd55e
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 0f7064f3fa0c0d1842c92535cf6ee30f153e5e6e..fe93327c08a7f96c881d600cc06a6f75fb75c0c2 100644
|
||||
index 2f9e5a1adf9d67ffe18d95f2822ca3d2288fb27a..b45343102be8fba8f3b07e387e72e018c3c23f54 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -34,7 +34,6 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
||||
@@ -2243,7 +2180,7 @@ index 0f7064f3fa0c0d1842c92535cf6ee30f153e5e6e..fe93327c08a7f96c881d600cc06a6f75
|
||||
final int miscActivationRange = world.spigotConfig.miscActivationRange;
|
||||
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
|
||||
final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
||||
@@ -220,7 +218,6 @@ public class ActivationRange
|
||||
@@ -225,7 +223,6 @@ public class ActivationRange
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
@@ -31,10 +31,10 @@ index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..044c51ebb058fc36074fd178929e3279
|
||||
public PlayerAreaMap() {
|
||||
super();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e8485fb900b25e911a858678a833852731cb2ace..a8013eea506ce6e1e0cd8a1bb2cf80db383e7318 100644
|
||||
index f20ae9153b7098980ce6c0e75fcbbb4da652661b..3011a7dee3ac2d5bcce7369fd846a11b69d99ef1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -417,6 +417,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -416,6 +416,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
private UUID originWorld;
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean collidingWithWorldBorder; // Paper
|
||||
@@ -42,7 +42,7 @@ index e8485fb900b25e911a858678a833852731cb2ace..a8013eea506ce6e1e0cd8a1bb2cf80db
|
||||
public boolean fixedPose = false; // Paper
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
@@ -2439,6 +2440,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2422,6 +2423,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
nbt.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
@@ -50,7 +50,7 @@ index e8485fb900b25e911a858678a833852731cb2ace..a8013eea506ce6e1e0cd8a1bb2cf80db
|
||||
return nbt;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2607,6 +2609,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2590,6 +2592,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
|
||||
}
|
||||
// Paper end
|
||||
@@ -62,7 +62,7 @@ index e8485fb900b25e911a858678a833852731cb2ace..a8013eea506ce6e1e0cd8a1bb2cf80db
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
@@ -4783,4 +4790,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4836,4 +4843,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
|
||||
}
|
||||
// Paper end
|
||||
@@ -289,28 +289,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..a29da205e542edb0400b8c5db76dc97cff015b8c
|
||||
--- /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.game.ClientboundCustomPayloadPacket;
|
||||
+import net.minecraft.network.protocol.game.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(channel, data));
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isNamespacePacket(@NotNull ServerboundCustomPayloadPacket packet, String namespace) {
|
||||
+ return packet.identifier.getNamespace().equals(namespace);
|
||||
+ }
|
||||
+}
|
||||
@@ -4,25 +4,11 @@ Date: Fri, 29 Oct 2021 16:52:57 +0800
|
||||
Subject: [PATCH] Leaves Server Config And Command
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..45897b81a822b9523c16658ca46a507729f8d0d3 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@@ -242,7 +242,8 @@ public class TimingsExport extends Thread {
|
||||
parent.put("config", createObject(
|
||||
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
||||
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
||||
- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null))
|
||||
+ pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Leaves - add config to timings report
|
||||
+ pair("leaves", mapAsJSON(Bukkit.spigot().getLeavesConfig(), null)) // Leaves - add config to timings report
|
||||
));
|
||||
|
||||
new TimingsExport(listeners, parent, history).start();
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6b487cf1045b8ea6cda589c7c0d5467c528bbfe8..1a1d69b3a51e03b8f1547b86b6f32243cb332df1 100644
|
||||
index d75338a60cc830dde5f505b83e9f43856e0204be..c798fbe078e14b0473b2d8bcdccc11238d28025e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1117,6 +1117,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1095,6 +1095,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
|
||||
// Paper end
|
||||
|
||||
@@ -31,10 +17,10 @@ index 6b487cf1045b8ea6cda589c7c0d5467c528bbfe8..1a1d69b3a51e03b8f1547b86b6f32243
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( recentTps, 20 );
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index b0e3ac5b92f0f45a47e2972d3baa8dd86d77de30..56ae779a44bc361f78188ec3d2bfe88daa0869aa 100644
|
||||
index 6e42c5b72598aaff4a4d3c4ebb9c7bd20bc2639a..0835a4ab23b3cb0864d9b452e1a6c8141496cd57 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -220,6 +220,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -219,6 +219,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
@@ -45,19 +31,35 @@ index b0e3ac5b92f0f45a47e2972d3baa8dd86d77de30..56ae779a44bc361f78188ec3d2bfe88d
|
||||
|
||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Leaves - down
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
|
||||
index 8c942c21dc3aebcd2fc89b5bde92c73a95bdc3e3..c3d1d7b525a6f2b708144ebe9bc28dfadcfe11fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
|
||||
@@ -15,9 +15,9 @@ public enum GossipType implements StringRepresentable {
|
||||
public static final int REPUTATION_CHANGE_PER_TRADE = 2;
|
||||
public final String id;
|
||||
public final int weight;
|
||||
- public final int max;
|
||||
+ public int max;
|
||||
public final int decayPerDay;
|
||||
- public final int decayPerTransfer;
|
||||
+ public int decayPerTransfer;
|
||||
public static final Codec<GossipType> CODEC = StringRepresentable.fromEnum(GossipType::values);
|
||||
|
||||
private GossipType(String key, int multiplier, int maxReputation, int decay, int shareDecrement) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 7d54c79f46f99f5500e9cb1f486037cafb27ee3a..b52df2e8aa1f3ff748589ccc121192e19cd4b947 100644
|
||||
index 0cd2163fcca1908f4b0a1dea952afc968cf16a3b..219f4c7368ce6b805f3f4cffd8e3f65b1590f7ed 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -176,6 +176,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -166,6 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
+ public final top.leavesmc.leaves.LeavesConfig.WorldConfig leavesConfig; // Leaves - World Config
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
@@ -276,6 +277,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
private org.spigotmc.TickLimiter tileLimiter;
|
||||
@@ -202,6 +203,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
|
||||
@@ -66,10 +68,10 @@ index 7d54c79f46f99f5500e9cb1f486037cafb27ee3a..b52df2e8aa1f3ff748589ccc121192e1
|
||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 6358daff1af6c0094f469966bc94b8b5583c4f15..df3df232bd15794ced84946dc0e95da02d579fe1 100644
|
||||
index fab14ca6965d903df220e0f7d0e73e20cfb5f2b1..c7120a96ae8277dceecb3f7953423f40ab6b8e9c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1037,6 +1037,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1039,6 +1039,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -77,7 +79,7 @@ index 6358daff1af6c0094f469966bc94b8b5583c4f15..df3df232bd15794ced84946dc0e95da0
|
||||
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))
|
||||
@@ -1052,6 +1053,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1054,6 +1055,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
@@ -85,7 +87,7 @@ index 6358daff1af6c0094f469966bc94b8b5583c4f15..df3df232bd15794ced84946dc0e95da0
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1067,6 +1069,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1069,6 +1071,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
@@ -93,7 +95,7 @@ index 6358daff1af6c0094f469966bc94b8b5583c4f15..df3df232bd15794ced84946dc0e95da0
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -2911,6 +2914,14 @@ public final class CraftServer implements Server {
|
||||
@@ -2913,6 +2916,14 @@ public final class CraftServer implements Server {
|
||||
{
|
||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||
}
|
||||
@@ -109,7 +111,7 @@ index 6358daff1af6c0094f469966bc94b8b5583c4f15..df3df232bd15794ced84946dc0e95da0
|
||||
@Override
|
||||
public void restart() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index dc13164f498eeb1d52c08f9180c44e96c0478b2e..6f69686d07e92ee4c82c54ccf4a93f01fc5769cf 100644
|
||||
index 07b79c811727e8a26f7c34908e9b2a6eb2fbea9e..cfdad68eb410690f57fd4ebfb1c270827bec5685 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -165,6 +165,14 @@ public class Main {
|
||||
@@ -129,10 +131,10 @@ index dc13164f498eeb1d52c08f9180c44e96c0478b2e..6f69686d07e92ee4c82c54ccf4a93f01
|
||||
.withRequiredArg()
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..385d8556ac9a657098be35197034ce9d518439df
|
||||
index 0000000000000000000000000000000000000000..85fb668409eb3dea6c174b88654ac7db9fa020ca
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -0,0 +1,1035 @@
|
||||
@@ -0,0 +1,1037 @@
|
||||
+package top.leavesmc.leaves;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
@@ -800,11 +802,6 @@ index 0000000000000000000000000000000000000000..385d8556ac9a657098be35197034ce9d
|
||||
+ containerPassthrough = getBoolean("settings.modify.container-passthrough", containerPassthrough);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean useFastItemMergeRaytracing = true;
|
||||
+ private static void useFastItemMergeRaytracing() {
|
||||
+ useFastItemMergeRaytracing = getBoolean("settings.performance.use-fast-item-merge-raytracing", useFastItemMergeRaytracing);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean dontRespondPingBeforeStart = true;
|
||||
+ private static void dontRespondPingBeforeStart() {
|
||||
+ dontRespondPingBeforeStart = getBoolean("settings.misc.dont-respond-ping-before-start-fully", dontRespondPingBeforeStart);
|
||||
@@ -895,11 +892,6 @@ index 0000000000000000000000000000000000000000..385d8556ac9a657098be35197034ce9d
|
||||
+ skipCloningAdvancementCriteria = getBoolean("settings.performance.skip-cloning-advancement-criteria", skipCloningAdvancementCriteria);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean skipUnnecessaryMobSpawningComputations = true;
|
||||
+ private static void skipUnnecessaryMobSpawningComputations() {
|
||||
+ skipUnnecessaryMobSpawningComputations = getBoolean("settings.performance.skip-unnecessary-mob-spawning-computations", skipUnnecessaryMobSpawningComputations);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean skipNegligiblePlanarMovementMultiplication = true;
|
||||
+ private static void skipNegligiblePlanarMovementMultiplication() {
|
||||
+ skipNegligiblePlanarMovementMultiplication = getBoolean("settings.performance.skip-negligible-planar-movement-multiplication", skipNegligiblePlanarMovementMultiplication);
|
||||
@@ -993,6 +985,18 @@ index 0000000000000000000000000000000000000000..385d8556ac9a657098be35197034ce9d
|
||||
+ forceVoidTrade = getBoolean("settings.modify.force-void-trade", forceVoidTrade);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean cceUpdateSuppression = false;
|
||||
+ private static void cceUpdateSuppression() {
|
||||
+ cceUpdateSuppression = getBoolean("settings.modify.minecraft-old.cce-update-suppression", cceUpdateSuppression);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean villagerInfiniteDiscounts = false;
|
||||
+ private static void villagerInfiniteDiscounts() {
|
||||
+ villagerInfiniteDiscounts = getBoolean("settings.modify.minecraft-old.villager-infinite-discounts", villagerInfiniteDiscounts);
|
||||
+ if (villagerInfiniteDiscounts) {
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static final class WorldConfig {
|
||||
+
|
||||
+ public final String worldName;
|
||||
519
patches/server/0006-Leaves-Protocol-Core.patch
Normal file
519
patches/server/0006-Leaves-Protocol-Core.patch
Normal file
@@ -0,0 +1,519 @@
|
||||
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
|
||||
|
||||
|
||||
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 c798fbe078e14b0473b2d8bcdccc11238d28025e..68a242f6aaa4aeebff5c2c566ac2aab538eccc87 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1562,6 +1562,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.profiler.popPush("server gui refresh");
|
||||
|
||||
+ 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 231150bac0ae61e9722c2cdfd70d6f7d254681e4..c8a20791db9e2f18c7ed02bb810190e21353203b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -116,6 +116,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.clientBrandName = brandPayload.brand();
|
||||
@@ -133,6 +134,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 699ad5ac3c0428c9f41626e43c16c211aec5d409..b58dea1fd418fa3199b403df079f87990ffdd6a8 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -327,6 +327,8 @@ public abstract class PlayerList {
|
||||
return;
|
||||
}
|
||||
|
||||
+ top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
||||
+
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
@@ -578,6 +580,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
|
||||
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 c7120a96ae8277dceecb3f7953423f40ab6b8e9c..f4f11103674860b676f11a867feadaf8c285d5c6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -470,6 +470,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) {
|
||||
@@ -1074,6 +1075,7 @@ public final class CraftServer implements Server {
|
||||
top.leavesmc.leaves.LeavesConfig.registerCommands(); // Leaves - Server Command
|
||||
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..00a259a8f462aaa591c335bcbb91aee45cefaff4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
@@ -0,0 +1,280 @@
|
||||
+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 id, FriendlyByteBuf buf) {
|
||||
+ this(id);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(@NotNull FriendlyByteBuf buf) {
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
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));
|
||||
+ }
|
||||
+}
|
||||
@@ -5,13 +5,13 @@ Subject: [PATCH] Fix gravity block duper
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a8013eea506ce6e1e0cd8a1bb2cf80db383e7318..c702d270720bb3e3d97030d2d6b7d5dfe07fd7c6 100644
|
||||
index 3011a7dee3ac2d5bcce7369fd846a11b69d99ef1..3f439b316960a734d0585dccdd331b251dfbfe14 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -532,36 +532,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
|
||||
}
|
||||
// Paper end - optimise entity tracking
|
||||
@@ -499,36 +499,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
public boolean updatingSectionStatus = false;
|
||||
// Paper end
|
||||
- // Paper start - make end portalling safe
|
||||
- public BlockPos portalBlock;
|
||||
- public ServerLevel portalWorld;
|
||||
@@ -28,7 +28,7 @@ index a8013eea506ce6e1e0cd8a1bb2cf80db383e7318..c702d270720bb3e3d97030d2d6b7d5df
|
||||
- if (this.isPassenger() || this.isVehicle() || !this.canChangeDimensions() || this.isRemoved() || !this.valid || !this.isAlive()) {
|
||||
- return;
|
||||
- }
|
||||
|
||||
-
|
||||
- ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
- ServerLevel worldserver = world.getServer().getLevel(resourcekey);
|
||||
-
|
||||
@@ -46,7 +46,7 @@ index a8013eea506ce6e1e0cd8a1bb2cf80db383e7318..c702d270720bb3e3d97030d2d6b7d5df
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -3070,7 +3042,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3116,7 +3087,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
this.processPortalCooldown();
|
||||
@@ -56,7 +56,7 @@ index a8013eea506ce6e1e0cd8a1bb2cf80db383e7318..c702d270720bb3e3d97030d2d6b7d5df
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 18eaccb39a4c81338a8cbebe3de03934913ac2a4..34c62ba8d659c3df37243c3abf4cdd705b3ddf8c 100644
|
||||
index 9105418b29c89f092378da11b14e3d324332a2ba..739eeee273632ac86c245d88e2f6eafe4f31208c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -132,11 +132,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix trading with the void
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 18aac3da3c88f33b1a71a5920a8daa27e9723913..05e7c0986f1959ec16a6f81cf905744ac3df2f6a 100644
|
||||
index 8d4d9af86f0d6e479607d69d6acfcc3dc04e7af9..32c5001be0e4be1d571d444c8fe6a88e3cd05bfe 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2752,11 +2752,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2753,11 +2753,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Spigot end
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
@@ -30,7 +30,7 @@ index 718e120c9768cf716b32d3d652f53f1dda925168..21f5c59e7e01ffefdb077d1aa9853935
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
index 6fd803f831cab088a67062ce8624b30338771d8e..b3835e66a395cb25e0d11876c87fb83f221d5f57 100644
|
||||
index 588e5ac6fc9b2d12be3bb80bc3fe50d81470c441..e79d994bb855626e740e23de564f73924a1f5098 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
@@ -45,7 +45,14 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Fakeplayer support
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1a1d69b3a51e03b8f1547b86b6f32243cb332df1..5d3dea7f058e2824a37abe78956cae25aa5cbb05 100644
|
||||
index 68a242f6aaa4aeebff5c2c566ac2aab538eccc87..8e9f72fe364bc4ad51d7a235531af09df5cdcfa9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -127,6 +127,7 @@ import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
|
||||
@@ -121,6 +121,7 @@ import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
|
||||
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.RandomSequences;
|
||||
@@ -16,7 +16,7 @@ index 1a1d69b3a51e03b8f1547b86b6f32243cb332df1..5d3dea7f058e2824a37abe78956cae25
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.ai.village.VillageSiege;
|
||||
import net.minecraft.world.entity.npc.CatSpawner;
|
||||
@@ -632,6 +633,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -617,6 +618,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -25,32 +25,24 @@ index 1a1d69b3a51e03b8f1547b86b6f32243cb332df1..5d3dea7f058e2824a37abe78956cae25
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
this.connection.acceptConnections();
|
||||
@@ -937,6 +940,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -917,6 +920,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
MinecraftServer.LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
|
||||
MinecraftTimings.stopServer(); // Paper
|
||||
+ top.leavesmc.leaves.bot.ServerBot.saveOrRemoveAllBot(); // Leaves - save or remove bot
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.disablePlugins();
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index acc49f66bf34e2507d0ee6fec0a56b11bfc68f46..7fc87841fd72fc9b5bca4fbdffd378c7b75920e1 100644
|
||||
index e38e2e5a7ddba9c140f362021b6be0b0974f7cd1..870a9c94885c983cd7a557b76cb4dbace6564b8a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -44,6 +44,7 @@ import net.minecraft.server.players.PlayerList;
|
||||
import net.minecraft.util.datafix.DataFixTypes;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import org.slf4j.Logger;
|
||||
+import top.leavesmc.leaves.bot.ServerBot;
|
||||
|
||||
public class PlayerAdvancements {
|
||||
|
||||
@@ -224,6 +225,11 @@ public class PlayerAdvancements {
|
||||
@@ -222,6 +222,11 @@ public class PlayerAdvancements {
|
||||
}
|
||||
|
||||
public boolean award(Advancement advancement, String criterionName) {
|
||||
public boolean award(AdvancementHolder advancement, String criterionName) {
|
||||
+ // Leaves start - bot can't get advancement
|
||||
+ if (player instanceof ServerBot) {
|
||||
+ if (player instanceof top.leavesmc.leaves.bot.ServerBot) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Leaves end - bot can't get advancement
|
||||
@@ -58,10 +50,10 @@ index acc49f66bf34e2507d0ee6fec0a56b11bfc68f46..7fc87841fd72fc9b5bca4fbdffd378c7
|
||||
AdvancementProgress advancementprogress = this.getOrStartProgress(advancement);
|
||||
boolean flag1 = advancementprogress.isDone();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index fb6cbcc4839aef7dc4bd4a49613f892b07aab353..d9a4e3c12ba4e371c99461c7e522d896f9c89aab 100644
|
||||
index 8bb72e567633dff5d5748b221771d16d25bf8e39..e809ef00c17d2a55877799c595c6732f74f1680e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1587,6 +1587,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1298,6 +1298,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
// Paper end
|
||||
this.serverEntity.removePairing(player);
|
||||
@@ -76,10 +68,10 @@ index fb6cbcc4839aef7dc4bd4a49613f892b07aab353..d9a4e3c12ba4e371c99461c7e522d896
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f2052662c 100644
|
||||
index d4aec99cac3f83d764e21946cc904c00e084704e..ae6fe20cac39766bd1cde1adfd93072ce4a8f44c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -100,7 +100,6 @@ import net.minecraft.util.Mth;
|
||||
@@ -95,7 +95,6 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
@@ -87,7 +79,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -185,6 +184,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@@ -180,6 +179,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.MainHand;
|
||||
@@ -95,7 +87,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f
|
||||
// CraftBukkit end
|
||||
|
||||
public class ServerPlayer extends Player {
|
||||
@@ -719,15 +719,19 @@ public class ServerPlayer extends Player {
|
||||
@@ -722,15 +722,19 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
// Paper start - Configurable container update tick rate
|
||||
@@ -123,7 +115,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f
|
||||
|
||||
Entity entity = this.getCamera();
|
||||
|
||||
@@ -743,7 +747,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -746,7 +750,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +124,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f
|
||||
if (this.levitationStartPos != null) {
|
||||
CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
|
||||
}
|
||||
@@ -936,7 +940,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -939,7 +943,7 @@ public class ServerPlayer extends Player {
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.getInventory().getContainerSize());
|
||||
boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
|
||||
@@ -141,7 +133,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f
|
||||
for (ItemStack item : this.getInventory().getContents()) {
|
||||
if (!item.isEmpty() && !EnchantmentHelper.hasVanishingCurse(item)) {
|
||||
loot.add(CraftItemStack.asCraftMirror(item));
|
||||
@@ -1265,6 +1269,13 @@ public class ServerPlayer extends Player {
|
||||
@@ -1268,6 +1272,13 @@ public class ServerPlayer extends Player {
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
||||
@@ -156,7 +148,7 @@ index b382da838acc04a1c5d89064b4fa43bcdd38ae71..c63142cea44d26c6742f39b090eeba8f
|
||||
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e20a2ca23b 100644
|
||||
index b58dea1fd418fa3199b403df079f87990ffdd6a8..cc610748dd0ae033c8e48d30f1077c1f9697dac3 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -101,6 +101,7 @@ import net.minecraft.world.scores.Objective;
|
||||
@@ -167,7 +159,7 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
import org.slf4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -118,7 +119,6 @@ import org.bukkit.Location;
|
||||
@@ -110,7 +111,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
@@ -175,7 +167,7 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
@@ -127,7 +127,6 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
@@ -119,7 +119,6 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason;
|
||||
@@ -183,9 +175,9 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class PlayerList {
|
||||
@@ -342,6 +341,21 @@ public abstract class PlayerList {
|
||||
return;
|
||||
}
|
||||
@@ -329,6 +328,21 @@ public abstract class PlayerList {
|
||||
|
||||
top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
||||
|
||||
+ // Leaves start - bot support
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.fakeplayerSupport) {
|
||||
@@ -205,7 +197,7 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
@@ -985,6 +999,13 @@ public abstract class PlayerList {
|
||||
@@ -981,6 +995,13 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -219,7 +211,7 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
// CraftBukkit end
|
||||
return entityplayer1;
|
||||
}
|
||||
@@ -1095,11 +1116,16 @@ public abstract class PlayerList {
|
||||
@@ -1091,11 +1112,16 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public String[] getPlayerNamesArray() {
|
||||
@@ -237,7 +229,7 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
|
||||
return astring;
|
||||
}
|
||||
@@ -1578,4 +1604,16 @@ public abstract class PlayerList {
|
||||
@@ -1572,4 +1598,16 @@ public abstract class PlayerList {
|
||||
public boolean isAllowCheatsForAllPlayers() {
|
||||
return this.allowCheatsForAllPlayers;
|
||||
}
|
||||
@@ -255,20 +247,20 @@ index f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..175c117bb5acca0b0d43b5ce090e51e2
|
||||
+ // Leaves end - fakeplayer support
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c702d270720bb3e3d97030d2d6b7d5dfe07fd7c6..b531f8ac81f079b7814f796fa10babf24cd3b195 100644
|
||||
index 3f439b316960a734d0585dccdd331b251dfbfe14..75633a872e15d2367d7962bac97152a26ebd9f28 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1417,7 +1417,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1383,7 +1383,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return offsetFactor;
|
||||
}
|
||||
|
||||
- private Vec3 collide(Vec3 movement) {
|
||||
+ public Vec3 collide(Vec3 movement) { // Leaves - private -> public
|
||||
// Paper start - optimise collisions
|
||||
// This is a copy of vanilla's except that it uses strictly AABB math
|
||||
if (movement.x == 0.0 && movement.y == 0.0 && movement.z == 0.0) {
|
||||
final boolean xZero = movement.x == 0.0;
|
||||
final boolean yZero = movement.y == 0.0;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index b8c238287e0639b578170c6fec0d4db5a1a59fe7..d57e6c88524482b4d37930d0fd2e9f7911c6d3a0 100644
|
||||
index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..d0752407684312982188abd0fa4af4f706edc3e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -61,7 +61,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -281,7 +273,7 @@ index b8c238287e0639b578170c6fec0d4db5a1a59fe7..d57e6c88524482b4d37930d0fd2e9f79
|
||||
private int timeUntilHooked;
|
||||
private float fishAngle;
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 7bba845462813615224f48322c51c7b480adcaa7..e25a5c2b7731b85303de93b8480f924cef6fe3f4 100644
|
||||
index ffd349c1b80df0f1e8c02bda23700184825170fd..bc734baa18eb12b499bca2c0fc6b8d8960b3ba26 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -406,6 +406,8 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -334,10 +326,10 @@ index dfeb3e336e06ef01f5401a362755030db942bb07..c51413bf02b3572a05f09d2f0d02493d
|
||||
if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper
|
||||
BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index df3df232bd15794ced84946dc0e95da02d579fe1..347a13b818d55de6ab9502aac61fd807d16fc094 100644
|
||||
index f4f11103674860b676f11a867feadaf8c285d5c6..8d74a6b34ae4abefaa4ad5c4387bea6236e7f97c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -260,6 +260,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||
@@ -262,6 +262,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||
import org.yaml.snakeyaml.error.MarkedYAMLException;
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
|
||||
@@ -345,7 +337,7 @@ index df3df232bd15794ced84946dc0e95da02d579fe1..347a13b818d55de6ab9502aac61fd807
|
||||
|
||||
import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
@@ -305,6 +306,7 @@ public final class CraftServer implements Server {
|
||||
@@ -307,6 +308,7 @@ public final class CraftServer implements Server {
|
||||
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
||||
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
|
||||
private final CraftPotionBrewer potionBrewer = new CraftPotionBrewer(); // Paper
|
||||
@@ -353,7 +345,7 @@ index df3df232bd15794ced84946dc0e95da02d579fe1..347a13b818d55de6ab9502aac61fd807
|
||||
|
||||
// Paper start - Folia region threading API
|
||||
private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
|
||||
@@ -3136,4 +3138,11 @@ public final class CraftServer implements Server {
|
||||
@@ -3140,4 +3142,11 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
// Paper end
|
||||
@@ -366,7 +358,7 @@ index df3df232bd15794ced84946dc0e95da02d579fe1..347a13b818d55de6ab9502aac61fd807
|
||||
+ // Leaves end - Bot API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 2dbe8b870fd39b4d22e9725912f443757ae70761..8388c2a56cbe531cf5f60a18866c85fad1e23c54 100644
|
||||
index e932cfac619c30b8c7444a9fa41e0403a6eadf6a..8818daa3e89fd5a5b0a0ea4069ccbf0f15aed9aa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -194,6 +194,8 @@ import org.bukkit.plugin.Plugin;
|
||||
@@ -378,7 +370,7 @@ index 2dbe8b870fd39b4d22e9725912f443757ae70761..8388c2a56cbe531cf5f60a18866c85fa
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
|
||||
|
||||
@@ -232,7 +234,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -231,7 +233,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
if (entity instanceof LivingEntity) {
|
||||
// Players
|
||||
if (entity instanceof net.minecraft.world.entity.player.Player) {
|
||||
@@ -393,7 +385,7 @@ index 2dbe8b870fd39b4d22e9725912f443757ae70761..8388c2a56cbe531cf5f60a18866c85fa
|
||||
}
|
||||
// Water Animals
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 385d8556ac9a657098be35197034ce9d518439df..fc2c965c15e20fcfec962330d3b3f7231db97b56 100644
|
||||
index 85fb668409eb3dea6c174b88654ac7db9fa020ca..e2b7517208edeb3b646d9c8f81bf3298ddfb7def 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -8,6 +8,9 @@ import org.bukkit.command.Command;
|
||||
@@ -1166,10 +1158,10 @@ index 0000000000000000000000000000000000000000..daaece30b2a3983f1cc9ee9a851e8f37
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/bot/ServerBot.java b/src/main/java/top/leavesmc/leaves/bot/ServerBot.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c2a19c275
|
||||
index 0000000000000000000000000000000000000000..ad84c8195ae21d1faf85a7bf7e97b8a6f6b02151
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/bot/ServerBot.java
|
||||
@@ -0,0 +1,712 @@
|
||||
@@ -0,0 +1,710 @@
|
||||
+package top.leavesmc.leaves.bot;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
@@ -1184,7 +1176,7 @@ index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c
|
||||
+import net.minecraft.network.PacketSendListener;
|
||||
+import net.minecraft.network.protocol.Packet;
|
||||
+import net.minecraft.network.protocol.PacketFlow;
|
||||
+import net.minecraft.network.protocol.game.ClientboundAddPlayerPacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket;
|
||||
@@ -1192,11 +1184,12 @@ index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c
|
||||
+import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
+import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ClientInformation;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.server.network.CommonListenerCookie;
|
||||
+import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
+import net.minecraft.server.network.ServerPlayerConnection;
|
||||
+import net.minecraft.server.players.PlayerList;
|
||||
+import net.minecraft.stats.ServerStatsCounter;
|
||||
+import net.minecraft.world.InteractionHand;
|
||||
+import net.minecraft.world.InteractionResult;
|
||||
@@ -1274,7 +1267,7 @@ index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c
|
||||
+ private static final Plugin MINECRAFT_PLUGIN = new MinecraftInternalPlugin();
|
||||
+
|
||||
+ private ServerBot(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
+ super(server, world, profile);
|
||||
+ super(server, world, profile, ClientInformation.createDefault());
|
||||
+ this.entityData.set(new EntityDataAccessor<>(16, EntityDataSerializers.INT), 0xFF);
|
||||
+ this.entityData.set(Player.DATA_PLAYER_MODE_CUSTOMISATION, (byte) -2);
|
||||
+
|
||||
@@ -1316,7 +1309,7 @@ index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c
|
||||
+ @Override
|
||||
+ public void send(@NotNull Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
+ }
|
||||
+ }, bot);
|
||||
+ }, bot, CommonListenerCookie.createInitial(profile));
|
||||
+ bot.isRealPlayer = true;
|
||||
+ bot.createState = state;
|
||||
+
|
||||
@@ -1379,7 +1372,7 @@ index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c
|
||||
+ }
|
||||
+
|
||||
+ public void sendFakeData(ServerPlayerConnection playerConnection, boolean login) {
|
||||
+ playerConnection.send(new ClientboundAddPlayerPacket(this));
|
||||
+ playerConnection.send(new ClientboundAddEntityPacket(this));
|
||||
+ if (login) {
|
||||
+ Bukkit.getScheduler().runTaskLater(MINECRAFT_PLUGIN, () -> {
|
||||
+ connection.send(new ClientboundRotateHeadPacket(this, (byte) ((getYRot() * 256f) / 360f)));
|
||||
@@ -1828,9 +1821,6 @@ index 0000000000000000000000000000000000000000..8bcffe8d307c9664133a37677900312c
|
||||
+ private String realName;
|
||||
+ private String name;
|
||||
+
|
||||
+ public BotCreateState() {
|
||||
+ }
|
||||
+
|
||||
+ public BotCreateState(Location loc, String realName, String skinName) {
|
||||
+ this.loc = loc;
|
||||
+ this.skinName = skinName;
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Make shears in dispenser can unlimited use
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
index 9b0049dfeaec9b688bf276f2ac2b18943b5696b2..8a7733f83c2ba0c73069357184d77eee57959a07 100644
|
||||
index e17090003988ad2c890d48666c2234b14d511345..f3cbb95eed1d85c96bb52e05b5274ed249298d60 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
@@ -63,7 +63,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
|
||||
BlockPos blockposition = pointer.getPos().relative((Direction) pointer.getBlockState().getValue(DispenserBlock.FACING));
|
||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||
|
||||
this.setSuccess(ShearsDispenseItemBehavior.tryShearBeehive(worldserver, blockposition) || ShearsDispenseItemBehavior.tryShearLivingEntity(worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
- if (this.isSuccess() && stack.hurt(1, worldserver.getRandom(), (ServerPlayer) null)) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add isShrink to EntityResurrectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index e11d7283662834047b2ff81a2fd25a4263792deb..d7861680dc319c22fa257e91b4ddc0caee20ef23 100644
|
||||
index 3920d629a8db4f5e029bddb2da51772e328cf937..293abc70b7a447a35835192a1f4333bbac8e88fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1577,12 +1577,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1608,12 +1608,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
|
||||
@@ -23,7 +23,7 @@ index e11d7283662834047b2ff81a2fd25a4263792deb..d7861680dc319c22fa257e91b4ddc0ca
|
||||
itemstack1.shrink(1);
|
||||
}
|
||||
if (itemstack != null && this instanceof ServerPlayer) {
|
||||
@@ -4451,3 +4451,4 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4527,3 +4527,4 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Budding Amethyst can push by piston
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index fdd9c61b7248e92dbcbec91cd6fe4c6310bba237..2af43e50cc84c7b83e69e837ab4fbaa3a51c60a6 100644
|
||||
index 3ed0c227e1df184a84ecf1bdde9c598fabc329c7..065fbac30d22ec45cd3f5b66599c8500ae5c278d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -593,6 +593,12 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -586,6 +586,12 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
@@ -38,10 +38,10 @@ index 2548244c089dff583c8c424dcaa5504caedf3f10..e53624d9f2372fceab44bd1c881a6f3c
|
||||
+ // Leaves end - budding amethyst can push by piston
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..5757457fc46aa4a785e559a140ebf0da40ef7405 100644
|
||||
index e6a4a5898ffdcb2aa2bc01371a6d7dbc06d610ce..22eae4a483b437c75082d889d4ea2904bf2093fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -1042,7 +1042,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -1090,7 +1090,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
public PushReaction getPistonPushReaction() {
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] Spectator dont get Advancement
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index 7fc87841fd72fc9b5bca4fbdffd378c7b75920e1..fd9e85dab7c511873824cac56a270ff435792292 100644
|
||||
index 870a9c94885c983cd7a557b76cb4dbace6564b8a..fbd602b5219c0eeefea36dbaca7aae10d483a152 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -43,6 +43,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -46,6 +46,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import net.minecraft.util.datafix.DataFixTypes;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
+import net.minecraft.world.level.GameType;
|
||||
import org.slf4j.Logger;
|
||||
import top.leavesmc.leaves.bot.ServerBot;
|
||||
|
||||
@@ -230,6 +231,11 @@ public class PlayerAdvancements {
|
||||
public class PlayerAdvancements {
|
||||
@@ -227,6 +228,11 @@ public class PlayerAdvancements {
|
||||
return false;
|
||||
}
|
||||
// Leaves end - bot can't get advancement
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Stick can change ArmorStand arm status
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index 8a8b9e8983be1acad66ad875c901be5bbdeabb1f..89f3466212800b5fac8a57d70fbc5a3028fbb29d 100644
|
||||
index 9b19cca3b8231b8fbda674f080922673503b1260..e3a32c8b764b4dec59c70283efc6611f469abe21 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -385,6 +385,12 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -386,6 +386,12 @@ public class ArmorStand extends LivingEntity {
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
} else {
|
||||
@@ -1,182 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sat, 13 Aug 2022 17:27:18 +0800
|
||||
Subject: [PATCH] Optimize mob spawning
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3cc6001c5a6b3ccb1af3b15660520ac6ca2b126e..8c8406269ce0795189b4f84861c5bd7520a333d2 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -312,6 +312,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
public boolean isIteratingOverLevels = false; // Paper
|
||||
|
||||
+ public top.leavesmc.leaves.util.AsyncExecutor mobSpawnExecutor = new top.leavesmc.leaves.util.AsyncExecutor("MobSpawning"); // Leaves - optimize mob spawning
|
||||
+
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 4e2c9525767136bc29366b2224a5adc5ad6485bd..9ef742ccfedf2a2fd16020f6f6741d44c522b861 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -343,6 +343,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.info("JMX monitoring enabled");
|
||||
}
|
||||
|
||||
+ // Leaves start - optimize mob spawning
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.asyncMobSpawning) {
|
||||
+ mobSpawnExecutor.start();
|
||||
+ }
|
||||
+ // Leaves end - optimize mob spawning
|
||||
return true;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 65d947df910d60f478e7a449eb161e5105e2c0c9..8cec73a7699626bddab6e4960c7173d525a89c8b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -342,7 +342,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
||||
this.regionManagers.add(this.dataRegionManager);
|
||||
// Paper end
|
||||
- this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
|
||||
+ this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? top.leavesmc.leaves.LeavesConfig.asyncMobSpawning ? new top.leavesmc.leaves.util.AsyncPlayerAreaMap(this.pooledLinkedPlayerHashSets) : new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper // Leaves - optimize mob spawning
|
||||
// Paper start - use distance map to optimise entity tracker
|
||||
this.playerEntityTrackerTrackMaps = new com.destroystokyo.paper.util.misc.PlayerAreaMap[TRACKING_RANGE_TYPES.length];
|
||||
this.entityTrackerTrackRanges = new int[TRACKING_RANGE_TYPES.length];
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index acbcdc8cb1523044b1657e03a141fae6389a3686..784c264daebedec9d0aa723297d00101d9a9caeb 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -77,6 +77,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
|
||||
|
||||
+ // Leaves start - optimize mob spawning
|
||||
+ public boolean firstRunSpawnCounts = true;
|
||||
+ public final java.util.concurrent.atomic.AtomicBoolean spawnCountsReady = new java.util.concurrent.atomic.AtomicBoolean(false);
|
||||
+ // Leaves end - optimize mob spawning
|
||||
+
|
||||
private static int getChunkCacheKey(int x, int z) {
|
||||
return x & 3 | ((z & 3) << 2);
|
||||
}
|
||||
@@ -562,28 +567,36 @@ public class ServerChunkCache extends ChunkSource {
|
||||
// Paper start - per player mob spawning
|
||||
NaturalSpawner.SpawnState spawnercreature_d; // moved down
|
||||
if ((this.spawnFriendlies || this.spawnEnemies) && this.chunkMap.playerMobDistanceMap != null) { // don't count mobs when animals and monsters are disabled
|
||||
- // re-set mob counts
|
||||
- for (ServerPlayer player : this.level.players) {
|
||||
- // Paper start - per player mob spawning backoff
|
||||
- for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
|
||||
- player.mobCounts[ii] = 0;
|
||||
-
|
||||
- int newBackoff = player.mobBackoffCounts[ii] - 1; // TODO make configurable bleed // TODO use nonlinear algorithm?
|
||||
- if (newBackoff < 0) {
|
||||
- newBackoff = 0;
|
||||
+ // Leaves start - optimize mob spawning
|
||||
+ if (!top.leavesmc.leaves.LeavesConfig.asyncMobSpawning) {
|
||||
+ // re-set mob counts
|
||||
+ for (ServerPlayer player : this.level.players) {
|
||||
+ // Paper start - per player mob spawning backoff
|
||||
+ for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
|
||||
+ player.mobCounts[ii] = 0;
|
||||
+
|
||||
+ int newBackoff = player.mobBackoffCounts[ii] - 1; // TODO make configurable bleed // TODO use nonlinear algorithm?
|
||||
+ if (newBackoff < 0) {
|
||||
+ newBackoff = 0;
|
||||
+ }
|
||||
+ player.mobBackoffCounts[ii] = newBackoff;
|
||||
}
|
||||
- player.mobBackoffCounts[ii] = newBackoff;
|
||||
+
|
||||
+ // Paper end - per player mob spawning backoff
|
||||
}
|
||||
- // Paper end - per player mob spawning backoff
|
||||
+ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true);
|
||||
}
|
||||
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true);
|
||||
+ // Leaves end - optimize mob spawning
|
||||
} else {
|
||||
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false);
|
||||
+ // Leaves start - optimize mob spawning
|
||||
+ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false);
|
||||
+ spawnCountsReady.set(true);
|
||||
+ // Leaves end - optimize mob spawning
|
||||
}
|
||||
// Paper end
|
||||
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
||||
|
||||
- this.lastSpawnState = spawnercreature_d;
|
||||
+ // this.lastSpawnState = spawnercreature_d; // Leaves - optimize mob spawning
|
||||
gameprofilerfiller.popPush("filteringLoadedChunks");
|
||||
// Paper - moved down
|
||||
this.level.timings.chunkTicks.startTiming(); // Paper
|
||||
@@ -622,9 +635,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
if ((true || this.level.isNaturalSpawningAllowed(chunkcoordintpair)) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning // Paper - the chunk is known ticking
|
||||
chunk1.incrementInhabitedTime(j);
|
||||
- if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration
|
||||
- NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
|
||||
+ // Leaves start - optimize mob spawning
|
||||
+ if (flag2 && (!top.leavesmc.leaves.LeavesConfig.asyncMobSpawning || spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration
|
||||
+ NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1);
|
||||
}
|
||||
+ // Leaves end - optimize mob spawning
|
||||
|
||||
if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - the chunk is known ticking
|
||||
this.level.tickChunk(chunk1, k);
|
||||
@@ -684,6 +699,38 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
}
|
||||
// Paper end - controlled flush for entity tracker packets
|
||||
+
|
||||
+ // Leaves start - optimize mob spawning
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.asyncMobSpawning) {
|
||||
+ for (ServerPlayer player : this.level.players) {
|
||||
+ for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
|
||||
+ player.mobCounts[ii] = 0;
|
||||
+
|
||||
+ int newBackoff = player.mobBackoffCounts[ii] - 1; // TODO make configurable bleed // TODO use nonlinear algorithm?
|
||||
+ if (newBackoff < 0) {
|
||||
+ newBackoff = 0;
|
||||
+ }
|
||||
+ player.mobBackoffCounts[ii] = newBackoff;
|
||||
+ }
|
||||
+ }
|
||||
+ if (firstRunSpawnCounts) {
|
||||
+ firstRunSpawnCounts = false;
|
||||
+ spawnCountsReady.set(true);
|
||||
+ }
|
||||
+ if (chunkMap.playerMobDistanceMap != null && spawnCountsReady.getAndSet(false)) {
|
||||
+ net.minecraft.server.MinecraftServer.getServer().mobSpawnExecutor.submit(() -> {
|
||||
+ int mapped = distanceManager.getNaturalSpawnChunkCount();
|
||||
+ io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Entity> objectiterator =
|
||||
+ level.entityTickList.entities.iterator(io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.ITERATOR_FLAG_SEE_ADDITIONS);
|
||||
+ top.leavesmc.leaves.util.IterableWrapper<Entity> wrappedIterator =
|
||||
+ new top.leavesmc.leaves.util.IterableWrapper<Entity>(objectiterator);
|
||||
+ lastSpawnState = NaturalSpawner.createState(mapped, wrappedIterator, this::getFullChunk, null, true);
|
||||
+ objectiterator.finishedIterating();
|
||||
+ spawnCountsReady.set(true);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaves end - optimize mob spawning
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
index 4cdfc433df67afcd455422e9baf56f167dd712ae..a6e0f5dab21d806e0c7744b2a337cded2739d870 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
@@ -8,7 +8,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public class EntityTickList {
|
||||
- private final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking?
|
||||
+ public final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking? // Leaves - private -> public
|
||||
|
||||
private void ensureActiveIsNotIterated() {
|
||||
// Paper - replace with better logic, do not delay removals
|
||||
@@ -41,10 +41,10 @@ index 72a8aa676836fcb3b4578689d16af65e18f55bbe..47a06936a4727c6209a7ad0fb8fb1099
|
||||
public MessageSignature get(String argumentName) {
|
||||
for(ArgumentSignatures.Entry entry : this.entries) {
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 9938bb90bef84cf784f9a1ceb02a1a45aa8b48a1..923b77b9793369395f5f138ef03d8b489957caa1 100644
|
||||
index 2e395962b555bef0ce1a98e1d768e7738f011535..62558d52fc55e8a7430c2a30783223d11dc0792c 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -67,6 +67,7 @@ import net.minecraft.nbt.NbtIo;
|
||||
@@ -65,6 +65,7 @@ import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
@@ -52,7 +52,7 @@ index 9938bb90bef84cf784f9a1ceb02a1a45aa8b48a1..923b77b9793369395f5f138ef03d8b48
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Crypt;
|
||||
@@ -154,6 +155,16 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -137,6 +138,16 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
public <T> void writeJsonWithCodec(Codec<T> codec, T value) {
|
||||
DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value);
|
||||
|
||||
@@ -110,10 +110,10 @@ index 9d6db4a378036559efab91c8b7dcf2a6b0c2cce6..2c349dc502ce275a8215766933f4855f
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 56ae779a44bc361f78188ec3d2bfe88daa0869aa..4e2c9525767136bc29366b2224a5adc5ad6485bd 100644
|
||||
index 0835a4ab23b3cb0864d9b452e1a6c8141496cd57..7362fb735a7eb006ebe63190992ae098c4efb2f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -643,7 +643,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -640,7 +640,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
public boolean enforceSecureProfile() {
|
||||
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
|
||||
|
||||
@@ -121,19 +121,19 @@ index 56ae779a44bc361f78188ec3d2bfe88daa0869aa..4e2c9525767136bc29366b2224a5adc5
|
||||
+ return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.profileKeySignatureValidator() != null && !top.leavesmc.leaves.LeavesConfig.noChatSign; // Leaves - No Secure profile;
|
||||
}
|
||||
|
||||
protected boolean convertOldUsers() {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index ab58827001b3b42e44d7f701c390480fed1fa1f1..f728382ac721d2204d2cac18f21a43212a08ab7c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2200,10 +2200,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index c8a20791db9e2f18c7ed02bb810190e21353203b..40c817044a1934194490c3863a570e621877d53c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -234,10 +234,27 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet) {
|
||||
+ // Leaves start - no ClientboundPlayerChatHeaderPacket and rebuild ClientboundPlayerChatPacket
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.noChatSign) {
|
||||
+ if (packet instanceof ClientboundPlayerChatPacket chat) {
|
||||
+ packet = new ClientboundSystemChatPacket(chat.chatType().resolve(this.player.level().registryAccess())
|
||||
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat) {
|
||||
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(chat.chatType().resolve(this.player.level().registryAccess())
|
||||
+ .get().decorate(chat.unsignedContent() != null ? chat.unsignedContent()
|
||||
+ : Component.literal(chat.body().content())), false);
|
||||
+ }
|
||||
@@ -145,7 +145,7 @@ index ab58827001b3b42e44d7f701c390480fed1fa1f1..f728382ac721d2204d2cac18f21a4321
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||
+ // Leaves start - no ClientboundPlayerChatHeaderPacket and rebuild ClientboundPlayerChatPacket
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.noChatSign) {
|
||||
+ if (packet instanceof ClientboundPlayerChatPacket chat && callbacks != null) {
|
||||
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && callbacks != null) {
|
||||
+ this.send(chat);
|
||||
+ return;
|
||||
+ }
|
||||
@@ -155,10 +155,10 @@ index ab58827001b3b42e44d7f701c390480fed1fa1f1..f728382ac721d2204d2cac18f21a4321
|
||||
if (packet == null || this.processedDisconnect) { // Spigot
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 175c117bb5acca0b0d43b5ce090e51e20a2ca23b..0e095d71cbe46acbf076623a0e1af6963610e5c4 100644
|
||||
index cc610748dd0ae033c8e48d30f1077c1f9697dac3..59b2124ea6d9b489488ace4fcd4529420a8eca99 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1465,7 +1465,7 @@ public abstract class PlayerList {
|
||||
@@ -1459,7 +1459,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||
20
patches/server/0019-Optimize-mob-spawning.patch
Normal file
20
patches/server/0019-Optimize-mob-spawning.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sat, 13 Aug 2022 17:27:18 +0800
|
||||
Subject: [PATCH] Optimize mob spawning
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index e2b7517208edeb3b646d9c8f81bf3298ddfb7def..078822107c2086f97499d386766a1ae972b3eb77 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -255,7 +255,7 @@ public final class LeavesConfig {
|
||||
noChatSign = getBoolean("settings.misc.no-chat-sign", noChatSign);
|
||||
}
|
||||
|
||||
- public static boolean asyncMobSpawning = false;
|
||||
+ public static boolean asyncMobSpawning = false; // void
|
||||
private static boolean asyncMobSpawningLock = false;
|
||||
private static void asyncMobSpawning() {
|
||||
if (!asyncMobSpawningLock) {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Dont send useless entity packets
|
||||
This patch is Powered by Purpur(https://github.com/PurpurMC/Purpur)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 6670e657e08e130f7e0368f418379fd1ece00cdf..bd520b2f298ac7e9210532e7e7aca4766a21ecff 100644
|
||||
index 892a334d1b1c0784ed6838d1aa066403998b9a9f..c5bec163e5b9a389e278d7074faa006a5eeb8149 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -194,6 +194,7 @@ public class ServerEntity {
|
||||
@@ -191,6 +191,7 @@ public class ServerEntity {
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ index 6670e657e08e130f7e0368f418379fd1ece00cdf..bd520b2f298ac7e9210532e7e7aca476
|
||||
} else {
|
||||
this.wasOnGround = this.entity.onGround();
|
||||
this.teleportDelay = 0;
|
||||
@@ -201,6 +202,11 @@ public class ServerEntity {
|
||||
@@ -198,6 +199,11 @@ public class ServerEntity {
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ index 6670e657e08e130f7e0368f418379fd1ece00cdf..bd520b2f298ac7e9210532e7e7aca476
|
||||
}
|
||||
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
@@ -273,6 +279,21 @@ public class ServerEntity {
|
||||
@@ -270,6 +276,21 @@ public class ServerEntity {
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Multithreaded Tracker
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 904d1fe0bf325c09b67e43bdaa81c902d57b8e26..f9ef4451b43d6e37d91edfcbeb5d1fbf564e596c 100644
|
||||
index 078822107c2086f97499d386766a1ae972b3eb77..36cc925f72c850ee83a763e81c2662e67edaab71 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -269,7 +269,7 @@ public final class LeavesConfig {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Optimize entity coordinate key
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index c69088a2ec374b2d236fec61e267f42afa2967b1..da7ee46893d99a4abe6c3089c6651b8e1a453e82 100644
|
||||
index d02546b18cb689724887b4e85e8d32a18828a4ad..624028022d205b55be4bd668d1015425174eca7e 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -215,7 +215,13 @@ public final class MCUtil {
|
||||
@@ -213,7 +213,13 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static long getCoordinateKey(final Entity entity) {
|
||||
@@ -25,10 +25,10 @@ index c69088a2ec374b2d236fec61e267f42afa2967b1..da7ee46893d99a4abe6c3089c6651b8e
|
||||
|
||||
public static long getCoordinateKey(final ChunkPos pair) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 82cf724352396f949ebc60da9146514672b76e45..6200217b8cb13bc4c6b7b7b194215c7766626c61 100644
|
||||
index 75633a872e15d2367d7962bac97152a26ebd9f28..005b4f012b308edf2016cb92b8b7ca526b628c4b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -306,7 +306,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -305,7 +305,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public double yo;
|
||||
public double zo;
|
||||
private Vec3 position;
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Optimize suffocation
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d7861680dc319c22fa257e91b4ddc0caee20ef23..e443253ee52892cc234bda9d930dda445d03b051 100644
|
||||
index 293abc70b7a447a35835192a1f4333bbac8e88fc..79ac2dc637450ae960013fe6e79e792deaf5a5ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -414,7 +414,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -413,7 +413,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -18,7 +18,7 @@ index d7861680dc319c22fa257e91b4ddc0caee20ef23..e443253ee52892cc234bda9d930dda44
|
||||
this.hurt(this.damageSources().inWall(), 1.0F);
|
||||
} else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) {
|
||||
double d0 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1369,6 +1369,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1400,6 +1400,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.getHealth() <= 0.0F;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Move ThreadUnsafeRandom Initialization
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 05e7c0986f1959ec16a6f81cf905744ac3df2f6a..b6ad64f0bed9459aa2ecb4f80b71653691a8359f 100644
|
||||
index 32c5001be0e4be1d571d444c8fe6a88e3cd05bfe..2db76acc04cf784efde422c000bccd766abeff27 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -934,7 +934,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -945,7 +945,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
// Paper start - optimise random block ticking
|
||||
private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos();
|
||||
@@ -19,10 +19,10 @@ index 05e7c0986f1959ec16a6f81cf905744ac3df2f6a..b6ad64f0bed9459aa2ecb4f80b716536
|
||||
|
||||
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index c20e4157daec6803dce3ad2e36c38b6808496128..35ac4ab346e7d25ce00c35490836f05a9b962b81 100644
|
||||
index 219f4c7368ce6b805f3f4cffd8e3f65b1590f7ed..b84bb2d3fa53ca66df2e0978596064f1df8e09dd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -274,6 +274,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -200,6 +200,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
@@ -31,8 +31,8 @@ index c20e4157daec6803dce3ad2e36c38b6808496128..35ac4ab346e7d25ce00c35490836f05a
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
|
||||
@@ -364,6 +366,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
@@ -293,6 +295,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end - optimise collisions
|
||||
}
|
||||
|
||||
+ // Leaves start - thread unsafe random get
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Optimize random calls in chunk ticking
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 784c264daebedec9d0aa723297d00101d9a9caeb..5942626173e68d80a2e93d7221f2f470f07f022b 100644
|
||||
index 950b9d4ef4a9cb0e3f2ff083d84f1ebb2c642ebd..45cac95d44509ec8fcc46177a47c307398d756b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -558,6 +558,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -509,6 +509,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||
|
||||
gameprofilerfiller.push("pollingChunks");
|
||||
@@ -22,10 +22,10 @@ index 784c264daebedec9d0aa723297d00101d9a9caeb..5942626173e68d80a2e93d7221f2f470
|
||||
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index b6ad64f0bed9459aa2ecb4f80b71653691a8359f..bf05f321373c9cb5d42fd6cace010a75dc98b90a 100644
|
||||
index 2db76acc04cf784efde422c000bccd766abeff27..7d1188efd22cef02acfae2354de55e71fdad6fe4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -937,6 +937,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -948,6 +948,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong()); // Leaves - moved to super
|
||||
// Paper end
|
||||
|
||||
@@ -39,31 +39,22 @@ index b6ad64f0bed9459aa2ecb4f80b71653691a8359f..bf05f321373c9cb5d42fd6cace010a75
|
||||
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
|
||||
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||
boolean flag = this.isRaining();
|
||||
@@ -947,7 +954,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -958,7 +965,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
gameprofilerfiller.push("thunder");
|
||||
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
|
||||
|
||||
- if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder
|
||||
+ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && (top.leavesmc.leaves.LeavesConfig.optimizeChunkTicking ? chunk.shouldDoLightning(this.random) : this.random.nextInt(this.spigotConfig.thunderChance) == 0)) { // Spigot // Paper - disable thunder // Leaves - replace random with shouldDoLightning
|
||||
blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
|
||||
@@ -978,7 +985,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
- if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
|
||||
+ if (!this.paperConfig().environment.disableIceAndSnow && (top.leavesmc.leaves.LeavesConfig.optimizeChunkTicking ? (this.currentIceAndSnowTick++ & 15) == 0 : this.random.nextInt(16) == 0)) { // Paper - Disable ice and snow // Paper - optimise random ticking // Leaves - optimize further random ticking
|
||||
// Paper start - optimise chunk ticking
|
||||
this.getRandomBlockPosition(j, 0, k, 15, blockposition);
|
||||
int normalY = chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15) + 1;
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 4ff0d2fc9fd76e92e64abd69f2c9e299aa08ac32..cc224af0139a6e3adefd22cbfa0cd519735b7191 100644
|
||||
index 8bb33965605ee1fdd5d37662f147dcc4a3fc4877..7d9d09b0f84acb3a4692c58e5b6876a2e1875ba7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -85,6 +85,18 @@ public class LevelChunk extends ChunkAccess {
|
||||
private final LevelChunkTicks<Block> blockTicks;
|
||||
@@ -86,6 +86,18 @@ public class LevelChunk extends ChunkAccess {
|
||||
private final LevelChunkTicks<Fluid> fluidTicks;
|
||||
public volatile FullChunkStatus chunkStatus = FullChunkStatus.INACCESSIBLE; // Paper - rewrite chunk system
|
||||
|
||||
+ // Leaves start - instead of using a random every time the chunk is ticked, define when lightning strikes preemptively
|
||||
+ private int lightningTick;
|
||||
@@ -80,7 +71,7 @@ index 4ff0d2fc9fd76e92e64abd69f2c9e299aa08ac32..cc224af0139a6e3adefd22cbfa0cd519
|
||||
public LevelChunk(Level world, ChunkPos pos) {
|
||||
this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null);
|
||||
}
|
||||
@@ -112,6 +124,12 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -113,6 +125,12 @@ public class LevelChunk extends ChunkAccess {
|
||||
this.postLoad = entityLoader;
|
||||
this.blockTicks = blockTickScheduler;
|
||||
this.fluidTicks = fluidTickScheduler;
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Early return optimization for target finding
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
index 58422f00c7d64dbd1cf6d7211c9838875cbe7778..b39072cf38795e8f0d73f83b10d29fe19c507c54 100644
|
||||
index c157309ac78e7af084d3acb6e8b2bcd469a39d5e..a7a1c25208031d9540794d2e068620bd8043b4ce 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
@@ -75,9 +75,17 @@ public class TargetingConditions {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Use thread unsafe random for mob spawning
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index e85ddf92b4f6f044e2b5834a172f37d78e702ef3..9af07ebff3a510a4e3fc71ab4d08897db02b7299 100644
|
||||
index aec5396b7dea8ba45f82f487719d42a1ab0794ec..5eded2322d604c3a304194926a740818631f36de 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -433,12 +433,21 @@ public final class NaturalSpawner {
|
||||
@@ -429,12 +429,21 @@ public final class NaturalSpawner {
|
||||
|
||||
private static BlockPos getRandomPosWithin(Level world, LevelChunk chunk) {
|
||||
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Config to disable method profiler
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 4870438bcb8d8c158a8bb6251782148779430955..745ab8b97e6bf3e9a1621558883711eab25f8725 100644
|
||||
index 8e9f72fe364bc4ad51d7a235531af09df5cdcfa9..3f4b4d905ff440eaf4a66b10ad85933c0b07dc58 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2278,6 +2278,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2251,6 +2251,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
public ProfilerFiller getProfiler() {
|
||||
@@ -22,10 +22,10 @@ index 4870438bcb8d8c158a8bb6251782148779430955..745ab8b97e6bf3e9a1621558883711ea
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 35ac4ab346e7d25ce00c35490836f05a9b962b81..405283f793cdf108a1895e3b21f6ec9992a62ee4 100644
|
||||
index b84bb2d3fa53ca66df2e0978596064f1df8e09dd..35063fa42e9ec1d963d94b2c714b82ac30d1f67b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1474,6 +1474,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1772,6 +1772,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
public ProfilerFiller getProfiler() {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Throttle goal selector during inactive ticking
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..e65ce75e2d44843afa6c4a033885a55dcb43c635 100644
|
||||
index d28c477171c1b6888a45175075017d960464b5cd..48889d29c94dc09030d5c9825d3b0a637e660b0e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -218,11 +218,13 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -220,11 +220,13 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
return this.lookControl;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Reduce entity allocations
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 09772cb41893026685eda1602bcc1bbbec6b6bc8..e1184e4da424d8ed6e3bfece01e4f5260ae03213 100644
|
||||
index 005b4f012b308edf2016cb92b8b7ca526b628c4b..659d0c973b819b93010825ce2def5db4b12d3dff 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -435,6 +435,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -434,6 +434,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.originWorld;
|
||||
}
|
||||
// Paper end
|
||||
@@ -19,7 +19,7 @@ index 09772cb41893026685eda1602bcc1bbbec6b6bc8..e1184e4da424d8ed6e3bfece01e4f526
|
||||
return this.yRot;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..53c094c8a674b2842009727569e7e1f6ac6510b7 100644
|
||||
index 7204b973c3ad9239e82355513f6d538107102e48..4ee998ae0406d20e3106b7e51911d86313a2e2f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
@@ -23,9 +23,11 @@ public class AttributeMap {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Remove lambda from ticking guard
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index bf05f321373c9cb5d42fd6cace010a75dc98b90a..c47df8d18be8ac7d32a16e6662dbbd850efc8e8a 100644
|
||||
index 7d1188efd22cef02acfae2354de55e71fdad6fe4..54d380e5c454891c76f31112c94e8bb87a4bee3b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -869,7 +869,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -882,7 +882,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
||||
gameprofilerfiller.push("tick");
|
||||
@@ -1,69 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Wed, 17 Aug 2022 11:13:30 +0800
|
||||
Subject: [PATCH] Remove streams from getting nearby players
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e1184e4da424d8ed6e3bfece01e4f5260ae03213..9ae4420296e0e97614ced6a635dc3021c2f23858 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -511,25 +511,50 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.isLegacyTrackingEntity = isLegacyTrackingEntity;
|
||||
}
|
||||
|
||||
+ // Leaves start - better metond
|
||||
+ private org.spigotmc.TrackingRange.TrackingRangeType getFurthestEntity(Entity entity, net.minecraft.server.level.ChunkMap chunkMap, org.spigotmc.TrackingRange.TrackingRangeType type, int range) {
|
||||
+ List<Entity> passengers = entity.getPassengers();
|
||||
+ for (int i = 0, size = passengers.size(); i < size; i++) {
|
||||
+ Entity passenger = passengers.get(i);
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType;
|
||||
+ int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal());
|
||||
+ if (passengerRange > range) {
|
||||
+ type = passengerType;
|
||||
+ range = passengerRange;
|
||||
+ }
|
||||
+
|
||||
+ type = this.getFurthestEntity(passenger, chunkMap, type, range);
|
||||
+ }
|
||||
+
|
||||
+ return type;
|
||||
+ }
|
||||
+ // Leaves end - better metond
|
||||
+
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> getPlayersInTrackRange() {
|
||||
// determine highest range of passengers
|
||||
if (this.passengers.isEmpty()) {
|
||||
return ((ServerLevel)this.level).getChunkSource().chunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()]
|
||||
.getObjectsInRange(MCUtil.getCoordinateKey(this));
|
||||
}
|
||||
- Iterable<Entity> passengers = this.getIndirectPassengers();
|
||||
+ // Leaves start - use getFurthestEntity to skip getIndirectPassengers
|
||||
net.minecraft.server.level.ChunkMap chunkMap = ((ServerLevel)this.level).getChunkSource().chunkMap;
|
||||
org.spigotmc.TrackingRange.TrackingRangeType type = this.trackingRangeType;
|
||||
int range = chunkMap.getEntityTrackerRange(type.ordinal());
|
||||
|
||||
- for (Entity passenger : passengers) {
|
||||
- org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType;
|
||||
- int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal());
|
||||
- if (passengerRange > range) {
|
||||
- type = passengerType;
|
||||
- range = passengerRange;
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.removeGetNearPlayerStreams) {
|
||||
+ type = this.getFurthestEntity(this, chunkMap, type, range);
|
||||
+ } else {
|
||||
+ Iterable<Entity> passengers = this.getIndirectPassengers();
|
||||
+ for (Entity passenger : passengers) {
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType;
|
||||
+ int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal());
|
||||
+ if (passengerRange > range) {
|
||||
+ type = passengerType;
|
||||
+ range = passengerRange;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ // Leaves end - use getFurthestEntity to skip getIndirectPassengers
|
||||
|
||||
return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
|
||||
}
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Remove streams and iterators from range check
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index d80d784e2b3fa47c2d264f1a030bddb97f97dc01..b5af9f923cd722792b9597603518594281357ef6 100644
|
||||
index e809ef00c17d2a55877799c595c6732f74f1680e..ed2e0774d5b14d4926b3214ebf3795d7555327e3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1603,19 +1603,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1314,19 +1314,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return ChunkMap.this.level.getServer().getScaledTrackingDistance(initialDistance);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
But Pufferfish patch was ported downstream from the Petal fork
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index ccb811e9251acb1500bd6932e600057017fd996a..75a423cb695bb807e38b17fcc999b4114a8c3579 100644
|
||||
index 36cc925f72c850ee83a763e81c2662e67edaab71..08550dd01eb71ef9fcb18b8b5a771cdc9cfccf97 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -370,7 +370,7 @@ public final class LeavesConfig {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Cache climbing check for activation
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 23151d87f062fcee791eb4ff8196e415bda4c65e..72268f148a9d676975fa881fa94757ca96e39d82 100644
|
||||
index 79ac2dc637450ae960013fe6e79e792deaf5a5ab..61e110f230072072c8070bb3f30cc5a6313e75f3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1974,6 +1974,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2007,6 +2007,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ index 23151d87f062fcee791eb4ff8196e415bda4c65e..72268f148a9d676975fa881fa94757ca
|
||||
if (this.isSpectator()) {
|
||||
return false;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index eda7f0bb42f7269676d5d2193e1155912ede9920..0f7064f3fa0c0d1842c92535cf6ee30f153e5e6e 100644
|
||||
index b45343102be8fba8f3b07e387e72e018c3c23f54..45909e08c8e4d0476b08b07a1da7aaf82c05bed2 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -292,7 +292,7 @@ public class ActivationRange
|
||||
@@ -294,7 +294,7 @@ public class ActivationRange
|
||||
if ( entity instanceof LivingEntity )
|
||||
{
|
||||
LivingEntity living = (LivingEntity) entity;
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Reduce entity fluid lookups if no fluids
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9ae4420296e0e97614ced6a635dc3021c2f23858..6da800990ab752d6a2f9ad97b91aad90ab47549f 100644
|
||||
index 659d0c973b819b93010825ce2def5db4b12d3dff..0b7639ef2540f8af2e5b5fc47df24d2e5ffd0846 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4289,16 +4289,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4304,16 +4304,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
|
||||
@@ -35,7 +35,7 @@ index 9ae4420296e0e97614ced6a635dc3021c2f23858..6da800990ab752d6a2f9ad97b91aad90
|
||||
double d1 = 0.0D;
|
||||
boolean flag = this.isPushedByFluid();
|
||||
boolean flag1 = false;
|
||||
@@ -4306,38 +4308,123 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4321,38 +4323,123 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
int k1 = 0;
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
|
||||
@@ -181,7 +181,7 @@ index 9ae4420296e0e97614ced6a635dc3021c2f23858..6da800990ab752d6a2f9ad97b91aad90
|
||||
if (vec3d.length() > 0.0D) {
|
||||
if (k1 > 0) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index d4477b0dda6a1ef7bd8323c0d11b636bd071d18e..3b7fcf532761362d2f657f58962d7bd2a6f35e94 100644
|
||||
index f0de72afad4bb571153436399386a6a8a70582a6..dd0a589f6d1e61407a555be14f63e338c5333b6a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -25,6 +25,7 @@ public class LevelChunkSection {
|
||||
@@ -190,9 +190,9 @@ index d4477b0dda6a1ef7bd8323c0d11b636bd071d18e..3b7fcf532761362d2f657f58962d7bd2
|
||||
private PalettedContainer<Holder<Biome>> biomes;
|
||||
+ public short fluidStateCount; // Leaves
|
||||
public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper
|
||||
|
||||
public LevelChunkSection(PalettedContainer<BlockState> datapaletteblock, PalettedContainer<Holder<Biome>> palettedcontainerro) {
|
||||
@@ -190,6 +191,7 @@ public class LevelChunkSection {
|
||||
// Paper start - optimise collisions
|
||||
private int specialCollidingBlocks;
|
||||
@@ -102,6 +103,7 @@ public class LevelChunkSection {
|
||||
|
||||
if (!fluid.isEmpty()) {
|
||||
--this.tickingFluidCount;
|
||||
@@ -200,19 +200,19 @@ index d4477b0dda6a1ef7bd8323c0d11b636bd071d18e..3b7fcf532761362d2f657f58962d7bd2
|
||||
}
|
||||
|
||||
if (!state.isAir()) {
|
||||
@@ -204,6 +206,7 @@ public class LevelChunkSection {
|
||||
@@ -116,6 +118,7 @@ public class LevelChunkSection {
|
||||
|
||||
if (!fluid1.isEmpty()) {
|
||||
++this.tickingFluidCount;
|
||||
+ --this.fluidStateCount; // Leaves
|
||||
}
|
||||
|
||||
this.updateKnownBlockInfo(x | (z << 4) | (y << 8), iblockdata1, state); // Paper
|
||||
@@ -249,6 +252,7 @@ public class LevelChunkSection {
|
||||
this.updateBlockCallback(x, y, z, iblockdata1, state); // Paper - optimise collisions
|
||||
@@ -161,6 +164,7 @@ public class LevelChunkSection {
|
||||
if (fluid.isRandomlyTicking()) {
|
||||
this.tickingFluidCount = (short) (this.tickingFluidCount + 1);
|
||||
}
|
||||
+ this.fluidStateCount++; // Leaves
|
||||
}
|
||||
|
||||
});
|
||||
// Paper start - optimise collisions
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Reduce chunk loading & lookups
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index b62457313a1e30aad0c5313d608667b5d3811455..0cd7d8dc3e7d17bbafe7c06e864cb6c52a9fa876 100644
|
||||
index b0a97679157a18a3c623ce3b2ae315789772c254..a8867058fb09fd4c6b965b91d5f406b2a1b7035a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -326,11 +326,28 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@@ -333,11 +333,28 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
private boolean teleport(double x, double y, double z) {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(x, y, z);
|
||||
|
||||
@@ -5,52 +5,11 @@ Subject: [PATCH] PCA sync protocol
|
||||
|
||||
This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index f728382ac721d2204d2cac18f21a43212a08ab7c..b4d49eb6b01a660777afe2e5bcd259dfb02866f4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -247,6 +247,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 implements ServerPlayerConnection, TickablePacketListener, ServerGamePacketListener {
|
||||
@@ -3614,6 +3615,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
}
|
||||
} else {
|
||||
+ // Leaves start - leaves extra protocol
|
||||
+ try {
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.pcaSyncProtocol && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.PcaSyncProtocol.PROTOCOL_ID)) {
|
||||
+ top.leavesmc.leaves.protocol.PcaSyncProtocol.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);
|
||||
+ }
|
||||
+ // Leaves end - leaves extra protocol
|
||||
try {
|
||||
byte[] data = new byte[packet.data.readableBytes()];
|
||||
packet.data.readBytes(data);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 0e095d71cbe46acbf076623a0e1af6963610e5c4..afbe81cec75b06d17699e005acf715d61c56f68d 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -355,6 +355,7 @@ public abstract class PlayerList {
|
||||
}); // Leaves - render bot
|
||||
}
|
||||
// Leaves end - bot support
|
||||
+ top.leavesmc.leaves.protocol.PcaSyncProtocol.onJoin(player); // Leaves - pca
|
||||
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index 49d7109b6ca63c8073db777549a65b2fcb70967e..b06ff2c26a562ff0afdd85c222da4e6fe417bfdc 100644
|
||||
index 09e9c0e55c789f03a4b64136f28154bd114db6f5..39a9737c8e50eb729fff9956ee1b7fa34a17d589 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -371,6 +371,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@@ -373,6 +373,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
|
||||
@Override
|
||||
public void containerChanged(Container sender) {
|
||||
@@ -63,10 +22,10 @@ index 49d7109b6ca63c8073db777549a65b2fcb70967e..b06ff2c26a562ff0afdd85c222da4e6f
|
||||
|
||||
this.updateContainerEquipment();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index 564908ce0a560c2190fb624e77d227d3b7031024..5304ee89ce843c9ca860d68091162a976daee0ea 100644
|
||||
index 5119d070dbb04f5a4f9c2def526e33e15ca8573f..e585eca535ceb2ed28334bc3c6949fcb4881a364 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -65,6 +65,15 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
||||
@@ -64,6 +64,15 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
||||
super(type, world);
|
||||
this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, 16.0F);
|
||||
this.setPathfindingMalus(BlockPathTypes.DAMAGE_FIRE, -1.0F);
|
||||
@@ -102,7 +61,7 @@ index 272095d7a09ab41227d741172735f66fd2798ce1..f6acbef804a50c58f4298ebeae4fdbeb
|
||||
@Override
|
||||
public boolean stillValid(Player player) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 448fa4f4f200430d6ce3051763c7ceb697696146..6171f1ec26a822f89c126f64edf3e02a354239df 100644
|
||||
index a18aadbf7ae83713e1f2b21553185d8000bc7699..eeed0ccbf0fc04e12dea5e8602f67d862fbd3600 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -569,6 +569,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
@@ -289,7 +248,7 @@ index 881379681c39230a00b3a1f11cd87498984396c7..e01eb2025458cf311348c58a15308540
|
||||
protected Component getDefaultName() {
|
||||
return Component.translatable("container.dispenser");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index b11f51762ca289d99eaa49e66e31e58595bcea4e..24d2b8a28bad8f33d5b27197fd80f7bb75926545 100644
|
||||
index 1d9b23c6e458caddc2c738164e6c079cd85d3ce9..88ae3b334e35ac9d0ca4238b5da3c3af1f421bd4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -129,6 +129,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -309,7 +268,7 @@ index b11f51762ca289d99eaa49e66e31e58595bcea4e..24d2b8a28bad8f33d5b27197fd80f7bb
|
||||
@Override
|
||||
protected Component getDefaultName() {
|
||||
return Component.translatable("container.hopper");
|
||||
@@ -169,6 +179,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -208,6 +218,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
if (flag) {
|
||||
blockEntity.setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||
setChanged(world, pos, state);
|
||||
@@ -322,10 +281,10 @@ index b11f51762ca289d99eaa49e66e31e58595bcea4e..24d2b8a28bad8f33d5b27197fd80f7bb
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..25a9c38c60d183bb65b14f4d7550ab98b431c218 100644
|
||||
index 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..5c311270a39f6b4996c8b58822d24556c67adc41 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
@@ -259,6 +259,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
@@ -269,6 +269,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
this.itemStacks = list;
|
||||
}
|
||||
|
||||
@@ -342,45 +301,18 @@ index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..25a9c38c60d183bb65b14f4d7550ab98
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
return ShulkerBoxBlockEntity.SLOTS;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 347a13b818d55de6ab9502aac61fd807d16fc094..85de3ff6eedf6b87189ba64de56b3b8b42915a35 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -470,6 +470,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.PcaSyncProtocol.init(); // Leaves - pca
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1040,6 +1041,13 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
top.leavesmc.leaves.LeavesConfig.init((File) console.options.valueOf("leaves-settings")); // Leaves - Server Config
|
||||
+ // Leaves start - pca
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ top.leavesmc.leaves.protocol.PcaSyncProtocol.enablePcaSyncProtocolGlobal();
|
||||
+ } else {
|
||||
+ top.leavesmc.leaves.protocol.PcaSyncProtocol.disablePcaSyncProtocolGlobal();
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
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/top/leavesmc/leaves/protocol/PcaSyncProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159aec6bb1b5
|
||||
index 0000000000000000000000000000000000000000..b9bc5fdfc55b1ad0e5f1e1065ec449d256e18159
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
||||
@@ -0,0 +1,357 @@
|
||||
@@ -0,0 +1,383 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
|
||||
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
@@ -395,14 +327,15 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
+import org.apache.commons.lang3.tuple.MutablePair;
|
||||
+import org.apache.commons.lang3.tuple.Pair;
|
||||
+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.LeavesConfig;
|
||||
+import top.leavesmc.leaves.LeavesLogger;
|
||||
+import top.leavesmc.leaves.bot.ServerBot;
|
||||
+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;
|
||||
@@ -410,6 +343,9 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+import java.util.Set;
|
||||
+import java.util.concurrent.locks.ReentrantLock;
|
||||
+
|
||||
+import static top.leavesmc.leaves.protocol.core.LeavesProtocolManager.EmptyPayload;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "pca")
|
||||
+public class PcaSyncProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "pca";
|
||||
@@ -422,11 +358,7 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+ private static final ResourceLocation DISABLE_PCA_SYNC_PROTOCOL = id("disable_pca_sync_protocol");
|
||||
+ private static final ResourceLocation UPDATE_ENTITY = id("update_entity");
|
||||
+ private static final ResourceLocation UPDATE_BLOCK_ENTITY = id("update_block_entity");
|
||||
+ // call
|
||||
+ private static final ResourceLocation SYNC_BLOCK_ENTITY = id("sync_block_entity");
|
||||
+ private static final ResourceLocation SYNC_ENTITY = id("sync_entity");
|
||||
+ private static final ResourceLocation CANCEL_SYNC_BLOCK_ENTITY = id("cancel_sync_block_entity");
|
||||
+ private static final ResourceLocation CANCEL_SYNC_ENTITY = id("cancel_sync_entity");
|
||||
+
|
||||
+ private static final Map<ServerPlayer, Pair<ResourceLocation, BlockPos>> playerWatchBlockPos = new HashMap<>();
|
||||
+ private static final Map<ServerPlayer, Pair<ResourceLocation, Entity>> playerWatchEntity = new HashMap<>();
|
||||
+ private static final Map<Pair<ResourceLocation, BlockPos>, Set<ServerPlayer>> blockPosWatchPlayerSet = new HashMap<>();
|
||||
@@ -439,73 +371,31 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void enablePcaSyncProtocol(@NotNull ServerPlayer player) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ ProtocolUtils.sendPayloadPacket(player, ENABLE_PCA_SYNC_PROTOCOL, buf);
|
||||
+ lock.lock();
|
||||
+ lock.unlock();
|
||||
+ }
|
||||
+
|
||||
+ public static void disablePcaSyncProtocol(@NotNull ServerPlayer player) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ ProtocolUtils.sendPayloadPacket(player, DISABLE_PCA_SYNC_PROTOCOL, buf);
|
||||
+ }
|
||||
+
|
||||
+ public static void updateEntity(@NotNull ServerPlayer player, @NotNull Entity entity) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeResourceLocation(entity.level().dimension().location());
|
||||
+ buf.writeInt(entity.getId());
|
||||
+ buf.writeNbt(entity.saveWithoutId(new CompoundTag()));
|
||||
+ ProtocolUtils.sendPayloadPacket(player, UPDATE_ENTITY, buf);
|
||||
+ }
|
||||
+
|
||||
+ public static void updateBlockEntity(@NotNull ServerPlayer player, @NotNull BlockEntity blockEntity) {
|
||||
+ Level world = blockEntity.getLevel();
|
||||
+
|
||||
+ if (world == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeResourceLocation(world.dimension().location());
|
||||
+ buf.writeBlockPos(blockEntity.getBlockPos());
|
||||
+ buf.writeNbt(blockEntity.saveWithId());
|
||||
+ ProtocolUtils.sendPayloadPacket(player, UPDATE_BLOCK_ENTITY, buf);
|
||||
+ }
|
||||
+
|
||||
+ 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, @NotNull ServerboundCustomPayloadPacket packet) {
|
||||
+ globalReceivers.getOrDefault(
|
||||
+ packet.identifier, ((server1, player1, buf) -> LeavesLogger.LOGGER.severe("NullPotion"))
|
||||
+ ).accept(server, player, packet.data);
|
||||
+ }
|
||||
+
|
||||
+ public static void init() {
|
||||
+ registerGlobalReceiver(SYNC_BLOCK_ENTITY, PcaSyncProtocol::syncBlockEntityHandler);
|
||||
+ registerGlobalReceiver(SYNC_ENTITY, PcaSyncProtocol::syncEntityHandler);
|
||||
+ registerGlobalReceiver(CANCEL_SYNC_BLOCK_ENTITY, PcaSyncProtocol::cancelSyncBlockEntityHandler);
|
||||
+ registerGlobalReceiver(CANCEL_SYNC_ENTITY, PcaSyncProtocol::cancelSyncEntityHandler);
|
||||
+ }
|
||||
+
|
||||
+ public static void onJoin(ServerPlayer player) {
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ private static void onJoin(ServerPlayer player) {
|
||||
+ if (LeavesConfig.pcaSyncProtocol) {
|
||||
+ enablePcaSyncProtocol(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void cancelSyncBlockEntityHandler(MinecraftServer server, ServerPlayer player,
|
||||
+ FriendlyByteBuf buf) {
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ private static void onServerReload() {
|
||||
+ if (LeavesConfig.pcaSyncProtocol) {
|
||||
+ enablePcaSyncProtocolGlobal();
|
||||
+ } else {
|
||||
+ disablePcaSyncProtocolGlobal();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = EmptyPayload.class, payloadId = "cancel_sync_block_entity")
|
||||
+ private static void cancelSyncBlockEntityHandler(ServerPlayer player, EmptyPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ return;
|
||||
+ }
|
||||
+ PcaSyncProtocol.clearPlayerWatchBlock(player);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = EmptyPayload.class, payloadId = "cancel_sync_entity")
|
||||
+ private static void cancelSyncEntityHandler(MinecraftServer server, ServerPlayer player,
|
||||
+ FriendlyByteBuf buf) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
@@ -514,12 +404,12 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+ PcaSyncProtocol.clearPlayerWatchEntity(player);
|
||||
+ }
|
||||
+
|
||||
+ private static void syncBlockEntityHandler(MinecraftServer server, ServerPlayer player,
|
||||
+ FriendlyByteBuf buf) {
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = SyncBlockEntityPayload.class, payloadId = "sync_block_entity")
|
||||
+ private static void syncBlockEntityHandler(ServerPlayer player, SyncBlockEntityPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ return;
|
||||
+ }
|
||||
+ BlockPos pos = buf.readBlockPos();
|
||||
+ BlockPos pos = payload.pos;
|
||||
+ ServerLevel world = player.serverLevel();
|
||||
+ BlockState blockState = world.getBlockState(pos);
|
||||
+ clearPlayerWatchData(player);
|
||||
@@ -553,12 +443,13 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+ lock.unlock();
|
||||
+ }
|
||||
+
|
||||
+ private static void syncEntityHandler(MinecraftServer server, ServerPlayer player,
|
||||
+ FriendlyByteBuf buf) {
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = SyncEntityPayload.class, payloadId = "sync_entity")
|
||||
+ private static void syncEntityHandler(ServerPlayer player, SyncEntityPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int entityId = buf.readInt();
|
||||
+ MinecraftServer server = MinecraftServer.getServer();
|
||||
+ int entityId = payload.entityId;
|
||||
+ ServerLevel world = player.serverLevel();
|
||||
+ Entity entity = world.getEntity(entityId);
|
||||
+ if (entity != null) {
|
||||
@@ -599,6 +490,36 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void enablePcaSyncProtocol(@NotNull ServerPlayer player) {
|
||||
+ ProtocolUtils.sendEmptyPayloadPacket(player, ENABLE_PCA_SYNC_PROTOCOL);
|
||||
+ }
|
||||
+
|
||||
+ public static void disablePcaSyncProtocol(@NotNull ServerPlayer player) {
|
||||
+ ProtocolUtils.sendEmptyPayloadPacket(player, DISABLE_PCA_SYNC_PROTOCOL);
|
||||
+ }
|
||||
+
|
||||
+ public static void updateEntity(@NotNull ServerPlayer player, @NotNull Entity entity) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, UPDATE_ENTITY, buf -> {
|
||||
+ buf.writeResourceLocation(entity.level().dimension().location());
|
||||
+ buf.writeInt(entity.getId());
|
||||
+ buf.writeNbt(entity.saveWithoutId(new CompoundTag()));
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ public static void updateBlockEntity(@NotNull ServerPlayer player, @NotNull BlockEntity blockEntity) {
|
||||
+ Level world = blockEntity.getLevel();
|
||||
+
|
||||
+ if (world == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ProtocolUtils.sendPayloadPacket(player, UPDATE_BLOCK_ENTITY, buf -> {
|
||||
+ buf.writeResourceLocation(world.dimension().location());
|
||||
+ buf.writeBlockPos(blockEntity.getBlockPos());
|
||||
+ buf.writeNbt(blockEntity.saveWithId());
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ private static MutablePair<ResourceLocation, Entity> getResourceLocationEntityPair(ResourceLocation ResourceLocation, Entity entity) {
|
||||
+ pairLock.lock();
|
||||
+ ResourceLocationEntityPair.setLeft(ResourceLocation);
|
||||
@@ -730,4 +651,42 @@ index 0000000000000000000000000000000000000000..819c89946670cc41f390d1855cf7159a
|
||||
+ PcaSyncProtocol.clearPlayerWatchBlock(player);
|
||||
+ PcaSyncProtocol.clearPlayerWatchEntity(player);
|
||||
+ }
|
||||
+
|
||||
+ public record SyncBlockEntityPayload(BlockPos pos) implements CustomPacketPayload {
|
||||
+
|
||||
+ public static final ResourceLocation SYNC_BLOCK_ENTITY = PcaSyncProtocol.id("sync_block_entity");
|
||||
+
|
||||
+ public SyncBlockEntityPayload(ResourceLocation id, FriendlyByteBuf buf) {
|
||||
+ this(buf.readBlockPos());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(FriendlyByteBuf buf) {
|
||||
+ buf.writeBlockPos(pos);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull ResourceLocation id() {
|
||||
+ return SYNC_BLOCK_ENTITY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record SyncEntityPayload(int entityId) implements CustomPacketPayload {
|
||||
+
|
||||
+ public static final ResourceLocation SYNC_ENTITY = PcaSyncProtocol.id("sync_entity");
|
||||
+
|
||||
+ public SyncEntityPayload(ResourceLocation id, FriendlyByteBuf buf) {
|
||||
+ this(buf.readInt());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(FriendlyByteBuf buf) {
|
||||
+ buf.writeInt(entityId);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull ResourceLocation id() {
|
||||
+ return SYNC_ENTITY;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -4,67 +4,23 @@ Date: Tue, 29 Nov 2022 09:51:16 +0800
|
||||
Subject: [PATCH] BBOR Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 745ab8b97e6bf3e9a1621558883711eab25f8725..8150ac9c98a30afff5fc04fdec8af6d340c4b9f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1602,6 +1602,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.profiler.popPush("server gui refresh");
|
||||
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.tick(); // Leaves - bbor
|
||||
+
|
||||
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
||||
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/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b4d49eb6b01a660777afe2e5bcd259dfb02866f4..cc736da1897c082efcc58dc006c720b9b1ebb70a 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3620,6 +3620,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (top.leavesmc.leaves.LeavesConfig.pcaSyncProtocol && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.PcaSyncProtocol.PROTOCOL_ID)) {
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.handlePacket(server, player, packet);
|
||||
}
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.bborProtocol && packet.identifier.equals(top.leavesmc.leaves.protocol.BBORProtocol.SUBSCRIBE)) {
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.onPlayerSubscribed(player);
|
||||
+ }
|
||||
} 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);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index afbe81cec75b06d17699e005acf715d61c56f68d..81088d403e3988f4004d6cf368aa15dfa3ac26aa 100644
|
||||
index 59b2124ea6d9b489488ace4fcd4529420a8eca99..7f835ccc97daa0d5ebfebc0a5781233ac389a7ef 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -356,6 +356,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Leaves end - bot support
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.onJoin(player); // Leaves - pca
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedIn(player); // Leaves - bbor
|
||||
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
@@ -607,6 +608,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() : PaperAdventure.asAdventure(entityplayer.getDisplayName())));
|
||||
}
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedOut(entityplayer); // Leaves - bbor
|
||||
// Paper end
|
||||
ServerLevel worldserver = entityplayer.serverLevel();
|
||||
|
||||
@@ -1599,7 +1601,7 @@ public abstract class PlayerList {
|
||||
entityplayer.connection.send(packetplayoutrecipeupdate);
|
||||
@@ -1593,6 +1593,7 @@ public abstract class PlayerList {
|
||||
entityplayer.getRecipeBook().sendInitialRecipeBook(entityplayer);
|
||||
}
|
||||
-
|
||||
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.onDataPackReload(); // Leaves - bbor
|
||||
}
|
||||
|
||||
public boolean isAllowCheatsForAllPlayers() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index cc224af0139a6e3adefd22cbfa0cd519735b7191..2c3ca05644bc97d505e8ca92e7a5f48670fd8b66 100644
|
||||
index 7d9d09b0f84acb3a4692c58e5b6876a2e1875ba7..6f005cc4b90d2610c8a2ce246f29156132e68267 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1029,6 +1029,11 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -936,6 +936,11 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
public void setLoaded(boolean loadedToWorld) {
|
||||
this.loaded = loadedToWorld;
|
||||
@@ -76,33 +32,14 @@ index cc224af0139a6e3adefd22cbfa0cd519735b7191..2c3ca05644bc97d505e8ca92e7a5f486
|
||||
}
|
||||
|
||||
public Level getLevel() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 85de3ff6eedf6b87189ba64de56b3b8b42915a35..569ffe34b169902aa9bc52b5238376ee04959c11 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1048,6 +1048,13 @@ public final class CraftServer implements Server {
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.disablePcaSyncProtocolGlobal();
|
||||
}
|
||||
// Leaves end - pca
|
||||
+ // Leaves start - bbor
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.bborProtocol) {
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.initAllPlayer();
|
||||
+ } else {
|
||||
+ top.leavesmc.leaves.protocol.BBORProtocol.loggedOutAllPlayer();
|
||||
+ }
|
||||
+ // Leaves end - bbor
|
||||
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/top/leavesmc/leaves/protocol/BBORProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/BBORProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118d33d86de
|
||||
index 0000000000000000000000000000000000000000..9bc31425ffaedcf17313aa000ba4fe3c16929810
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/BBORProtocol.java
|
||||
@@ -0,0 +1,216 @@
|
||||
@@ -0,0 +1,228 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
@@ -119,7 +56,9 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+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;
|
||||
@@ -128,6 +67,9 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
+import java.util.stream.Collectors;
|
||||
+
|
||||
+import static top.leavesmc.leaves.protocol.core.LeavesProtocolManager.EmptyPayload;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "bbor")
|
||||
+public class BBORProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "bbor";
|
||||
@@ -137,7 +79,6 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+ private static final ResourceLocation ADD_BOUNDING_BOX = id("add_bounding_box_v2");
|
||||
+ private static final ResourceLocation STRUCTURE_LIST_SYNC = id("structure_list_sync_v1");
|
||||
+ // call
|
||||
+ public static final ResourceLocation SUBSCRIBE = id("subscribe");
|
||||
+ private static final Map<Integer, ServerPlayer> players = new ConcurrentHashMap<>();
|
||||
+ private static final Map<Integer, Set<BBoundingBox>> playerBoundingBoxesCache = new HashMap<>();
|
||||
+ private static final Map<ResourceLocation, Map<BBoundingBox, Set<BBoundingBox>>> dimensionCache = new ConcurrentHashMap<>();
|
||||
@@ -149,24 +90,46 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
+ @ProtocolHandler.Ticker
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeLong(OVERWORLD.getSeed());
|
||||
+ buf.writeInt(OVERWORLD.levelData.getXSpawn());
|
||||
+ buf.writeInt(OVERWORLD.levelData.getZSpawn());
|
||||
+ ProtocolUtils.sendPayloadPacket(player, INITIALIZE_CLIENT, buf);
|
||||
+
|
||||
+ final Registry<Structure> structureRegistry = player.server.registryAccess().registryOrThrow(Registries.STRUCTURE);
|
||||
+ final Set<String> structureIds = structureRegistry.entrySet().stream().map(e -> e.getKey().location().toString()).collect(Collectors.toSet());
|
||||
+ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf1.writeVarInt(structureIds.size());
|
||||
+ structureIds.forEach(buf1::writeUtf);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, STRUCTURE_LIST_SYNC, buf1);
|
||||
+ for (var playerEntry : players.entrySet()) {
|
||||
+ sendBoundingToPlayer(playerEntry.getKey(), playerEntry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerSubscribed(@NotNull ServerPlayer player) {
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ public static void onServerReload() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ initAllPlayer();
|
||||
+ } else {
|
||||
+ loggedOutAllPlayer();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, INITIALIZE_CLIENT, buf -> {
|
||||
+ buf.writeLong(OVERWORLD.getSeed());
|
||||
+ buf.writeInt(OVERWORLD.levelData.getXSpawn());
|
||||
+ buf.writeInt(OVERWORLD.levelData.getZSpawn());
|
||||
+ });
|
||||
+ sendStructureList(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ players.remove(player.getId());
|
||||
+ playerBoundingBoxesCache.remove(player.getId());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = EmptyPayload.class, payloadId = "subscribe")
|
||||
+ public static void onPlayerSubscribed(@NotNull ServerPlayer player, EmptyPayload payload) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ players.put(player.getId(), player);
|
||||
+ sendBoundingToPlayer(player.getId(), player);
|
||||
@@ -175,21 +138,7 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+
|
||||
+ public static void onDataPackReload() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ for (var playerEntry : players.entrySet()) {
|
||||
+ final Registry<Structure> structureRegistry = MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.STRUCTURE);
|
||||
+ final Set<String> structureIds = structureRegistry.entrySet().stream().map(e -> e.getKey().location().toString()).collect(Collectors.toSet());
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeVarInt(structureIds.size());
|
||||
+ structureIds.forEach(buf::writeUtf);
|
||||
+ ProtocolUtils.sendPayloadPacket(playerEntry.getValue(), STRUCTURE_LIST_SYNC, buf);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ players.remove(player.getId());
|
||||
+ playerBoundingBoxesCache.remove(player.getId());
|
||||
+ players.values().forEach(BBORProtocol::sendStructureList);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -201,7 +150,7 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+ final var optional = structureFeatureRegistry.getResourceKey(es.getKey());
|
||||
+ optional.ifPresent(key -> structures.put(key.location().toString(), es.getValue()));
|
||||
+ }
|
||||
+ if (structures.size() > 0) {
|
||||
+ if (!structures.isEmpty()) {
|
||||
+ onStructuresLoaded(chunk.getLevel().dimension().location(), structures);
|
||||
+ }
|
||||
+ }
|
||||
@@ -236,6 +185,16 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+ return new BBoundingBox(type, min, max);
|
||||
+ }
|
||||
+
|
||||
+ private static void sendStructureList(ServerPlayer player) {
|
||||
+ final Registry<Structure> structureRegistry = player.server.registryAccess().registryOrThrow(Registries.STRUCTURE);
|
||||
+ final Set<String> structureIds = structureRegistry.entrySet().stream()
|
||||
+ .map(e -> e.getKey().location().toString()).collect(Collectors.toSet());
|
||||
+ ProtocolUtils.sendPayloadPacket(player, STRUCTURE_LIST_SYNC, buf -> {
|
||||
+ buf.writeVarInt(structureIds.size());
|
||||
+ structureIds.forEach(buf::writeUtf);
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ private static void sendBoundingToPlayer(int id, ServerPlayer player) {
|
||||
+ for (var entry : dimensionCache.entrySet()) {
|
||||
+ if (entry.getValue() == null) {
|
||||
@@ -250,29 +209,20 @@ index 0000000000000000000000000000000000000000..95469919589b48e1c672b6b9dc884118
|
||||
+ }
|
||||
+
|
||||
+ Set<BBoundingBox> boundingBoxes = boundingBoxMap.get(key);
|
||||
+
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeResourceLocation(entry.getKey());
|
||||
+ key.serialize(buf);
|
||||
+ if (boundingBoxes != null && boundingBoxes.size() > 1) {
|
||||
+ for (BBoundingBox box : boundingBoxes) {
|
||||
+ box.serialize(buf);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, ADD_BOUNDING_BOX, buf -> {
|
||||
+ buf.writeResourceLocation(entry.getKey());
|
||||
+ key.serialize(buf);
|
||||
+ if (boundingBoxes != null && boundingBoxes.size() > 1) {
|
||||
+ for (BBoundingBox box : boundingBoxes) {
|
||||
+ box.serialize(buf);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ ProtocolUtils.sendPayloadPacket(player, ADD_BOUNDING_BOX, buf);
|
||||
+ });
|
||||
+ playerBoundingBoxes.add(key);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ for (var playerEntry : players.entrySet()) {
|
||||
+ sendBoundingToPlayer(playerEntry.getKey(), playerEntry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void initAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedIn(player);
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] InstantBlockUpdater Reintroduced
|
||||
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 405283f793cdf108a1895e3b21f6ec9992a62ee4..fdb171a28f73f6a0fae5aba669014edd4fee83b8 100644
|
||||
index 35063fa42e9ec1d963d94b2c714b82ac30d1f67b..cb62c2b8b6cdd628037b67a58b3fbf7e5f1d0284 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -74,6 +74,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
@@ -67,6 +67,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.redstone.CollectingNeighborUpdater;
|
||||
@@ -17,7 +17,7 @@ index 405283f793cdf108a1895e3b21f6ec9992a62ee4..fdb171a28f73f6a0fae5aba669014edd
|
||||
import net.minecraft.world.level.redstone.NeighborUpdater;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
import net.minecraft.world.level.storage.LevelData;
|
||||
@@ -320,7 +321,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -246,7 +247,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.thread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, i);
|
||||
this.isDebug = flag1;
|
||||
@@ -5,32 +5,6 @@ Subject: [PATCH] Jade Protocol
|
||||
|
||||
This patch is Powered by Jade(https://github.com/Snownee/Jade)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index cc736da1897c082efcc58dc006c720b9b1ebb70a..7b0e956b11817c08b42ee3a7db87d42a090f5b15 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3623,6 +3623,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (top.leavesmc.leaves.LeavesConfig.bborProtocol && packet.identifier.equals(top.leavesmc.leaves.protocol.BBORProtocol.SUBSCRIBE)) {
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.onPlayerSubscribed(player);
|
||||
}
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.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);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 81088d403e3988f4004d6cf368aa15dfa3ac26aa..34771b561d6e944e77b85ee4b4018453b30ba388 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -357,6 +357,7 @@ public abstract class PlayerList {
|
||||
// Leaves end - bot support
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.onJoin(player); // Leaves - pca
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedIn(player); // Leaves - bbor
|
||||
+ top.leavesmc.leaves.protocol.JadeProtocol.onPlayerJoin(player); // Leaves - Jade
|
||||
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
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 4aeab90e778629c355189dfe79c39c4b21f5f5ac..fe8c9b7e7956837829b4fe3eb449b2c093f7cea3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
@@ -44,36 +18,12 @@ index 4aeab90e778629c355189dfe79c39c4b21f5f5ac..fe8c9b7e7956837829b4fe3eb449b2c0
|
||||
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 569ffe34b169902aa9bc52b5238376ee04959c11..ac22b1e5a6cecc74a0608a6856821a8771acc42b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -471,6 +471,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.init(); // Leaves - pca
|
||||
+ top.leavesmc.leaves.protocol.JadeProtocol.init(); // Leaves - Jade
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1055,6 +1056,11 @@ public final class CraftServer implements Server {
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.loggedOutAllPlayer();
|
||||
}
|
||||
// Leaves end - bbor
|
||||
+ // Leaves start - Jade
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.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/top/leavesmc/leaves/protocol/JadeProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453acc920520
|
||||
index 0000000000000000000000000000000000000000..713a3c2b29de57ad47ffe1f0c591ba9164b8c5ff
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java
|
||||
@@ -0,0 +1,579 @@
|
||||
@@ -0,0 +1,617 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import com.google.common.cache.Cache;
|
||||
@@ -83,14 +33,15 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+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.game.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;
|
||||
@@ -116,7 +67,6 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+import net.minecraft.world.level.BaseCommandBlock;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.block.ChestBlock;
|
||||
+import net.minecraft.world.level.block.ChiseledBookShelfBlock;
|
||||
+import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
|
||||
+import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
|
||||
+import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
|
||||
@@ -136,19 +86,17 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+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.LeavesConfig;
|
||||
+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;
|
||||
@@ -156,6 +104,7 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+import java.util.stream.IntStream;
|
||||
+import java.util.stream.Stream;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "jade")
|
||||
+public class JadeProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "jade";
|
||||
@@ -163,9 +112,6 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ // 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);
|
||||
@@ -177,37 +123,12 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (LeavesConfig.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, @NotNull ServerboundCustomPayloadPacket packet) {
|
||||
+ globalReceivers.getOrDefault(packet.identifier, ((server1, player1, buf) -> LeavesLogger.LOGGER.severe("NullPotion"))).accept(server, player, packet.data);
|
||||
+ }
|
||||
+
|
||||
+ @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));
|
||||
@@ -222,14 +143,16 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ 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();
|
||||
@@ -387,19 +310,25 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ }
|
||||
+ }
|
||||
+ }));
|
||||
+
|
||||
+ 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 (LeavesConfig.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 (!LeavesConfig.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;
|
||||
+ }
|
||||
@@ -420,19 +349,19 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ }
|
||||
+ 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 (!LeavesConfig.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)) {
|
||||
@@ -462,19 +391,79 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ 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 (LeavesConfig.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();
|
||||
@@ -651,5 +640,4 @@ index 0000000000000000000000000000000000000000..2d366c44e1809d5d046017e08542453a
|
||||
+ list.addAll(objects.get(clazz));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
@@ -44,10 +44,10 @@ index 88072259a9de205db428351c5c9f6114e199e402..e641360a3e82cb03393b856fa545d6b0
|
||||
if (iblockdata2 != null && this.canPlace(world, iblockdata2, blockposition)) {
|
||||
iblockdata1 = iblockdata2;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 2af43e50cc84c7b83e69e837ab4fbaa3a51c60a6..35f1aea111aab3e79a73fb51c553e96bbcdab3bf 100644
|
||||
index 065fbac30d22ec45cd3f5b66599c8500ae5c278d..9a970c6aff2f5f2edbad600156493a7c1f28e620 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -411,6 +411,33 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -404,6 +404,33 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) {}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Player operation limiter
|
||||
This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c63142cea44d26c6742f39b090eeba8f2052662c..20778affc3e42d6eeb898e42671dc9ac83d05242 100644
|
||||
index ae6fe20cac39766bd1cde1adfd93072ce4a8f44c..4f47b1123eb517ffda3c1a0e61434e459b38d679 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -278,6 +278,10 @@ public class ServerPlayer extends Player {
|
||||
@@ -273,6 +273,10 @@ public class ServerPlayer extends Player {
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
@@ -18,9 +18,9 @@ index c63142cea44d26c6742f39b090eeba8f2052662c..20778affc3e42d6eeb898e42671dc9ac
|
||||
+ private int placeBlockCountPerTick = 0;
|
||||
+ // Leaves end - player operation limiter
|
||||
|
||||
// Paper start - replace player chunk loader
|
||||
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
|
||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
@@ -711,6 +715,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -714,6 +718,7 @@ public class ServerPlayer extends Player {
|
||||
this.joining = false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -28,7 +28,7 @@ index c63142cea44d26c6742f39b090eeba8f2052662c..20778affc3e42d6eeb898e42671dc9ac
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -2665,5 +2670,32 @@ public class ServerPlayer extends Player {
|
||||
@@ -2657,5 +2662,32 @@ public class ServerPlayer extends Player {
|
||||
public CraftPlayer getBukkitEntity() {
|
||||
return (CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ index c63142cea44d26c6742f39b090eeba8f2052662c..20778affc3e42d6eeb898e42671dc9ac
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 618ab9a2903f6d4139acd4aaa2e6db0a26e88ba9..960a2c5735d3ddb05673f8aba43268ad16bc6df8 100644
|
||||
index b2c2bd5ec0afd479973f7237a5c610f21231c505..63f89a7fb6309c2d5b7a3f75fdb21d85ddbfa80a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -44,6 +44,7 @@ import org.bukkit.event.Event;
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Renewable Elytra
|
||||
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 4a132c3eff6978e927bcd4df56b9ce0306af6d19..8f390c7201da00f7e1c5913f0d0642a2b5e943cb 100644
|
||||
index 5b4719dd7c3b8f93c898779f45239568f6a5fe43..9c0b9eb91c07aae0cb43a0988ccd4381eecfbbf7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -36,6 +36,8 @@ import net.minecraft.world.entity.ai.goal.Goal;
|
||||
@@ -18,8 +18,8 @@ index 4a132c3eff6978e927bcd4df56b9ce0306af6d19..8f390c7201da00f7e1c5913f0d0642a2
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
@@ -250,6 +252,20 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
return (double) this.getEyeHeight();
|
||||
@@ -255,6 +257,20 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
return -0.125F;
|
||||
}
|
||||
|
||||
+ // Leaves start - renewable elytra
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Stackable ShulkerBoxes
|
||||
This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||
|
||||
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 d39f31e7cf315c7cdc1daab28164380e44dd8341..8289293abeec8bed84c2072bc2c501c51ef5b719 100644
|
||||
index eb0351aa12eebcefab1d1d14641fc3c60cbbcab8..e2f3044ce964f0da9df83b8a302316d2438384e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -14,10 +14,12 @@ import net.minecraft.world.entity.Entity;
|
||||
@@ -132,7 +132,7 @@ index 41cb0d1efd81b7754b68c89af289c1260779c08b..75a26684dc892f96e9209ef77709d1b4
|
||||
if (this.add(i, stack.split(j)) && notifiesClient && this.player instanceof ServerPlayer) {
|
||||
((ServerPlayer) this.player).connection.send(new ClientboundContainerSetSlotPacket(-2, 0, i, this.getItem(i)));
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 0f18fff8f0b06aa427b13768f8b673d396e6afb3..12b34e7c474ad874b3a33e018067489271caecf3 100644
|
||||
index bc734baa18eb12b499bca2c0fc6b8d8960b3ba26..0c87b9a7ef04fbe500a3c903099c2349dd449438 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -30,8 +30,10 @@ import net.minecraft.world.entity.SlotAccess;
|
||||
@@ -224,10 +224,10 @@ index 0f18fff8f0b06aa427b13768f8b673d396e6afb3..12b34e7c474ad874b3a33e0180674892
|
||||
slot.setChanged();
|
||||
} // Paper
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/Slot.java b/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
index 92699f79f19b4dcd7d349976cedc0408836263a6..6c979ee6c7a12111fe4380bbb0abc285dc7c264b 100644
|
||||
index a43b85b82fc83d0e5e3fd589bede0b279927a989..4e68e77180df7929d8993f049fc73c90f0158a2c 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
@@ -73,7 +73,7 @@ public class Slot {
|
||||
@@ -77,7 +77,7 @@ public class Slot {
|
||||
}
|
||||
|
||||
public int getMaxStackSize(ItemStack stack) {
|
||||
@@ -278,10 +278,10 @@ index 47468086c1cae252aa99c55b0065f225357dee62..bca757ea05403fe46f5bf0dfa75561b8
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
return SHAPE;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 24d2b8a28bad8f33d5b27197fd80f7bb75926545..fa19bc9f9ac90fb6c0e687c72c253324a312fd51 100644
|
||||
index 88ae3b334e35ac9d0ca4238b5da3c3af1f421bd4..9310444c04608a0015844eafa872f24c8baedf4d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -657,9 +657,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -733,9 +733,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
if (itemstack1.isEmpty()) {
|
||||
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
|
||||
ItemStack leftover = ItemStack.EMPTY; // Paper
|
||||
@@ -7,10 +7,10 @@ This patch is Powered by Pufferfish
|
||||
(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 5502ad143fd2575f1346334b5b4fe7846628f54e..39669ad8e8895f1ff3e3a7e3ee1ab39c1b74b09d 100644
|
||||
index e21f4c5aff3a8e97101f6efc1349fbecf326b5ea..3cf6e62ceb555eedf133e0ba82445caadaab7743 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -52,6 +52,11 @@ public abstract class FlowingFluid extends Fluid {
|
||||
@@ -53,6 +53,11 @@ public abstract class FlowingFluid extends Fluid {
|
||||
object2bytelinkedopenhashmap.defaultReturnValue((byte) 127);
|
||||
return object2bytelinkedopenhashmap;
|
||||
});
|
||||
@@ -22,11 +22,17 @@ index 5502ad143fd2575f1346334b5b4fe7846628f54e..39669ad8e8895f1ff3e3a7e3ee1ab39c
|
||||
private final Map<FluidState, VoxelShape> shapes = Maps.newIdentityHashMap();
|
||||
|
||||
public FlowingFluid() {}
|
||||
@@ -240,40 +245,70 @@ public abstract class FlowingFluid extends Fluid {
|
||||
}
|
||||
|
||||
private boolean canPassThroughWall(Direction face, BlockGetter world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState) {
|
||||
@@ -252,40 +257,71 @@ public abstract class FlowingFluid extends Fluid {
|
||||
return false;
|
||||
}
|
||||
// Paper end - optimise collisions
|
||||
- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap;
|
||||
|
||||
- if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) {
|
||||
- object2bytelinkedopenhashmap = (Object2ByteLinkedOpenHashMap) FlowingFluid.OCCLUSION_CACHE.get();
|
||||
- } else {
|
||||
- object2bytelinkedopenhashmap = null;
|
||||
- }
|
||||
+ // Leaves start - cache
|
||||
+ if (!top.leavesmc.leaves.LeavesConfig.improveFluidDirectionCaching) {
|
||||
+ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap;
|
||||
@@ -36,12 +42,7 @@ index 5502ad143fd2575f1346334b5b4fe7846628f54e..39669ad8e8895f1ff3e3a7e3ee1ab39c
|
||||
+ } else {
|
||||
+ object2bytelinkedopenhashmap = null;
|
||||
+ }
|
||||
|
||||
- if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) {
|
||||
- object2bytelinkedopenhashmap = (Object2ByteLinkedOpenHashMap) FlowingFluid.OCCLUSION_CACHE.get();
|
||||
- } else {
|
||||
- object2bytelinkedopenhashmap = null;
|
||||
- }
|
||||
+
|
||||
+ Block.BlockStatePairKey block_a;
|
||||
+
|
||||
+ if (object2bytelinkedopenhashmap != null) {
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] MC Technical Survival Mode
|
||||
Will automatically overwrite some configuration after startup
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
||||
index abd0217cf0bff183c8e262edc173a53403797c1a..f2659e1973e7ef5c5b64ba0bf3b27e5da1f53905 100644
|
||||
index 8e52ebe8d12f5da3d877b0e4ff3723229fb47db1..b9a45dfd024c966ac93eaa15a42f4e2c5338829f 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
||||
@@ -607,7 +607,7 @@ public final class ChunkHolderManager {
|
||||
@@ -19,10 +19,10 @@ index abd0217cf0bff183c8e262edc173a53403797c1a..f2659e1973e7ef5c5b64ba0bf3b27e5d
|
||||
final long timeout;
|
||||
if (type == RegionizedPlayerChunkLoader.REGION_PLAYER_TICKET && delayTimeout > 0) {
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index 2d3068b7748032342edd81e6ea4a7c08988fb28d..e4cca02e5578d5884cf31d52796021d9fae31715 100644
|
||||
index 9b5c2abaa28fa60cedd9f0111e5eb018f93a0561..630549fd00a939dddf5b5a5ea63004c657a5ceab 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -298,6 +298,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -303,6 +303,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
for (ServerLevel level : server.getAllLevels()) {
|
||||
this.createWorldConfig(createWorldContextMap(level), reloader(this.worldConfigClass, level.paperConfig()));
|
||||
}
|
||||
@@ -31,10 +31,10 @@ index 2d3068b7748032342edd81e6ea4a7c08988fb28d..e4cca02e5578d5884cf31d52796021d9
|
||||
throw new RuntimeException("Could not reload paper configuration files", ex);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c47df8d18be8ac7d32a16e6662dbbd850efc8e8a..4453664ac91eb727e340ace3b6bdb083541f816c 100644
|
||||
index 54d380e5c454891c76f31112c94e8bb87a4bee3b..a90c6b1cfc9c3f99712afa1d7a3ed93fb02f4bfd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2692,7 +2692,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2693,7 +2693,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public void onTickingEnd(Entity entity) {
|
||||
ServerLevel.this.entityTickList.remove(entity);
|
||||
// Paper start - Reset pearls when they stop being ticked
|
||||
@@ -70,10 +70,10 @@ index 4ce3e69970dd9eb251d0538a2d233ca30e9e5e47..25a01ca42b8f2f0590965edbeca9c1f9
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index e30d5ae3e2900f43d7cafde71b8196f26e872841..79bfd7b5da13197c2d3f7dbf9c3154dd783d1ba8 100644
|
||||
index f555e29c7f9ea4ddb243a018bdc93d2bf1950c3c..2ef2f27fd899c434c1c35b6fb354f47c7199ad23 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -1009,7 +1009,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -1018,7 +1018,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
public void onReputationEventFrom(ReputationEventType interaction, Entity entity) {
|
||||
if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) {
|
||||
// Paper start - fix MC-181190
|
||||
@@ -96,7 +96,7 @@ index a90317100d32974e481e14476843f66997a2cf3a..34029cdf229ef8f78ddb0c8a2e5e0542
|
||||
|
||||
this.leftOwner = nbt.getBoolean("LeftOwner");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 9af07ebff3a510a4e3fc71ab4d08897db02b7299..81eaa7ead4821929f20e4c5fcb822504001f6f99 100644
|
||||
index 5eded2322d604c3a304194926a740818631f36de..797725f7472ed36bf5a1369a7dfe600a9749cbac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -95,7 +95,7 @@ public final class NaturalSpawner {
|
||||
@@ -109,7 +109,7 @@ index 9af07ebff3a510a4e3fc71ab4d08897db02b7299..81eaa7ead4821929f20e4c5fcb822504
|
||||
entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
|
||||
continue;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 0665edaed2b578b87723ca637fc54c7bd871ecc9..da71e9ba7d341c7a66199e927a46e842fdab065e 100644
|
||||
index 08550dd01eb71ef9fcb18b8b5a771cdc9cfccf97..fccce21591136beac85a41bd1b4df3cc5569faf0 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -2,6 +2,7 @@ package top.leavesmc.leaves;
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Return nether portal fix
|
||||
This patch is powered by NetherPortalFix(https://github.com/TwelveIterationMods/NetherPortalFix)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 20778affc3e42d6eeb898e42671dc9ac83d05242..2c3e286d683437c1435b76665a5f94082a1b2ec5 100644
|
||||
index 4f47b1123eb517ffda3c1a0e61434e459b38d679..7cd939bd90cf047e7bd4f894906c2af4198534d2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -185,6 +185,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
@@ -180,6 +180,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.MainHand;
|
||||
import top.leavesmc.leaves.bot.ServerBot;
|
||||
@@ -17,7 +17,7 @@ index 20778affc3e42d6eeb898e42671dc9ac83d05242..2c3e286d683437c1435b76665a5f9408
|
||||
// CraftBukkit end
|
||||
|
||||
public class ServerPlayer extends Player {
|
||||
@@ -1285,6 +1286,24 @@ public class ServerPlayer extends Player {
|
||||
@@ -1288,6 +1289,24 @@ public class ServerPlayer extends Player {
|
||||
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
// CraftBukkit end
|
||||
@@ -42,7 +42,7 @@ index 20778affc3e42d6eeb898e42671dc9ac83d05242..2c3e286d683437c1435b76665a5f9408
|
||||
}
|
||||
// Paper start
|
||||
if (this.isBlocking()) {
|
||||
@@ -1337,6 +1356,30 @@ public class ServerPlayer extends Player {
|
||||
@@ -1340,6 +1359,30 @@ public class ServerPlayer extends Player {
|
||||
protected Optional<BlockUtil.FoundRectangle> getExitPortal(ServerLevel worldserver, BlockPos blockposition, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) { // CraftBukkit
|
||||
Optional<BlockUtil.FoundRectangle> optional = super.getExitPortal(worldserver, blockposition, flag, worldborder, searchRadius, canCreatePortal, createRadius); // CraftBukkit
|
||||
|
||||
@@ -74,10 +74,10 @@ index 20778affc3e42d6eeb898e42671dc9ac83d05242..2c3e286d683437c1435b76665a5f9408
|
||||
return optional;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 34771b561d6e944e77b85ee4b4018453b30ba388..00fa187c70c6c0f7eea03fbd320fb938addcb410 100644
|
||||
index 7f835ccc97daa0d5ebfebc0a5781233ac389a7ef..9cf607051794f673102dbb4dc887aafabb6e291f 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -27,6 +27,8 @@ import java.util.UUID;
|
||||
@@ -24,6 +24,8 @@ import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -86,7 +86,7 @@ index 34771b561d6e944e77b85ee4b4018453b30ba388..00fa187c70c6c0f7eea03fbd320fb938
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.FileUtil;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
@@ -129,6 +131,8 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
@@ -121,6 +123,8 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -95,7 +95,7 @@ index 34771b561d6e944e77b85ee4b4018453b30ba388..00fa187c70c6c0f7eea03fbd320fb938
|
||||
public abstract class PlayerList {
|
||||
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -990,6 +994,24 @@ public abstract class PlayerList {
|
||||
@@ -982,6 +986,24 @@ public abstract class PlayerList {
|
||||
if (fromWorld != location.getWorld()) {
|
||||
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld);
|
||||
server.server.getPluginManager().callEvent(event);
|
||||
@@ -121,10 +121,10 @@ index 34771b561d6e944e77b85ee4b4018453b30ba388..00fa187c70c6c0f7eea03fbd320fb938
|
||||
|
||||
// Save player file again if they were disconnected
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 3a3b1439f6f20a82f6800272bd99feb3596fdecb..d56f683a5d043f3be624a94d889acc1df0e95554 100644
|
||||
index 61e110f230072072c8070bb3f30cc5a6313e75f3..37a9ed678f674fe7026fc59ff438eb3203f8a792 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -242,7 +242,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -241,7 +241,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected ItemStack useItem;
|
||||
protected int useItemRemaining;
|
||||
protected int fallFlyTicks;
|
||||
@@ -4,66 +4,14 @@ Date: Wed, 25 Jan 2023 11:03:53 +0800
|
||||
Subject: [PATCH] Appleskin Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8150ac9c98a30afff5fc04fdec8af6d340c4b9f5..c748b29bf2d4382215bffd41854f70fd15f9411e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1603,6 +1603,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.popPush("server gui refresh");
|
||||
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.tick(); // Leaves - bbor
|
||||
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.tick(); // Leaves - appleskin
|
||||
|
||||
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
||||
for (int i = 0; i < this.tickables.size(); ++i) {
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 00fa187c70c6c0f7eea03fbd320fb938addcb410..d29db001f12c072fbba1f981ca02880cb39cf62e 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -362,6 +362,7 @@ public abstract class PlayerList {
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.onJoin(player); // Leaves - pca
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedIn(player); // Leaves - bbor
|
||||
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();
|
||||
|
||||
@@ -614,6 +615,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedOut(entityplayer); // Leaves - bbor
|
||||
+ top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedOut(entityplayer); // Leaves - appleskin
|
||||
// Paper end
|
||||
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 ac22b1e5a6cecc74a0608a6856821a8771acc42b..5f50169af0dcbd7931f0118815005607a2d3ba0c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1061,6 +1061,13 @@ public final class CraftServer implements Server {
|
||||
top.leavesmc.leaves.protocol.JadeProtocol.enableAllPlayer();
|
||||
}
|
||||
// Leaves end - Jade
|
||||
+ // Leaves start - appleskin
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.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/top/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c058ed5920f
|
||||
index 0000000000000000000000000000000000000000..a4ed856d458a231a758d58fc62227a1130410d05
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
@@ -0,0 +1,99 @@
|
||||
@@ -0,0 +1,112 @@
|
||||
+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;
|
||||
@@ -71,7 +19,9 @@ index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c05
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+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;
|
||||
@@ -79,6 +29,7 @@ index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c05
|
||||
+import java.util.Set;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "appleskin")
|
||||
+public class AppleSkinProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "appleskin";
|
||||
@@ -98,18 +49,7 @@ index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c05
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void enableAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedIn(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void disableAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedOut(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ players.add(player);
|
||||
@@ -117,6 +57,7 @@ index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c05
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ players.remove(player);
|
||||
@@ -124,11 +65,7 @@ index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c05
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void resetPlayerData(@NotNull ServerPlayer player) {
|
||||
+ previousExhaustionLevels.remove(player.getUUID());
|
||||
+ previousSaturationLevels.remove(player.getUUID());
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.Ticker
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ for (ServerPlayer player : players) {
|
||||
@@ -141,21 +78,47 @@ index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c05
|
||||
+ 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);
|
||||
+ 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) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeFloat(exhaustion);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> {
|
||||
+ buf.writeFloat(exhaustion);
|
||||
+ });
|
||||
+ previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ public static void onServerReload() {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ enableAllPlayer();
|
||||
+ } else {
|
||||
+ disableAllPlayer();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void enableAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedIn(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void disableAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedOut(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void resetPlayerData(@NotNull ServerPlayer player) {
|
||||
+ previousExhaustionLevels.remove(player.getUUID());
|
||||
+ previousSaturationLevels.remove(player.getUUID());
|
||||
+ }
|
||||
+}
|
||||
@@ -1,283 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 2 Feb 2023 16:01:18 +0800
|
||||
Subject: [PATCH] Leaves Extra Yggdrasil Service
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
index 1459a1f99fe614d072a087cda18788cf13102645..73bfda834fa704b208a5dd9271bb397a9f8b5983 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
@@ -8,7 +8,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
|
||||
import java.net.Proxy;
|
||||
|
||||
public class PaperAuthenticationService extends YggdrasilAuthenticationService {
|
||||
- private final Environment environment;
|
||||
+ protected final Environment environment; // Leaves - private -> protected
|
||||
public PaperAuthenticationService(Proxy proxy) {
|
||||
super(proxy);
|
||||
this.environment = EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD.getEnvironment());
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..686c9d7e71c1ffba2d63198afaeecc0c679dd3ea 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -204,7 +204,7 @@ public class Main {
|
||||
file = new File(bukkitConfiguration.getString("settings.world-container", "."));
|
||||
}
|
||||
// Paper end - fix SPIGOT-5824
|
||||
- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper
|
||||
+ Services services = Services.create(new top.leavesmc.leaves.profile.LeavesAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper // Leaves - extra-yggdrasil-service
|
||||
// CraftBukkit start
|
||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index c748b29bf2d4382215bffd41854f70fd15f9411e..43638595413bbcc5dcaf04daa8c1df05c42c9f4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -264,7 +264,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private boolean isDemo;
|
||||
private volatile boolean isReady;
|
||||
private long lastOverloadWarning;
|
||||
- protected final Services services;
|
||||
+ public final Services services; // Leaves - protected -> public
|
||||
private long lastServerStatus;
|
||||
public final Thread serverThread;
|
||||
private long nextTickTime;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index da71e9ba7d341c7a66199e927a46e842fdab065e..f0e28ad726fd9de56df7fcf78f18309e744a626f 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import top.leavesmc.leaves.command.LeavesCommand;
|
||||
import top.leavesmc.leaves.bot.BotCommand;
|
||||
import top.leavesmc.leaves.bot.agent.Actions;
|
||||
+import top.leavesmc.leaves.profile.LeavesMinecraftSessionService;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -527,6 +528,9 @@ public final class LeavesConfig {
|
||||
extraYggdrasilLoginProtect = getBoolean("settings.misc.extra-yggdrasil-service.login-protect", extraYggdrasilLoginProtect);
|
||||
extraYggdrasilServiceList = getList("settings.misc.extra-yggdrasil-service.urls", extraYggdrasilServiceList);
|
||||
if (extraYggdrasilService) {
|
||||
+ LeavesLogger.LOGGER.warning("extra-yggdrasil-service is an unofficial support. Enabling it may cause data security problems!");
|
||||
+ GlobalConfiguration.get().unsupportedSettings.performUsernameValidation = true; // always check user name
|
||||
+ LeavesMinecraftSessionService.initExtraYggdrasilList();
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/profile/LeavesAuthenticationService.java b/src/main/java/top/leavesmc/leaves/profile/LeavesAuthenticationService.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ee10e314a7e1af28ea008123f75caee26515b692
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/profile/LeavesAuthenticationService.java
|
||||
@@ -0,0 +1,103 @@
|
||||
+package top.leavesmc.leaves.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PaperAuthenticationService;
|
||||
+import com.google.gson.Gson;
|
||||
+import com.google.gson.GsonBuilder;
|
||||
+import com.google.gson.JsonDeserializationContext;
|
||||
+import com.google.gson.JsonDeserializer;
|
||||
+import com.google.gson.JsonElement;
|
||||
+import com.google.gson.JsonObject;
|
||||
+import com.google.gson.JsonParseException;
|
||||
+import com.google.gson.JsonSerializationContext;
|
||||
+import com.google.gson.JsonSerializer;
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
+import com.mojang.authlib.exceptions.AuthenticationException;
|
||||
+import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
|
||||
+import com.mojang.authlib.exceptions.InsufficientPrivilegesException;
|
||||
+import com.mojang.authlib.exceptions.InvalidCredentialsException;
|
||||
+import com.mojang.authlib.exceptions.UserBannedException;
|
||||
+import com.mojang.authlib.exceptions.UserMigratedException;
|
||||
+import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
+import com.mojang.authlib.properties.PropertyMap;
|
||||
+import com.mojang.authlib.yggdrasil.response.HasJoinedMinecraftServerResponse;
|
||||
+import com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||
+import com.mojang.util.UUIDTypeAdapter;
|
||||
+import org.apache.commons.lang3.StringUtils;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.Type;
|
||||
+import java.net.Proxy;
|
||||
+import java.net.URL;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+public class LeavesAuthenticationService extends PaperAuthenticationService {
|
||||
+
|
||||
+ protected final Gson gson;
|
||||
+
|
||||
+ public LeavesAuthenticationService(Proxy proxy) {
|
||||
+ super(proxy);
|
||||
+
|
||||
+ GsonBuilder builder = new GsonBuilder();
|
||||
+ builder.registerTypeAdapter(GameProfile.class, new GameProfileSerializer());
|
||||
+ builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
|
||||
+ builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
|
||||
+ builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new ProfileSearchResultsResponse.Serializer());
|
||||
+ this.gson = builder.create();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public MinecraftSessionService createMinecraftSessionService() {
|
||||
+ return new LeavesMinecraftSessionService(this, this.environment);
|
||||
+ }
|
||||
+
|
||||
+ public HasJoinedMinecraftServerResponse makeHasJoinResponse(URL url) throws AuthenticationException {
|
||||
+ try {
|
||||
+ String jsonResult = performGetRequest(url, null);
|
||||
+ HasJoinedMinecraftServerResponse result = this.gson.fromJson(jsonResult, HasJoinedMinecraftServerResponse.class);
|
||||
+ if (result == null) {
|
||||
+ return null;
|
||||
+ } else if (StringUtils.isNotBlank(result.getError())) {
|
||||
+ if ("UserMigratedException".equals(result.getCause())) {
|
||||
+ throw new UserMigratedException(result.getErrorMessage());
|
||||
+ } else if ("ForbiddenOperationException".equals(result.getError())) {
|
||||
+ throw new InvalidCredentialsException(result.getErrorMessage());
|
||||
+ } else if ("InsufficientPrivilegesException".equals(result.getError())) {
|
||||
+ throw new InsufficientPrivilegesException(result.getErrorMessage());
|
||||
+ } else if ("multiplayer.access.banned".equals(result.getError())) {
|
||||
+ throw new UserBannedException();
|
||||
+ } else {
|
||||
+ throw new AuthenticationException(result.getErrorMessage());
|
||||
+ }
|
||||
+ } else {
|
||||
+ return result;
|
||||
+ }
|
||||
+ } catch (IllegalStateException | JsonParseException | IOException var7) {
|
||||
+ throw new AuthenticationUnavailableException("Cannot contact authentication server", var7);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> {
|
||||
+ private GameProfileSerializer() {
|
||||
+ }
|
||||
+
|
||||
+ public GameProfile deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
+ JsonObject object = (JsonObject)json;
|
||||
+ UUID id = object.has("id") ? (UUID)context.deserialize(object.get("id"), UUID.class) : null;
|
||||
+ String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
|
||||
+ return new GameProfile(id, name);
|
||||
+ }
|
||||
+
|
||||
+ public JsonElement serialize(GameProfile src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
+ JsonObject result = new JsonObject();
|
||||
+ if (src.getId() != null) {
|
||||
+ result.add("id", context.serialize(src.getId()));
|
||||
+ }
|
||||
+
|
||||
+ if (src.getName() != null) {
|
||||
+ result.addProperty("name", src.getName());
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/profile/LeavesMinecraftSessionService.java b/src/main/java/top/leavesmc/leaves/profile/LeavesMinecraftSessionService.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fc39aa3c97118a3796f10951145f17ad696a79cb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/profile/LeavesMinecraftSessionService.java
|
||||
@@ -0,0 +1,101 @@
|
||||
+package top.leavesmc.leaves.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PaperMinecraftSessionService;
|
||||
+import com.google.gson.JsonParseException;
|
||||
+import com.mojang.authlib.Environment;
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
+import com.mojang.authlib.HttpAuthenticationService;
|
||||
+import com.mojang.authlib.exceptions.AuthenticationException;
|
||||
+import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
|
||||
+import com.mojang.authlib.exceptions.InsufficientPrivilegesException;
|
||||
+import com.mojang.authlib.exceptions.InvalidCredentialsException;
|
||||
+import com.mojang.authlib.exceptions.UserBannedException;
|
||||
+import com.mojang.authlib.exceptions.UserMigratedException;
|
||||
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
+import com.mojang.authlib.yggdrasil.response.HasJoinedMinecraftServerResponse;
|
||||
+import com.mojang.authlib.yggdrasil.response.Response;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.apache.commons.lang3.StringUtils;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.bot.ServerBot;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+import java.net.InetAddress;
|
||||
+import java.net.URL;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class LeavesMinecraftSessionService extends PaperMinecraftSessionService {
|
||||
+
|
||||
+ protected LeavesMinecraftSessionService(LeavesAuthenticationService authenticationService, Environment environment) {
|
||||
+ super(authenticationService, environment);
|
||||
+ }
|
||||
+
|
||||
+ private static List<URL> extraYggdrasilList = List.of();
|
||||
+
|
||||
+ public static void initExtraYggdrasilList() {
|
||||
+ List<URL> list = new ArrayList<>();
|
||||
+ for (String str : LeavesConfig.extraYggdrasilServiceList) {
|
||||
+ list.add(HttpAuthenticationService.constantURL(str + "/sessionserver/session/minecraft/hasJoined"));
|
||||
+ }
|
||||
+ extraYggdrasilList = Collections.unmodifiableList(list);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public LeavesAuthenticationService getAuthenticationService() {
|
||||
+ return (LeavesAuthenticationService) super.getAuthenticationService();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public GameProfile hasJoinedServer(GameProfile user, String serverId, InetAddress address) throws AuthenticationUnavailableException {
|
||||
+ GameProfile result = super.hasJoinedServer(user, serverId, address); // mojang result
|
||||
+
|
||||
+ ServerPlayer player = MinecraftServer.getServer().getPlayerList().getPlayerByName(user.getName());
|
||||
+ if (player != null && !(player instanceof ServerBot)) {
|
||||
+ return null; // if it has same name, return null
|
||||
+ }
|
||||
+
|
||||
+ if (LeavesConfig.extraYggdrasilService && result == null) {
|
||||
+ Map<String, Object> arguments = new HashMap<>();
|
||||
+ arguments.put("username", user.getName());
|
||||
+ arguments.put("serverId", serverId);
|
||||
+ if (address != null) {
|
||||
+ arguments.put("ip", address.getHostAddress());
|
||||
+ }
|
||||
+
|
||||
+ GameProfile cache = null;
|
||||
+ if (LeavesConfig.extraYggdrasilLoginProtect) {
|
||||
+ cache = MinecraftServer.getServer().services.profileCache().getProfileIfCached(user.getName());
|
||||
+ }
|
||||
+
|
||||
+ for (URL checkUrl : extraYggdrasilList) {
|
||||
+ URL url = HttpAuthenticationService.concatenateURL(checkUrl, HttpAuthenticationService.buildQuery(arguments));
|
||||
+
|
||||
+ try {
|
||||
+ HasJoinedMinecraftServerResponse response = this.getAuthenticationService().makeHasJoinResponse(url);
|
||||
+ if (response != null && response.getId() != null) {
|
||||
+ if (LeavesConfig.extraYggdrasilLoginProtect && cache != null) {
|
||||
+ if (response.getId() != cache.getId()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ result = new GameProfile(response.getId(), user.getName());
|
||||
+ if (response.getProperties() != null) {
|
||||
+ result.getProperties().putAll(response.getProperties());
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+ } catch (AuthenticationUnavailableException var8) {
|
||||
+ throw var8;
|
||||
+ } catch (AuthenticationException ignored) {
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Xaero Map Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index d29db001f12c072fbba1f981ca02880cb39cf62e..7bb6b4da0495b2ad5a95e858f01577afe157d470 100644
|
||||
index 9cf607051794f673102dbb4dc887aafabb6e291f..16ce16049f6ee6d989606495d022af6ff893a695 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1310,6 +1310,7 @@ public abstract class PlayerList {
|
||||
@@ -1298,6 +1298,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()));
|
||||
@@ -18,21 +18,21 @@ index d29db001f12c072fbba1f981ca02880cb39cf62e..7bb6b4da0495b2ad5a95e858f01577af
|
||||
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||
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..01c370ec64835fdd038256560f89ed251b3d3d6d
|
||||
index 0000000000000000000000000000000000000000..00c88fed3cea58d5f39d6af8f9575524d5283967
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
@@ -0,0 +1,39 @@
|
||||
@@ -0,0 +1,42 @@
|
||||
+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.LeavesConfig;
|
||||
+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";
|
||||
@@ -53,11 +53,14 @@ index 0000000000000000000000000000000000000000..01c370ec64835fdd038256560f89ed25
|
||||
+
|
||||
+ public static void onSendWorldInfo(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.xaeroMapProtocol) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeInt(LeavesConfig.xaeroMapServerID);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf -> {
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeInt(LeavesConfig.xaeroMapServerID);
|
||||
+ });
|
||||
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf -> {
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeInt(LeavesConfig.xaeroMapServerID);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
212
patches/server/0055-Leaves-Extra-Yggdrasil-Service.patch
Normal file
212
patches/server/0055-Leaves-Extra-Yggdrasil-Service.patch
Normal file
@@ -0,0 +1,212 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 2 Feb 2023 16:01:18 +0800
|
||||
Subject: [PATCH] Leaves Extra Yggdrasil Service
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
index 48e774677edf17d4a99ae9ed23d1b371dab41abb..21409ff86db65c00d92bff9eae8bdeb3a872a361 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
@@ -11,7 +11,7 @@ import java.net.Proxy;
|
||||
|
||||
public class PaperAuthenticationService extends YggdrasilAuthenticationService {
|
||||
|
||||
- private final Environment environment;
|
||||
+ protected final Environment environment; // Leaves - private -> protected
|
||||
|
||||
public PaperAuthenticationService(Proxy proxy) {
|
||||
super(proxy);
|
||||
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java
|
||||
index f1e7c7f0fa1d6a8f61de4215eabc121ab2a0b67f..91e07f127361bd573ccd59f37fcba93b300c289a 100644
|
||||
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java
|
||||
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java
|
||||
@@ -44,7 +44,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class YggdrasilMinecraftSessionService implements MinecraftSessionService {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(YggdrasilMinecraftSessionService.class);
|
||||
- private final MinecraftClient client;
|
||||
+ protected final MinecraftClient client; // Leaves - private -> protected
|
||||
private final ServicesKeySet servicesKeySet;
|
||||
private final String baseUrl;
|
||||
private final URL joinUrl;
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index ec268189b19b6fa5c4521f96ce211a531db35ec5..24376290ac1d5f5e140ff06b23f9711b38de362e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -201,7 +201,7 @@ public class Main {
|
||||
file = new File(bukkitConfiguration.getString("settings.world-container", "."));
|
||||
}
|
||||
// Paper end - fix SPIGOT-5824
|
||||
- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper
|
||||
+ Services services = Services.create(new top.leavesmc.leaves.profile.LeavesAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper // Leaves - extra-yggdrasil-service
|
||||
// CraftBukkit start
|
||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3f4b4d905ff440eaf4a66b10ad85933c0b07dc58..7dec27260fce938f5d1e5c437f564ed9cee575f3 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -253,7 +253,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private boolean isDemo;
|
||||
private volatile boolean isReady;
|
||||
private long lastOverloadWarning;
|
||||
- protected final Services services;
|
||||
+ public final Services services; // Leaves - protected -> public
|
||||
private long lastServerStatus;
|
||||
public final Thread serverThread;
|
||||
private long nextTickTime;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index fccce21591136beac85a41bd1b4df3cc5569faf0..517e0c8d362bf6004e51109dfcb20562d00d4903 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import top.leavesmc.leaves.command.LeavesCommand;
|
||||
import top.leavesmc.leaves.bot.BotCommand;
|
||||
import top.leavesmc.leaves.bot.agent.Actions;
|
||||
+import top.leavesmc.leaves.profile.LeavesMinecraftSessionService;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -527,6 +528,9 @@ public final class LeavesConfig {
|
||||
extraYggdrasilLoginProtect = getBoolean("settings.misc.extra-yggdrasil-service.login-protect", extraYggdrasilLoginProtect);
|
||||
extraYggdrasilServiceList = getList("settings.misc.extra-yggdrasil-service.urls", extraYggdrasilServiceList);
|
||||
if (extraYggdrasilService) {
|
||||
+ LeavesLogger.LOGGER.warning("extra-yggdrasil-service is an unofficial support. Enabling it may cause data security problems!");
|
||||
+ GlobalConfiguration.get().unsupportedSettings.performUsernameValidation = true; // always check user name
|
||||
+ LeavesMinecraftSessionService.initExtraYggdrasilList();
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/profile/LeavesAuthenticationService.java b/src/main/java/top/leavesmc/leaves/profile/LeavesAuthenticationService.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3da207a13fce243bf880c8a4f7054cf20997991d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/profile/LeavesAuthenticationService.java
|
||||
@@ -0,0 +1,18 @@
|
||||
+package top.leavesmc.leaves.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PaperAuthenticationService;
|
||||
+import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
+
|
||||
+import java.net.Proxy;
|
||||
+
|
||||
+public class LeavesAuthenticationService extends PaperAuthenticationService {
|
||||
+
|
||||
+ public LeavesAuthenticationService(Proxy proxy) {
|
||||
+ super(proxy);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public MinecraftSessionService createMinecraftSessionService() {
|
||||
+ return new LeavesMinecraftSessionService(this.getServicesKeySet(), this.getProxy(), this.environment);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/profile/LeavesMinecraftSessionService.java b/src/main/java/top/leavesmc/leaves/profile/LeavesMinecraftSessionService.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9bfa0d0c12ac2a44968cd39b6d9f406defb23c07
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/profile/LeavesMinecraftSessionService.java
|
||||
@@ -0,0 +1,102 @@
|
||||
+package top.leavesmc.leaves.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PaperMinecraftSessionService;
|
||||
+import com.mojang.authlib.Environment;
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
+import com.mojang.authlib.HttpAuthenticationService;
|
||||
+import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
|
||||
+import com.mojang.authlib.exceptions.MinecraftClientException;
|
||||
+import com.mojang.authlib.yggdrasil.ProfileActionType;
|
||||
+import com.mojang.authlib.yggdrasil.ProfileResult;
|
||||
+import com.mojang.authlib.yggdrasil.ServicesKeySet;
|
||||
+import com.mojang.authlib.yggdrasil.response.HasJoinedMinecraftServerResponse;
|
||||
+import com.mojang.authlib.yggdrasil.response.ProfileAction;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.bot.ServerBot;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.net.Proxy;
|
||||
+import java.net.URL;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+import java.util.stream.Collectors;
|
||||
+
|
||||
+public class LeavesMinecraftSessionService extends PaperMinecraftSessionService {
|
||||
+
|
||||
+ protected LeavesMinecraftSessionService(ServicesKeySet keySet, Proxy authenticationService, Environment environment) {
|
||||
+ super(keySet, authenticationService, environment);
|
||||
+ }
|
||||
+
|
||||
+ private static List<URL> extraYggdrasilList = List.of();
|
||||
+
|
||||
+ public static void initExtraYggdrasilList() {
|
||||
+ List<URL> list = new ArrayList<>();
|
||||
+ for (String str : LeavesConfig.extraYggdrasilServiceList) {
|
||||
+ list.add(HttpAuthenticationService.constantURL(str + "/sessionserver/session/minecraft/hasJoined"));
|
||||
+ }
|
||||
+ extraYggdrasilList = Collections.unmodifiableList(list);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public ProfileResult hasJoinedServer(String profileName, String serverId, @Nullable InetAddress address) throws AuthenticationUnavailableException {
|
||||
+ ProfileResult result = super.hasJoinedServer(profileName, serverId, address); // mojang
|
||||
+
|
||||
+ ServerPlayer player = MinecraftServer.getServer().getPlayerList().getPlayerByName(profileName);
|
||||
+ if (player != null && !(player instanceof ServerBot)) {
|
||||
+ return null; // if it has same name, return null
|
||||
+ }
|
||||
+
|
||||
+ if (LeavesConfig.extraYggdrasilService && result == null) {
|
||||
+ final Map<String, Object> arguments = new HashMap<>();
|
||||
+ arguments.put("username", profileName);
|
||||
+ arguments.put("serverId", serverId);
|
||||
+
|
||||
+ if (address != null) {
|
||||
+ arguments.put("ip", address.getHostAddress());
|
||||
+ }
|
||||
+
|
||||
+ GameProfile cache = null;
|
||||
+ if (LeavesConfig.extraYggdrasilLoginProtect) {
|
||||
+ cache = MinecraftServer.getServer().services.profileCache().getProfileIfCached(profileName);
|
||||
+ }
|
||||
+
|
||||
+ for (URL checkUrl : extraYggdrasilList) {
|
||||
+ URL url = HttpAuthenticationService.concatenateURL(checkUrl, HttpAuthenticationService.buildQuery(arguments));
|
||||
+ try {
|
||||
+ final HasJoinedMinecraftServerResponse response = client.get(url, HasJoinedMinecraftServerResponse.class);
|
||||
+ if (response != null && response.id() != null) {
|
||||
+ if (LeavesConfig.extraYggdrasilLoginProtect && cache != null) {
|
||||
+ if (response.id() != cache.getId()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ final GameProfile result1 = new GameProfile(response.id(), profileName);
|
||||
+
|
||||
+ if (response.properties() != null) {
|
||||
+ result1.getProperties().putAll(response.properties());
|
||||
+ }
|
||||
+
|
||||
+ final Set<ProfileActionType> profileActions = response.profileActions().stream()
|
||||
+ .map(ProfileAction::type)
|
||||
+ .collect(Collectors.toSet());
|
||||
+ return new ProfileResult(result1, profileActions);
|
||||
+ }
|
||||
+ } catch (final MinecraftClientException e) {
|
||||
+ if (e.toAuthenticationException() instanceof final AuthenticationUnavailableException unavailable) {
|
||||
+ throw unavailable;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Use vanilla random config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6da800990ab752d6a2f9ad97b91aad90ab47549f..a8e00561ab37f932767b5f6448879acea4e896b4 100644
|
||||
index 0b7639ef2540f8af2e5b5fc47df24d2e5ffd0846..4b1a08fa9a9d34c40b4fee601495528ea1c5095d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -569,7 +569,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -510,7 +510,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
@@ -44,7 +44,7 @@ index f60c4cd0543fd5d50fa7e2c1a9e8381227adb540..8c9c694744951dc11b9f8828f27e4d4a
|
||||
}
|
||||
|
||||
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 0e40f8fc0357ae936c8b37942d1df9cb21075a98..ef6c0e51f2f971f30fce36b5502daa5b5bbf1b26 100644
|
||||
index e2f3044ce964f0da9df83b8a302316d2438384e7..5eb9d599e2f6e61adb34c991fe9008859633fdfc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -71,7 +71,13 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -5,28 +5,28 @@ Subject: [PATCH] Fix update suppression crash
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
index d2f0a0755317f5fa9a1ccf7db346aa77fd287d80..9c7fb1b7c2ff458e72bdcfa80c49252cd78e7d14 100644
|
||||
index 8055ebf912ea595b6c70c6e6fcda14f3b2516077..f666ae4df36ed57368082e47786ab6ba4148d9c7 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
@@ -49,6 +49,10 @@ public class PacketUtils {
|
||||
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
|
||||
try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
|
||||
@@ -50,6 +50,10 @@ public class PacketUtils {
|
||||
if (listener.shouldHandleMessage(packet)) {
|
||||
try {
|
||||
packet.handle(listener);
|
||||
+ // Leaves start - update suppression crash fix
|
||||
+ } catch (top.leavesmc.leaves.util.UpdateSuppressionException exception) {
|
||||
+ top.leavesmc.leaves.LeavesLogger.LOGGER.info(exception.getMessage());
|
||||
+ // Leaves start - update suppression crash fix
|
||||
} catch (Exception exception) {
|
||||
if (listener.shouldPropagateHandlingExceptions()) {
|
||||
throw exception;
|
||||
if (exception instanceof ReportedException) {
|
||||
ReportedException reportedexception = (ReportedException) exception;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 43638595413bbcc5dcaf04daa8c1df05c42c9f4f..eacdae0f90a4d09d2cd978c65b783d1329aba41c 100644
|
||||
index 7dec27260fce938f5d1e5c437f564ed9cee575f3..8c0b428ef004d87be0748584ae6a0557d43bc946 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1560,7 +1560,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1529,7 +1529,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.push("tick");
|
||||
|
||||
try {
|
||||
worldserver.timings.doTick.startTiming(); // Spigot
|
||||
- worldserver.tick(shouldKeepTicking);
|
||||
+ // Leaves start
|
||||
+ try {
|
||||
@@ -39,23 +39,23 @@ index 43638595413bbcc5dcaf04daa8c1df05c42c9f4f..eacdae0f90a4d09d2cd978c65b783d13
|
||||
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
|
||||
regionManager.recalculateRegions();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
index b51155ad12515b2d0dd0f202580b9f455c114d9a..49a4a19fd5292552e91799203108084ff4c1fa29 100644
|
||||
index d5fe3b8e2f5a8899f6afeb0600764284a617f261..66f652724d1a4a27d75cd2f15c0a50879d5bafc5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
@@ -253,7 +253,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
||||
@@ -249,7 +249,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
||||
|
||||
@Override
|
||||
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
|
||||
- return AbstractContainerMenu.getRedstoneSignalFromContainer((Container)world.getBlockEntity(pos));
|
||||
- return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
+ // Leaves start - fix update suppression crash
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.updateSuppressionCrashFix) {
|
||||
+ try {
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromContainer((Container)world.getBlockEntity(pos));
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
+ } catch (ClassCastException ex) {
|
||||
+ throw new top.leavesmc.leaves.util.UpdateSuppressionException(null, pos);
|
||||
+ }
|
||||
+ } else {
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromContainer((Container)world.getBlockEntity(pos));
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
+ }
|
||||
+ // Leaves end - fix update suppression crash
|
||||
}
|
||||
@@ -5,22 +5,22 @@ Subject: [PATCH] Bedrock break list
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index eacdae0f90a4d09d2cd978c65b783d1329aba41c..5c09e2164a045346e0e2d4ce64408ac9209cf501 100644
|
||||
index 8c0b428ef004d87be0748584ae6a0557d43bc946..fccb76a8dfa6a0c5d704a0a8f7392beedea320c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1610,6 +1610,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1573,6 +1573,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.popPush("server gui refresh");
|
||||
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.tick(); // Leaves - bbor
|
||||
top.leavesmc.leaves.protocol.AppleSkinProtocol.tick(); // Leaves - appleskin
|
||||
top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
|
||||
+ top.leavesmc.leaves.util.BreakBedrockList.endTick(); // Leaves - break bedrock list
|
||||
|
||||
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
||||
for (int i = 0; i < this.tickables.size(); ++i) {
|
||||
((Runnable) this.tickables.get(i)).run();
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
index 3a4a0727ad44322e3ba85512cd077808dab080b7..4a1a5f5c4672262875caa17bc7da8aa221b82742 100644
|
||||
index 03d13c2425170a6513ea7442a4a12fc9aa6e211d..c54b8779e099b642bbbbb9f380377a167ebf25cb 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
@@ -132,6 +132,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -135,6 +135,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@Override
|
||||
public void onObjectiveAdded(Objective objective) {
|
||||
super.onObjectiveAdded(objective);
|
||||
@@ -28,7 +28,7 @@ index 3a4a0727ad44322e3ba85512cd077808dab080b7..4a1a5f5c4672262875caa17bc7da8aa2
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -148,6 +149,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -151,6 +152,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@Override
|
||||
public void onObjectiveRemoved(Objective objective) {
|
||||
super.onObjectiveRemoved(objective);
|
||||
@@ -37,7 +37,7 @@ index 3a4a0727ad44322e3ba85512cd077808dab080b7..4a1a5f5c4672262875caa17bc7da8aa2
|
||||
this.stopTrackingObjective(objective);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index 58d1f76544d7a8d196f75438579266664e5d7404..63b512283b2f5a96a78fe55d68e7373250367cdb 100644
|
||||
index 5acf0e1fba2967e67bdb208ef73ae8fa84ffe35d..8c48d6815150ae21522c0b99c8eac08c01b2aa38 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -92,6 +92,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable distance check for UseItemOnPacket
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b2be14056502a902f8fd2caaacaffc5d01776051..0b5bea46ed8695cd50d37cecf0d37417661e7121 100644
|
||||
index 6c704b32091b2d7db742e1a68404ba6db1f9154f..bc7f38c4bd20d6f77b2decee73965a9cf5c1f89d 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2012,7 +2012,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -1895,7 +1895,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
Vec3 vec3d2 = vec3d.subtract(vec3d1);
|
||||
double d0 = 1.0000001D;
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Fri, 2 Jun 2023 17:30:48 +0800
|
||||
Subject: [PATCH] Fix hoppers incorrect update
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
||||
index c8e7e82dd81d9faf8f06612291c40f541304eb82..f4e36bf88b1b6f044a1bb8f1785d57e52b6c8963 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
||||
@@ -123,7 +123,7 @@ public class HopperBlock extends BaseEntityBlock {
|
||||
@Override
|
||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
if (!oldState.is(state.getBlock())) {
|
||||
- this.checkPoweredState(world, pos, state, 2);
|
||||
+ this.checkPoweredState(world, pos, state, 2, true); // Leaves - special check
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,13 +147,18 @@ public class HopperBlock extends BaseEntityBlock {
|
||||
this.checkPoweredState(world, pos, state, 4);
|
||||
}
|
||||
|
||||
+ // Leaves start - special check
|
||||
private void checkPoweredState(Level world, BlockPos pos, BlockState state, int flags) {
|
||||
+ checkPoweredState(world, pos, state, flags, false);
|
||||
+ }
|
||||
+
|
||||
+ private void checkPoweredState(Level world, BlockPos pos, BlockState state, int flags, boolean isPlace) {
|
||||
boolean bl = !world.hasNeighborSignal(pos);
|
||||
if (bl != state.getValue(ENABLED)) {
|
||||
- world.setBlock(pos, state.setValue(ENABLED, Boolean.valueOf(bl)), flags);
|
||||
+ world.setBlock(pos, state.setValue(ENABLED, Boolean.valueOf(bl)), flags, isPlace ? 0 : 512);
|
||||
}
|
||||
-
|
||||
}
|
||||
+ // Leaves end - special check
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Redstone wire dont connect if on trapdoor
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 70544dac18381ab3fa8ddfa7d276a4ef03f9b191..57fbbc2b6293c3b81aad8a263139e5537a0fc8ac 100644
|
||||
index 2b054439b7a763d5a3fbb5dbfe197cb9a9a3525c..9f56f20032ff590bc3ce82f74c26095cde79a549 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -226,7 +226,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable check out-of-order command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 3c9bb5ca6ff709acff498f49d5ae4e31414751b9..e3bbf4f1889688a8306a48b4f4abd3e4d8510816 100644
|
||||
index bc7f38c4bd20d6f77b2decee73965a9cf5c1f89d..f5f80646848c47d047e97d1ef2a8000d0eaa4fc0 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2416,7 +2416,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2238,7 +2238,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
|
||||
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Despawn enderman with block
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 0cd7d8dc3e7d17bbafe7c06e864cb6c52a9fa876..326eb5d31c2a6772e413b6ef51186929a34ff9d0 100644
|
||||
index a8867058fb09fd4c6b965b91d5f406b2a1b7035a..acc18cbd9e2b81857dba23fb198d5afbf8e218a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -479,7 +479,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@@ -486,7 +486,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean requiresCustomPersistence() {
|
||||
143
patches/server/0066-Leaves-carpet-support.patch
Normal file
143
patches/server/0066-Leaves-carpet-support.patch
Normal file
@@ -0,0 +1,143 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Tue, 27 Jun 2023 01:54:43 +0800
|
||||
Subject: [PATCH] Leaves carpet support
|
||||
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 517e0c8d362bf6004e51109dfcb20562d00d4903..b10e20e7b504d15d1388fa620b8021a0652b5b3e 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -13,6 +13,8 @@ import top.leavesmc.leaves.bot.BotCommand;
|
||||
import top.leavesmc.leaves.bot.agent.Actions;
|
||||
import top.leavesmc.leaves.profile.LeavesMinecraftSessionService;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
+import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule;
|
||||
+import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -607,6 +609,8 @@ public final class LeavesConfig {
|
||||
}
|
||||
|
||||
public static void registerCarpetRules() {
|
||||
+ CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", creativeNoClip));
|
||||
+ CarpetRules.register(CarpetRule.of("pca", "avoidAnvilTooExpensive", avoidAnvilTooExpensive));
|
||||
}
|
||||
|
||||
public static boolean creativeNoClip = false;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ee51971365431be1f564e9e204e4beee85799fc2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
@@ -0,0 +1,109 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+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.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.LeavesLogger;
|
||||
+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.Map;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "carpet")
|
||||
+public class CarpetServerProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "carpet";
|
||||
+ public static final String VERSION = "leaves-carpet-1.0.0";
|
||||
+
|
||||
+ private static final ResourceLocation HELLO_ID = CarpetServerProtocol.id("hello");
|
||||
+
|
||||
+ private static final int HI = 69;
|
||||
+ private static final int HELLO = 420;
|
||||
+ private static final int DATA = 1;
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (LeavesConfig.leavesCarpetSupport) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, new CarpetHelloPayload(HI, VERSION, new CompoundTag()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = CarpetHelloPayload.class, payloadId = "hello")
|
||||
+ private static void handleHello(@NotNull ServerPlayer player, @NotNull CarpetHelloPayload payload) {
|
||||
+ if (LeavesConfig.leavesCarpetSupport) {
|
||||
+ if (payload.helloId == HELLO) {
|
||||
+ LeavesLogger.LOGGER.info("Player " + player.getScoreboardName() + " joined with carpet " + payload.version);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, HELLO_ID, CarpetRules::write);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class CarpetRules {
|
||||
+
|
||||
+ private static final Map<String, CarpetRule> rules = new HashMap<>();
|
||||
+
|
||||
+ public static void write(@NotNull FriendlyByteBuf buf) {
|
||||
+ buf.writeVarInt(DATA);
|
||||
+
|
||||
+ CompoundTag rulesNbt = new CompoundTag();
|
||||
+ rules.values().forEach(rule -> rule.writeNBT(rulesNbt));
|
||||
+
|
||||
+ CompoundTag tag = new CompoundTag();
|
||||
+ tag.put("Rules", rulesNbt);
|
||||
+ buf.writeNbt(tag);
|
||||
+ }
|
||||
+
|
||||
+ public static void register(CarpetRule rule) {
|
||||
+ rules.put(rule.name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record CarpetRule(String identifier, String name, String value) {
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Contract("_, _, _ -> new")
|
||||
+ public static CarpetRule of(String identifier, String name, boolean value) {
|
||||
+ return new CarpetRule(identifier, name, Boolean.toString(value));
|
||||
+ }
|
||||
+
|
||||
+ public void writeNBT(@NotNull CompoundTag rules) {
|
||||
+ CompoundTag rule = new CompoundTag();
|
||||
+ rule.putString("Value", value);
|
||||
+ rule.putString("Manager", identifier);
|
||||
+ rule.putString("Rule", name);
|
||||
+ rules.put(name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record CarpetHelloPayload(int helloId, String version, CompoundTag nbt) implements CustomPacketPayload {
|
||||
+
|
||||
+ public CarpetHelloPayload(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
+ this(buf.readVarInt(), buf.readUtf(64), buf.readNbt());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(FriendlyByteBuf buf) {
|
||||
+ buf.writeVarInt(helloId);
|
||||
+ buf.writeUtf(version);
|
||||
+ buf.writeNbt(nbt);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public ResourceLocation id() {
|
||||
+ return HELLO_ID;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Creative fly no clip
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 58152160d609d0e9d105153aeb166a56a7955603..352ef747063f9cb1a26bf906f8cb52351ec4ae1d 100644
|
||||
index d58b4c0dbe651b5068212e5f14dce3164ee520f5..4aa241f2ef7f27e9c9cf5ea3bbb1c4b389ce887c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -242,8 +242,8 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -243,8 +243,8 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -19,16 +19,16 @@ index 58152160d609d0e9d105153aeb166a56a7955603..352ef747063f9cb1a26bf906f8cb5235
|
||||
this.setOnGround(false);
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -416,7 +416,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
Pose entitypose1;
|
||||
|
||||
- if (!this.isSpectator() && !this.isPassenger() && !this.canEnterPose(entitypose)) {
|
||||
+ if (!this.isCreativeFlyOrSpectator() && !this.isPassenger() && !this.canEnterPose(entitypose)) { // Leaves - creative no clip
|
||||
if (this.canEnterPose(Pose.CROUCHING)) {
|
||||
- if (!this.isSpectator() && !this.isPassenger() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(entitypose)) {
|
||||
+ if (!this.isCreativeFlyOrSpectator() && !this.isPassenger() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(entitypose)) { // Leaves - creative no clip
|
||||
if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING)) {
|
||||
entitypose1 = Pose.CROUCHING;
|
||||
} else {
|
||||
@@ -576,7 +576,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -581,7 +581,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
this.bob += (f - this.bob) * 0.4F;
|
||||
@@ -37,7 +37,7 @@ index 58152160d609d0e9d105153aeb166a56a7955603..352ef747063f9cb1a26bf906f8cb5235
|
||||
AABB axisalignedbb;
|
||||
|
||||
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
||||
@@ -2130,6 +2130,12 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2136,6 +2136,12 @@ public abstract class Player extends LivingEntity {
|
||||
@Override
|
||||
public abstract boolean isSpectator();
|
||||
|
||||
@@ -51,12 +51,12 @@ index 58152160d609d0e9d105153aeb166a56a7955603..352ef747063f9cb1a26bf906f8cb5235
|
||||
public boolean canBeHitByProjectile() {
|
||||
return !this.isSpectator() && super.canBeHitByProjectile();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
index 25a9c38c60d183bb65b14f4d7550ab98b431c218..118a5b4c0a5268d52c69b0cfd061dbccfacf81b4 100644
|
||||
index 5c311270a39f6b4996c8b58822d24556c67adc41..cb40179236952edcc1678a58a5886b1916349314 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
@@ -151,7 +151,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
@@ -162,7 +162,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity.getPistonPushReaction() != PushReaction.IGNORE) {
|
||||
+ if (entity.getPistonPushReaction() != PushReaction.IGNORE && !(entity instanceof Player player && player.isCreativeFlyOrSpectator())) { // Leaves - creative no clip
|
||||
@@ -1,156 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Tue, 27 Jun 2023 01:54:43 +0800
|
||||
Subject: [PATCH] Leaves carpet support
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index e3bbf4f1889688a8306a48b4f4abd3e4d8510816..4a12e0a1aed4db5453b7fb1e14ae03bc9e1e2b4e 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3642,6 +3642,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (top.leavesmc.leaves.LeavesConfig.syncmaticaProtocol && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol.PROTOCOL_ID)) {
|
||||
top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol.getCommunicationManager().onPacketGet(packet, this);
|
||||
}
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.leavesCarpetSupport && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.CarpetServerProtocol.PROTOCOL_ID)) {
|
||||
+ top.leavesmc.leaves.protocol.CarpetServerProtocol.handlePacket(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);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 7bb6b4da0495b2ad5a95e858f01577afe157d470..a137b9bff6595594ebe149ff766abd9edea04294 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -363,6 +363,7 @@ public abstract class PlayerList {
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedIn(player); // Leaves - bbor
|
||||
top.leavesmc.leaves.protocol.JadeProtocol.onPlayerJoin(player); // Leaves - Jade
|
||||
top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedIn(player); // Leaves - appleskin
|
||||
+ top.leavesmc.leaves.protocol.CarpetServerProtocol.onPlayerJoin(player); // Leaves - carpet
|
||||
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index a60c13ddbc4e9147324e8442ff48974f6dd35dbf..296aa94bb0bf21d1c6c1bed7aa791bc611cd8b2a 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -14,6 +14,8 @@ import top.leavesmc.leaves.bot.agent.Actions;
|
||||
import top.leavesmc.leaves.profile.LeavesMinecraftSessionService;
|
||||
import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
+import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule;
|
||||
+import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -609,6 +611,8 @@ public final class LeavesConfig {
|
||||
}
|
||||
|
||||
public static void registerCarpetRules() {
|
||||
+ CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", creativeNoClip));
|
||||
+ CarpetRules.register(CarpetRule.of("pca", "avoidAnvilTooExpensive", avoidAnvilTooExpensive));
|
||||
}
|
||||
|
||||
public static boolean creativeNoClip = false;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9c13a3b7d2321dc59beec6e220790d1df0728c16
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
@@ -0,0 +1,96 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.LeavesLogger;
|
||||
+import top.leavesmc.leaves.util.ProtocolUtils;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class CarpetServerProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "carpet";
|
||||
+
|
||||
+ private static final ResourceLocation HELLO_ID = id("hello"); // why?????????????
|
||||
+
|
||||
+ private static final int HI = 69;
|
||||
+ private static final int HELLO = 420;
|
||||
+ private static final int DATA = 1;
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void handlePacket(ServerPlayer player, @NotNull ServerboundCustomPayloadPacket packet) {
|
||||
+ if (packet.identifier.equals(HELLO_ID)) {
|
||||
+ FriendlyByteBuf data = packet.data;
|
||||
+ if (data.readVarInt() == HELLO) {
|
||||
+ handleHello(player, data);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void handleHello(@NotNull ServerPlayer player, @NotNull FriendlyByteBuf data) {
|
||||
+ LeavesLogger.LOGGER.info("Player " + player.getScoreboardName() + " joined with carpet " + data.readUtf(64));
|
||||
+ ProtocolUtils.sendPayloadPacket(player, HELLO_ID, CarpetRules.buildBuf());
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (LeavesConfig.leavesCarpetSupport) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeVarInt(HI).writeUtf("leaves-carpet-1.0.0");
|
||||
+ ProtocolUtils.sendPayloadPacket(player, HELLO_ID, buf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class CarpetRules {
|
||||
+
|
||||
+ private static final Map<String, CarpetRule> rules = new HashMap<>();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static FriendlyByteBuf buildBuf() {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeVarInt(1);
|
||||
+
|
||||
+ CompoundTag rulesNbt = new CompoundTag();
|
||||
+ rules.values().forEach(rule -> rule.writeNBT(rulesNbt));
|
||||
+
|
||||
+ CompoundTag tag = new CompoundTag();
|
||||
+ tag.put("Rules", rulesNbt);
|
||||
+ buf.writeNbt(tag);
|
||||
+
|
||||
+ return buf;
|
||||
+ }
|
||||
+
|
||||
+ public static void register(CarpetRule rule) {
|
||||
+ rules.put(rule.name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record CarpetRule(String identifier, String name, String value) {
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Contract("_, _, _ -> new")
|
||||
+ public static CarpetRule of(String identifier, String name, boolean value) {
|
||||
+ return new CarpetRule(identifier, name, Boolean.toString(value));
|
||||
+ }
|
||||
+
|
||||
+ public void writeNBT(@NotNull CompoundTag rules) {
|
||||
+ CompoundTag rule = new CompoundTag();
|
||||
+ rule.putString("Value", value);
|
||||
+ rule.putString("Manager", identifier);
|
||||
+ rule.putString("Rule", name);
|
||||
+ rules.put(name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -18,7 +18,7 @@ index d0a047fd8849e9210dc9424325561f5a1b9998df..b665410788aa7c889dc214c2a97a9c29
|
||||
for(int j = 0; j < this.height; ++j) {
|
||||
for(int k = 0; k < this.depth; ++k) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 5b333bef255d7ef61c99510837536920c6fb6e8c..7e68f278a780188e741e2313e125a1a796d25472 100644
|
||||
index c1ff2e15bc5da1a642872ac0fdcdc457e8abb063..467ddfbb53ef4bbe92ea7372f0654fc39d2a619d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -45,6 +45,7 @@ import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase;
|
||||
@@ -97,10 +97,10 @@ index 5b333bef255d7ef61c99510837536920c6fb6e8c..7e68f278a780188e741e2313e125a1a7
|
||||
ChunkPos chunkcoordintpair = new ChunkPos(this.origin);
|
||||
|
||||
int i;
|
||||
@@ -614,6 +674,11 @@ public class EndDragonFight {
|
||||
@@ -619,6 +679,11 @@ public class EndDragonFight {
|
||||
}
|
||||
|
||||
public boolean respawnDragon(List<EndCrystal> list) { // PAIL private -> public // CraftBukkit - return boolean
|
||||
public boolean respawnDragon(List<EndCrystal> list) { // CraftBukkit - return boolean
|
||||
+ // Leaves - start optimizedDragonRespawn
|
||||
+ cachePortalChunkIteratorX = -8;
|
||||
+ cachePortalChunkIteratorZ = -8;
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Spawn ignore lc
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 81eaa7ead4821929f20e4c5fcb822504001f6f99..c85d55cc9baf69968470a0bbe56c4233ae5509a4 100644
|
||||
index 797725f7472ed36bf5a1369a7dfe600a9749cbac..7eec9dc8237ff04c53b573c3cc87e6cdbfdda7ed 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -16,7 +16,7 @@ index 81eaa7ead4821929f20e4c5fcb822504001f6f99..c85d55cc9baf69968470a0bbe56c4233
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
@@ -208,6 +209,19 @@ public final class NaturalSpawner {
|
||||
@@ -204,6 +205,19 @@ public final class NaturalSpawner {
|
||||
}
|
||||
public static int spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) {
|
||||
// Paper end - add parameters and int ret type
|
||||
@@ -36,7 +36,7 @@ index 81eaa7ead4821929f20e4c5fcb822504001f6f99..c85d55cc9baf69968470a0bbe56c4233
|
||||
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
|
||||
|
||||
if (blockposition.getY() >= world.getMinBuildHeight() + 1) {
|
||||
@@ -216,6 +230,16 @@ public final class NaturalSpawner {
|
||||
@@ -212,6 +226,16 @@ public final class NaturalSpawner {
|
||||
return 0; // Paper
|
||||
}
|
||||
|
||||
@@ -5,28 +5,28 @@ Subject: [PATCH] Elytra aeronautics no chunk load
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index b5af9f923cd722792b9597603518594281357ef6..65e4682a756ad698fefcf3e1be204cedfa3d78f7 100644
|
||||
index ed2e0774d5b14d4926b3214ebf3795d7555327e3..0434bf9b8d3b064c8426d51f9969686a188f0eaa 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -195,7 +195,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap;
|
||||
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
|
||||
@@ -133,7 +133,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper start - distance maps
|
||||
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
|
||||
|
||||
- void addPlayerToDistanceMaps(ServerPlayer player) {
|
||||
+ public void addPlayerToDistanceMaps(ServerPlayer player) { // Leaves - package -> public
|
||||
int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
@@ -141,7 +141,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.level.playerChunkLoader.addPlayer(player); // Paper - replace chunk loader
|
||||
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
||||
@@ -217,7 +217,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerGeneralAreaMap.add(player, chunkX, chunkZ, GENERAL_AREA_MAP_SQUARE_RADIUS); // Paper - optimise checkDespawn
|
||||
}
|
||||
|
||||
- void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||
+ public void removePlayerFromDistanceMaps(ServerPlayer player) { // Leaves - package -> public
|
||||
this.level.playerChunkLoader.removePlayer(player); // Paper - replace chunk loader
|
||||
|
||||
// Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
|
||||
@@ -1103,7 +1103,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
@@ -897,7 +897,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
private boolean skipPlayer(ServerPlayer player) {
|
||||
@@ -36,19 +36,19 @@ index b5af9f923cd722792b9597603518594281357ef6..65e4682a756ad698fefcf3e1be204ced
|
||||
}
|
||||
|
||||
void updatePlayerStatus(ServerPlayer player, boolean added) {
|
||||
@@ -1144,6 +1145,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
public void move(ServerPlayer player) {
|
||||
// Paper - delay this logic for the entity tracker tick, no need to duplicate it
|
||||
@@ -934,6 +935,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
+ if (player.elytraAeronauticsNoChunk) return;
|
||||
int i = SectionPos.blockToSectionCoord(player.getBlockX());
|
||||
int j = SectionPos.blockToSectionCoord(player.getBlockZ());
|
||||
SectionPos sectionposition = player.getLastSectionPos();
|
||||
public void move(ServerPlayer player) {
|
||||
+ if (player.elytraAeronauticsNoChunk) return; // Leaves - no chunk
|
||||
ObjectIterator objectiterator = this.entityMap.values().iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 4a12e0a1aed4db5453b7fb1e14ae03bc9e1e2b4e..dcfd2f0bf4ed51c6a74d9e4ec619b8b0da571ba3 100644
|
||||
index f5f80646848c47d047e97d1ef2a8000d0eaa4fc0..c4eb2ae57967f0a16ef215c43255c8f8e13424eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -655,7 +655,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -531,7 +531,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
||||
|
||||
// Paper start - Prevent moving into unloaded chunks
|
||||
@@ -58,10 +58,10 @@ index 4a12e0a1aed4db5453b7fb1e14ae03bc9e1e2b4e..dcfd2f0bf4ed51c6a74d9e4ec619b8b0
|
||||
!worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
|
||||
)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a8e00561ab37f932767b5f6448879acea4e896b4..2a3baba3e0318f67bb65dbd5adac0675102bc771 100644
|
||||
index 4b1a08fa9a9d34c40b4fee601495528ea1c5095d..46dce902751fddc2966cb804e7b0b354e04bfad5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1090,7 +1090,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1031,7 +1031,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ index a8e00561ab37f932767b5f6448879acea4e896b4..2a3baba3e0318f67bb65dbd5adac0675
|
||||
this.level().getProfiler().push("move");
|
||||
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) {
|
||||
movement = movement.multiply(this.stuckSpeedMultiplier);
|
||||
@@ -2013,6 +2019,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1970,6 +1976,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.yo = y;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, y, d4);
|
||||
@@ -85,10 +85,10 @@ index a8e00561ab37f932767b5f6448879acea4e896b4..2a3baba3e0318f67bb65dbd5adac0675
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 352ef747063f9cb1a26bf906f8cb52351ec4ae1d..25e00eaf8971da42ee26ce3f0e3ea17cfc082f1a 100644
|
||||
index 4aa241f2ef7f27e9c9cf5ea3bbb1c4b389ce887c..88e0901b7e46e59569555d8ce00f48817073ee35 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -187,6 +187,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -188,6 +188,7 @@ public abstract class Player extends LivingEntity {
|
||||
public boolean affectsSpawning = true;
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
|
||||
// Paper end
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix Paper#9372
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 2c3e286d683437c1435b76665a5f94082a1b2ec5..9966d7e1f542a2a9602381869c2c671d33a60c5a 100644
|
||||
index 7cd939bd90cf047e7bd4f894906c2af4198534d2..cd68b7b969a7b06181a7c2d92ed6a1a2a3897f3a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1256,6 +1256,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1259,6 +1259,7 @@ public class ServerPlayer extends Player {
|
||||
this.setServerLevel(worldserver);
|
||||
this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
@@ -17,7 +17,7 @@ index 2c3e286d683437c1435b76665a5f94082a1b2ec5..9966d7e1f542a2a9602381869c2c671d
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
this.triggerDimensionChangeTriggers(worldserver1);
|
||||
@@ -1972,6 +1973,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1975,6 +1976,7 @@ public class ServerPlayer extends Player {
|
||||
public void moveTo(double x, double y, double z) {
|
||||
super.moveTo(x, y, z);
|
||||
this.connection.resetPosition();
|
||||
@@ -25,7 +25,7 @@ index 2c3e286d683437c1435b76665a5f94082a1b2ec5..9966d7e1f542a2a9602381869c2c671d
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2208,6 +2210,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2214,6 +2216,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
this.connection.send(new ClientboundSetCameraPacket(this.camera));
|
||||
this.connection.resetPosition();
|
||||
@@ -33,7 +33,7 @@ index 2c3e286d683437c1435b76665a5f94082a1b2ec5..9966d7e1f542a2a9602381869c2c671d
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2660,6 +2663,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2652,6 +2655,7 @@ public class ServerPlayer extends Player {
|
||||
public void forceSetPositionRotation(double x, double y, double z, float yaw, float pitch) {
|
||||
this.moveTo(x, y, z, yaw, pitch);
|
||||
this.connection.resetPosition();
|
||||
@@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Mon, 3 Jul 2023 17:47:58 +0800
|
||||
Subject: [PATCH] Disable timings default
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 3bc7230ca62ebe3426da293e436a962bb0134f85..8ea4317e9d5a74943345c6669c99e53ad3030999 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -90,8 +90,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public Timings timings;
|
||||
|
||||
public class Timings extends ConfigurationPart.Post {
|
||||
- public boolean enabled = true;
|
||||
- public boolean verbose = true;
|
||||
+ public boolean enabled = false; // Leaves - def false
|
||||
+ public boolean verbose = false; // Leaves - def false
|
||||
public String url = "https://timings.aikar.co/";
|
||||
public boolean serverNamePrivacy = false;
|
||||
public List<String> hiddenConfigEntries = List.of(
|
||||
@@ -1,117 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Mon, 3 Jul 2023 22:12:16 +0800
|
||||
Subject: [PATCH] Bladeren mspt sync protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5c09e2164a045346e0e2d4ce64408ac9209cf501..d47e29850462356e843591deba7e8a83f59faba0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1611,6 +1611,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.tick(); // Leaves - bbor
|
||||
top.leavesmc.leaves.protocol.AppleSkinProtocol.tick(); // Leaves - appleskin
|
||||
top.leavesmc.leaves.util.BreakBedrockList.endTick(); // Leaves - break bedrock list
|
||||
+ top.leavesmc.leaves.protocol.bladeren.MsptSyncProtocol.tick(this); // Leaves - mspt sync
|
||||
|
||||
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
||||
for (int i = 0; i < this.tickables.size(); ++i) {
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index a137b9bff6595594ebe149ff766abd9edea04294..7ee3840b1e44f3b9596ca839e252cdee3d41eda6 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -617,6 +617,7 @@ public abstract class PlayerList {
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
||||
top.leavesmc.leaves.protocol.BBORProtocol.onPlayerLoggedOut(entityplayer); // Leaves - bbor
|
||||
top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedOut(entityplayer); // Leaves - appleskin
|
||||
+ top.leavesmc.leaves.protocol.bladeren.MsptSyncProtocol.onPlayerLoggedOut(entityplayer); // Leaves - mspt sync
|
||||
// Paper end
|
||||
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 5f50169af0dcbd7931f0118815005607a2d3ba0c..c04aa86e53633e4def6f6a9c4b5e667e82756672 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -472,6 +472,7 @@ public final class CraftServer implements Server {
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
top.leavesmc.leaves.protocol.PcaSyncProtocol.init(); // Leaves - pca
|
||||
top.leavesmc.leaves.protocol.JadeProtocol.init(); // Leaves - Jade
|
||||
+ top.leavesmc.leaves.protocol.bladeren.MsptSyncProtocol.init(); // Leaves - mspt
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5c206ecc6aba1ef632467f85ea83f909486ced29
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
||||
@@ -0,0 +1,69 @@
|
||||
+package top.leavesmc.leaves.protocol.bladeren;
|
||||
+
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.util.ProtocolUtils;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+
|
||||
+public class MsptSyncProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "bladeren";
|
||||
+
|
||||
+ private static final ResourceLocation MSPT_SYNC = id("mspt_sync");
|
||||
+
|
||||
+ private static final List<ServerPlayer> players = new ArrayList<>();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void init() {
|
||||
+ LeavesProtocol.registerFeature("mspt_sync", (player, compoundTag) -> {
|
||||
+ if (compoundTag.getString("Value").equals("true")) {
|
||||
+ onPlayerSubmit(player);
|
||||
+ } else {
|
||||
+ onPlayerLoggedOut(player);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerSubmit(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.msptSyncProtocol) {
|
||||
+ players.add(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.msptSyncProtocol) {
|
||||
+ players.remove(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void tick(MinecraftServer server) {
|
||||
+ if (LeavesConfig.msptSyncProtocol) {
|
||||
+ if (players.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (server.getTickCount() % LeavesConfig.msptSyncTickInterval == 0) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ double mspt = Arrays.stream(server.tickTimes).average().getAsDouble() * 1.0E-6D;
|
||||
+ double tps = 1000.0D / Math.max(mspt, 50);
|
||||
+ buf.writeDouble(mspt);
|
||||
+ buf.writeDouble(tps);
|
||||
+ players.forEach(player -> ProtocolUtils.sendPayloadPacket(player, MSPT_SYNC, buf));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] No block update command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4453664ac91eb727e340ace3b6bdb083541f816c..55ef6d5ffebe04e678dc89ec2740f031af361cb8 100644
|
||||
index a90c6b1cfc9c3f99712afa1d7a3ed93fb02f4bfd..66b95197df737fac490a1b22949ab3855a7fce59 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2480,6 +2480,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2481,6 +2481,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@Override
|
||||
public void blockUpdated(BlockPos pos, Block block) {
|
||||
@@ -17,10 +17,10 @@ index 4453664ac91eb727e340ace3b6bdb083541f816c..55ef6d5ffebe04e678dc89ec2740f031
|
||||
// CraftBukkit start
|
||||
if (populating) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..846ee484d48db1f80b95b526b5321826a00a6507 100644
|
||||
index 4697df75fdee2023c41260bed211e3e3d90d2b9b..8c9bc54a7007b0c5ae1c8576aeca5d05a55613d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -454,7 +454,7 @@ public final class ItemStack {
|
||||
@@ -459,7 +459,7 @@ public final class ItemStack {
|
||||
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
|
||||
|
||||
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
||||
@@ -30,10 +30,10 @@ index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..846ee484d48db1f80b95b526b5321826
|
||||
|
||||
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 2c3ca05644bc97d505e8ca92e7a5f48670fd8b66..767ea67271b618d28aa77af683a1889917847e65 100644
|
||||
index 6f005cc4b90d2610c8a2ce246f29156132e68267..00989bd8ba9953353a213d57c5ff81f7d2f07773 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -576,7 +576,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -485,7 +485,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
} else {
|
||||
// CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
||||
if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) {
|
||||
@@ -43,10 +43,10 @@ index 2c3ca05644bc97d505e8ca92e7a5f48670fd8b66..767ea67271b618d28aa77af683a18899
|
||||
|
||||
if (iblockdata.hasBlockEntity()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 39669ad8e8895f1ff3e3a7e3ee1ab39c1b74b09d..c50fd02935870b0f660544efe3d05ea177a0102e 100644
|
||||
index 3cf6e62ceb555eedf133e0ba82445caadaab7743..8c3c9c64ea9de68a57d18164e016602016a79406 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -502,6 +502,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
@@ -521,6 +521,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
|
||||
@Override
|
||||
public void tick(Level world, BlockPos pos, FluidState state) {
|
||||
@@ -55,7 +55,7 @@ index 39669ad8e8895f1ff3e3a7e3ee1ab39c1b74b09d..c50fd02935870b0f660544efe3d05ea1
|
||||
FluidState fluid1 = this.getNewLiquid(world, pos, world.getBlockState(pos));
|
||||
int i = this.getSpreadDelay(world, pos, state, fluid1);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
index ec81be70cd6f92bbf9011395cb361f0ce54c5ad0..cc12f8575b21c973842b14998af1d92c9c217911 100644
|
||||
index 598dc0d3a2b9387e76d7e4e19e54c4573a24bc54..dda7e3c78aa62636a1f6834392df87a8bc428f04 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
@@ -46,6 +46,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
||||
@@ -92,7 +92,7 @@ index 2708251ebc1995e71fb0e5dca9e158a3005f8a8a..e28351b379677fec356b6efec2d882ee
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 481c9b2755a923a31e1af10a374d4973035ef785..e64992dfa61d9009f326659dbaf7b5c8601555fd 100644
|
||||
index b10e20e7b504d15d1388fa620b8021a0652b5b3e..117ab409df92a5d96568becaf58ea3a6a24c19a6 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -101,9 +101,9 @@ index 481c9b2755a923a31e1af10a374d4973035ef785..e64992dfa61d9009f326659dbaf7b5c8
|
||||
import top.leavesmc.leaves.bot.agent.Actions;
|
||||
+import top.leavesmc.leaves.command.NoBlockUpdateCommand;
|
||||
import top.leavesmc.leaves.profile.LeavesMinecraftSessionService;
|
||||
import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
@@ -86,6 +87,10 @@ public final class LeavesConfig {
|
||||
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule;
|
||||
@@ -82,6 +83,10 @@ public final class LeavesConfig {
|
||||
commands.put("bot", new BotCommand("bot"));
|
||||
Actions.registerAll();
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Raider die skip self raid check
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
index 57fdcdaf54fd1c92a6e51a3a81789029096e5abe..1b8e141e50dd2a156eda2455988ea45a390692ae 100644
|
||||
index cdbc925ef61b8b439415f0a89368227890bcecb2..b89deba5bf6a78c26485633421c7d0b3b1462219 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -134,7 +134,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Container open passthrough
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
index 1122090792e9ee98bf8498e8907c5abbbcbcd6d6..50900e6bc73424d6163fd832de9b755f3ac03111 100644
|
||||
index 614777d15bcf4141a89d0a0f7bd880526c668ffd..f24bf88440976d6f3e12abe64d319fb6a7205896 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
@@ -114,6 +114,22 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
||||
@@ -30,4 +30,4 @@ index 1122090792e9ee98bf8498e8907c5abbbcbcd6d6..50900e6bc73424d6163fd832de9b755f
|
||||
+ // Leaves end - signContainerPassthrough
|
||||
} else if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag1)) {
|
||||
this.openTextEdit(player, tileentitysign, flag1, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.INTERACT); // Paper
|
||||
return InteractionResult.SUCCESS;
|
||||
return this.getInteractionResult(flag);
|
||||
@@ -1,188 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Fri, 7 Jul 2023 16:50:06 +0800
|
||||
Subject: [PATCH] Leaves protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index dcfd2f0bf4ed51c6a74d9e4ec619b8b0da571ba3..1faea96ca133e4280f90aff86efbfbace370b273 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3645,6 +3645,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (top.leavesmc.leaves.LeavesConfig.leavesCarpetSupport && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.CarpetServerProtocol.PROTOCOL_ID)) {
|
||||
top.leavesmc.leaves.protocol.CarpetServerProtocol.handlePacket(player, packet);
|
||||
}
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.bladerenLeavesProtocol && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.bladeren.LeavesProtocol.PROTOCOL_ID)) {
|
||||
+ top.leavesmc.leaves.protocol.bladeren.LeavesProtocol.handlePacket(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);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 7ee3840b1e44f3b9596ca839e252cdee3d41eda6..c9b5184baefae815e94e041a9ce41557524c4eb7 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -364,6 +364,7 @@ public abstract class PlayerList {
|
||||
top.leavesmc.leaves.protocol.JadeProtocol.onPlayerJoin(player); // Leaves - Jade
|
||||
top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedIn(player); // Leaves - appleskin
|
||||
top.leavesmc.leaves.protocol.CarpetServerProtocol.onPlayerJoin(player); // Leaves - carpet
|
||||
+ top.leavesmc.leaves.protocol.bladeren.LeavesProtocol.onPlayerJoin(player); // Leaves - leaves protocol
|
||||
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 296aa94bb0bf21d1c6c1bed7aa791bc611cd8b2a..481c9b2755a923a31e1af10a374d4973035ef785 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -16,6 +16,8 @@ import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule;
|
||||
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules;
|
||||
+import top.leavesmc.leaves.protocol.bladeren.LeavesProtocol.LeavesFeatureSet;
|
||||
+import top.leavesmc.leaves.protocol.bladeren.LeavesProtocol.LeavesFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -75,6 +77,7 @@ public final class LeavesConfig {
|
||||
|
||||
LeavesConfig.load(config);
|
||||
registerCarpetRules();
|
||||
+ registerLeavesFeatures();
|
||||
|
||||
commands = new HashMap<>();
|
||||
commands.put("leaves", new LeavesCommand("leaves"));
|
||||
@@ -858,6 +861,10 @@ public final class LeavesConfig {
|
||||
}
|
||||
|
||||
public static void registerLeavesFeatures() {
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("lava_riptide", lavaRiptide));
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", msptSyncProtocol));
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("loot_world_random", lootWorldRandom));
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("use_vanilla_random", useVanillaRandom));
|
||||
}
|
||||
|
||||
public static boolean hopperCounter = false;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/LeavesProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/LeavesProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..97337f795490419611a4515dfcfa038e9e6c3fb6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/bladeren/LeavesProtocol.java
|
||||
@@ -0,0 +1,118 @@
|
||||
+package top.leavesmc.leaves.protocol.bladeren;
|
||||
+
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
|
||||
+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.LeavesConfig;
|
||||
+import top.leavesmc.leaves.util.ProtocolUtils;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.function.BiConsumer;
|
||||
+
|
||||
+public class LeavesProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "bladeren";
|
||||
+ public static final String PROTOCOL_VERSION = "1.0.0";
|
||||
+
|
||||
+ private static final ResourceLocation HELLO_ID = id("hello");
|
||||
+ private static final ResourceLocation FEATURE_MODIFY_ID = id("feature_modify");
|
||||
+
|
||||
+ private static final Map<String, BiConsumer<ServerPlayer, CompoundTag>> registeredFeatures = new HashMap<>();
|
||||
+ private static final Map<ResourceLocation, BiConsumer<ServerPlayer, FriendlyByteBuf>> registeredPackets = new HashMap<>();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void registerFeature(String name, BiConsumer<ServerPlayer, CompoundTag> consumer) {
|
||||
+ registeredFeatures.put(name, consumer);
|
||||
+ }
|
||||
+
|
||||
+ public static void registerPacket(ResourceLocation id, BiConsumer<ServerPlayer, FriendlyByteBuf> consumer) {
|
||||
+ registeredPackets.put(id, consumer);
|
||||
+ }
|
||||
+
|
||||
+ public static void handlePacket(ServerPlayer player, @NotNull ServerboundCustomPayloadPacket packet) {
|
||||
+ if (packet.identifier.equals(HELLO_ID)) {
|
||||
+ handleHello(player, packet.data);
|
||||
+ } else if (packet.identifier.equals(FEATURE_MODIFY_ID)) {
|
||||
+ handleModify(player, packet.data);
|
||||
+ } else if (registeredPackets.containsKey(packet.identifier)) {
|
||||
+ registeredPackets.get(packet.identifier).accept(player, packet.data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void handleModify(@NotNull ServerPlayer player, @NotNull FriendlyByteBuf data) {
|
||||
+ String name = data.readUtf();
|
||||
+ CompoundTag tag = data.readNbt();
|
||||
+
|
||||
+ if (registeredFeatures.containsKey(name)) {
|
||||
+ registeredFeatures.get(name).accept(player, tag);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void handleHello(@NotNull ServerPlayer player, @NotNull FriendlyByteBuf data) {
|
||||
+ String clientVersion = data.readUtf(64);
|
||||
+ CompoundTag tag = data.readNbt();
|
||||
+
|
||||
+ if (tag != null) {
|
||||
+ CompoundTag featureNbt = tag.getCompound("Features");
|
||||
+ for (String name : featureNbt.getAllKeys()) {
|
||||
+ if (registeredFeatures.containsKey(name)) {
|
||||
+ registeredFeatures.get(name).accept(player, featureNbt.getCompound(name));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerJoin(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bladerenLeavesProtocol) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeUtf(PROTOCOL_VERSION);
|
||||
+
|
||||
+ CompoundTag tag = new CompoundTag();
|
||||
+ LeavesFeatureSet.writeNBT(tag);
|
||||
+ buf.writeNbt(tag);
|
||||
+
|
||||
+ ProtocolUtils.sendPayloadPacket(player, HELLO_ID, buf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class LeavesFeatureSet {
|
||||
+
|
||||
+ private static final Map<String, LeavesFeature> features = new HashMap<>();
|
||||
+
|
||||
+ public static void writeNBT(@NotNull CompoundTag tag) {
|
||||
+ CompoundTag featureNbt = new CompoundTag();
|
||||
+ features.values().forEach(feature -> feature.writeNBT(featureNbt));
|
||||
+ tag.put("Features", featureNbt);
|
||||
+ }
|
||||
+
|
||||
+ public static void register(LeavesFeature feature) {
|
||||
+ features.put(feature.name, feature);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record LeavesFeature(String name, String value) {
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Contract("_, _ -> new")
|
||||
+ public static LeavesFeature of(String name, boolean value) {
|
||||
+ return new LeavesFeature(name, Boolean.toString(value));
|
||||
+ }
|
||||
+
|
||||
+ public void writeNBT(@NotNull CompoundTag rules) {
|
||||
+ CompoundTag rule = new CompoundTag();
|
||||
+ rule.putString("Feature", name);
|
||||
+ rule.putString("Value", value);
|
||||
+ rules.put(name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
189
patches/server/0079-Bladeren-Protocol.patch
Normal file
189
patches/server/0079-Bladeren-Protocol.patch
Normal file
@@ -0,0 +1,189 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Fri, 7 Jul 2023 16:50:06 +0800
|
||||
Subject: [PATCH] Bladeren Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 117ab409df92a5d96568becaf58ea3a6a24c19a6..855b8b466ae6acc1d5f0367b7b8e3d64e149a7e0 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -16,6 +16,8 @@ import top.leavesmc.leaves.profile.LeavesMinecraftSessionService;
|
||||
import top.leavesmc.leaves.util.MathUtils;
|
||||
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule;
|
||||
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules;
|
||||
+import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet;
|
||||
+import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -75,6 +77,7 @@ public final class LeavesConfig {
|
||||
|
||||
LeavesConfig.load(config);
|
||||
registerCarpetRules();
|
||||
+ registerLeavesFeatures();
|
||||
|
||||
commands = new HashMap<>();
|
||||
commands.put("leaves", new LeavesCommand("leaves"));
|
||||
@@ -851,6 +854,10 @@ public final class LeavesConfig {
|
||||
}
|
||||
|
||||
public static void registerLeavesFeatures() {
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("lava_riptide", lavaRiptide));
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", msptSyncProtocol));
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("loot_world_random", lootWorldRandom));
|
||||
+ LeavesFeatureSet.register(LeavesFeature.of("use_vanilla_random", useVanillaRandom));
|
||||
}
|
||||
|
||||
public static boolean hopperCounter = false;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a91011c7a2c56646053bb9d158ff0c265c658c00
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java
|
||||
@@ -0,0 +1,145 @@
|
||||
+package top.leavesmc.leaves.protocol.bladeren;
|
||||
+
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+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.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+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.Map;
|
||||
+import java.util.function.BiConsumer;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "bladeren")
|
||||
+public class BladerenProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "bladeren";
|
||||
+ public static final String PROTOCOL_VERSION = "1.0.0";
|
||||
+
|
||||
+ private static final ResourceLocation HELLO_ID = id("hello");
|
||||
+ private static final ResourceLocation FEATURE_MODIFY_ID = id("feature_modify");
|
||||
+
|
||||
+ private static final Map<String, BiConsumer<ServerPlayer, CompoundTag>> registeredFeatures = new HashMap<>();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = BladerenHelloPayload.class, payloadId = "hello")
|
||||
+ private static void handleHello(@NotNull ServerPlayer player, @NotNull BladerenHelloPayload payload) {
|
||||
+ if (LeavesConfig.bladerenLeavesProtocol) {
|
||||
+ String clientVersion = payload.version;
|
||||
+ CompoundTag tag = payload.nbt;
|
||||
+
|
||||
+ if (tag != null) {
|
||||
+ CompoundTag featureNbt = tag.getCompound("Features");
|
||||
+ for (String name : featureNbt.getAllKeys()) {
|
||||
+ if (registeredFeatures.containsKey(name)) {
|
||||
+ registeredFeatures.get(name).accept(player, featureNbt.getCompound(name));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = BladerenFeatureModifyPayload.class, payloadId = "feature_modify")
|
||||
+ private static void handleModify(@NotNull ServerPlayer player, @NotNull BladerenFeatureModifyPayload payload) {
|
||||
+ if (LeavesConfig.bladerenLeavesProtocol) {
|
||||
+ String name = payload.name;
|
||||
+ CompoundTag tag = payload.nbt;
|
||||
+
|
||||
+ if (registeredFeatures.containsKey(name)) {
|
||||
+ registeredFeatures.get(name).accept(player, tag);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerJoin(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bladerenLeavesProtocol) {
|
||||
+ CompoundTag tag = new CompoundTag();
|
||||
+ LeavesFeatureSet.writeNBT(tag);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, new BladerenHelloPayload(PROTOCOL_VERSION, tag));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void registerFeature(String name, BiConsumer<ServerPlayer, CompoundTag> consumer) {
|
||||
+ registeredFeatures.put(name, consumer);
|
||||
+ }
|
||||
+
|
||||
+ public static class LeavesFeatureSet {
|
||||
+
|
||||
+ private static final Map<String, LeavesFeature> features = new HashMap<>();
|
||||
+
|
||||
+ public static void writeNBT(@NotNull CompoundTag tag) {
|
||||
+ CompoundTag featureNbt = new CompoundTag();
|
||||
+ features.values().forEach(feature -> feature.writeNBT(featureNbt));
|
||||
+ tag.put("Features", featureNbt);
|
||||
+ }
|
||||
+
|
||||
+ public static void register(LeavesFeature feature) {
|
||||
+ features.put(feature.name, feature);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record LeavesFeature(String name, String value) {
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Contract("_, _ -> new")
|
||||
+ public static LeavesFeature of(String name, boolean value) {
|
||||
+ return new LeavesFeature(name, Boolean.toString(value));
|
||||
+ }
|
||||
+
|
||||
+ public void writeNBT(@NotNull CompoundTag rules) {
|
||||
+ CompoundTag rule = new CompoundTag();
|
||||
+ rule.putString("Feature", name);
|
||||
+ rule.putString("Value", value);
|
||||
+ rules.put(name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record BladerenFeatureModifyPayload(String name, CompoundTag nbt) implements CustomPacketPayload {
|
||||
+
|
||||
+ public BladerenFeatureModifyPayload(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
+ this(buf.readUtf(), buf.readNbt());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(@NotNull FriendlyByteBuf buf) {
|
||||
+ buf.writeUtf(name);
|
||||
+ buf.writeNbt(nbt);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public ResourceLocation id() {
|
||||
+ return FEATURE_MODIFY_ID;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record BladerenHelloPayload(String version, CompoundTag nbt) implements CustomPacketPayload {
|
||||
+
|
||||
+ public BladerenHelloPayload(ResourceLocation location, @NotNull FriendlyByteBuf buf) {
|
||||
+ this(buf.readUtf(64), buf.readNbt());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(@NotNull FriendlyByteBuf buf) {
|
||||
+ buf.writeUtf(version);
|
||||
+ buf.writeNbt(nbt);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public ResourceLocation id() {
|
||||
+ return HELLO_ID;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
85
patches/server/0080-Bladeren-mspt-sync-protocol.patch
Normal file
85
patches/server/0080-Bladeren-mspt-sync-protocol.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Mon, 3 Jul 2023 22:12:16 +0800
|
||||
Subject: [PATCH] Bladeren mspt sync protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3250965ac6e7beca255643a8b15f887c2835316a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
||||
@@ -0,0 +1,73 @@
|
||||
+package top.leavesmc.leaves.protocol.bladeren;
|
||||
+
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.protocol.core.LeavesProtocol;
|
||||
+import top.leavesmc.leaves.protocol.core.ProtocolHandler;
|
||||
+import top.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "bladeren")
|
||||
+public class MsptSyncProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "bladeren";
|
||||
+
|
||||
+ private static final ResourceLocation MSPT_SYNC = id("mspt_sync");
|
||||
+
|
||||
+ private static final List<ServerPlayer> players = new ArrayList<>();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.Init
|
||||
+ public static void init() {
|
||||
+ BladerenProtocol.registerFeature("mspt_sync", (player, compoundTag) -> {
|
||||
+ if (compoundTag.getString("Value").equals("true")) {
|
||||
+ onPlayerSubmit(player);
|
||||
+ } else {
|
||||
+ onPlayerLoggedOut(player);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.msptSyncProtocol) {
|
||||
+ players.remove(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.Ticker
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.msptSyncProtocol) {
|
||||
+ if (players.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ MinecraftServer server = MinecraftServer.getServer();
|
||||
+ if (server.getTickCount() % LeavesConfig.msptSyncTickInterval == 0) {
|
||||
+ double mspt = Arrays.stream(server.tickTimes).average().getAsDouble() * 1.0E-6D;
|
||||
+ double tps = 1000.0D / Math.max(mspt, 50);
|
||||
+ players.forEach(player -> ProtocolUtils.sendPayloadPacket(player, MSPT_SYNC, buf -> {
|
||||
+ buf.writeDouble(mspt);
|
||||
+ buf.writeDouble(tps);
|
||||
+ }));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerSubmit(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.msptSyncProtocol) {
|
||||
+ players.add(player);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] SIMD support
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 955362ab4155718807859978d840d9f4d68a8ef4..3f3e60ecbd24c1c40ebbdaec7402192e111f5407 100644
|
||||
index a0fbd152b6933e198b47abb13acec9004c91d27f..9bc8cdb866a61f1b5a1bbe9f033cffd88946ace4 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -71,6 +71,7 @@ tasks.withType<JavaCompile> {
|
||||
@@ -16,7 +16,7 @@ index 955362ab4155718807859978d840d9f4d68a8ef4..3f3e60ecbd24c1c40ebbdaec7402192e
|
||||
}
|
||||
// Leaves end - hide irrelevant compilation warnings
|
||||
|
||||
@@ -188,6 +189,8 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -195,6 +196,8 @@ fun TaskContainer.registerRunTask(
|
||||
minHeapSize = "${memoryGb}G"
|
||||
maxHeapSize = "${memoryGb}G"
|
||||
|
||||
@@ -112,10 +112,10 @@ index acae3eb30e0689048937f479dc3070f0688abdad..029b62acf1d9f8479ab64a55c12f00ba
|
||||
int onResize(int newBits, T object);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 7f5547dc31aa53b2863f4c09f598fa88e7fe2afd..f4bec4aba89a69a89c11c99d3291e2e86a7f4ea1 100644
|
||||
index 16fbc633de3a1d9e5e8c65ae107397a6f0e50811..deef0363ce82d221726e8e4a6b11683e511f3049 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -22,8 +22,25 @@ import net.minecraft.util.Mth;
|
||||
@@ -23,8 +23,25 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.SimpleBitStorage;
|
||||
import net.minecraft.util.ThreadingDetector;
|
||||
import net.minecraft.util.ZeroBitStorage;
|
||||
@@ -141,7 +141,7 @@ index 7f5547dc31aa53b2863f4c09f598fa88e7fe2afd..f4bec4aba89a69a89c11c99d3291e2e8
|
||||
private static final int MIN_PALETTE_BITS = 0;
|
||||
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
|
||||
return 0;
|
||||
@@ -301,30 +318,78 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
@@ -302,30 +319,78 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
@@ -241,7 +241,7 @@ index 7f5547dc31aa53b2863f4c09f598fa88e7fe2afd..f4bec4aba89a69a89c11c99d3291e2e8
|
||||
}
|
||||
|
||||
private static <T> void swapPalette(int[] is, IntUnaryOperator applier) {
|
||||
@@ -364,17 +429,47 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
@@ -365,17 +430,47 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> counter) {
|
||||
@@ -300,10 +300,10 @@ index 7f5547dc31aa53b2863f4c09f598fa88e7fe2afd..f4bec4aba89a69a89c11c99d3291e2e8
|
||||
static record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/top/leavesmc/leaves/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f71d2028dd047b9b4cc5fd6cb2857cc5b46e668
|
||||
index 0000000000000000000000000000000000000000..e9573d57ef70ea43be59fd1474399ad48eb4e43a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
@@ -0,0 +1,196 @@
|
||||
@@ -0,0 +1,197 @@
|
||||
+package top.leavesmc.leaves.lithium.common.world.chunk;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
@@ -317,6 +317,7 @@ index 0000000000000000000000000000000000000000..6f71d2028dd047b9b4cc5fd6cb2857cc
|
||||
+
|
||||
+import net.minecraft.core.IdMap;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.VarInt;
|
||||
+import net.minecraft.world.level.chunk.Palette;
|
||||
+import net.minecraft.world.level.chunk.PaletteResize;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
@@ -459,10 +460,10 @@ index 0000000000000000000000000000000000000000..6f71d2028dd047b9b4cc5fd6cb2857cc
|
||||
+
|
||||
+ @Override
|
||||
+ public int getSerializedSize() {
|
||||
+ int size = FriendlyByteBuf.getVarIntSize(this.size);
|
||||
+ int size = VarInt.getByteSize(this.size);
|
||||
+
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ size += FriendlyByteBuf.getVarIntSize(this.idList.getId(this.valueFor(i)));
|
||||
+ size += VarInt.getByteSize(this.idList.getId(this.valueFor(i)));
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user