Compare commits
62
Commits
8675ea1da9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
231bb8705b | ||
|
|
6b7b8863f0 | ||
|
|
d52bcc8c1d | ||
|
|
6fdd8eee4a | ||
|
|
6f7ba53119 | ||
|
|
e660a6239b | ||
|
|
c1c62df3df | ||
|
|
20c4112564 | ||
|
|
87451df0c0 | ||
|
|
899927a935 | ||
|
|
0cc941be27 | ||
|
|
2edb70257d | ||
|
|
c9f8dd4595 | ||
|
|
9eb5c767ed | ||
|
|
1192f2e674 | ||
|
|
376e02f880 | ||
|
|
50e9fe5eba | ||
|
|
8554d3b962 | ||
|
|
8331d07690 | ||
|
|
4a865c122c | ||
|
|
7545e09559 | ||
|
|
c92cb53b26 | ||
|
|
b82cbf07cf | ||
|
|
84f62ca34b | ||
|
|
3cb4cc0ab8 | ||
|
|
2734c91fca | ||
|
|
f317990af4 | ||
|
|
8580882817 | ||
|
|
a33c1044ae | ||
|
|
7209f9c356 | ||
|
|
e1dc40628d | ||
|
|
0418b4cdc7 | ||
|
|
6806b9d002 | ||
|
|
dfe2c124e6 | ||
|
|
1537d45e4d | ||
|
|
9ef6d49163 | ||
|
|
de4ccc40f0 | ||
|
|
9fff62f963 | ||
|
|
ce1a1a3fb4 | ||
|
|
586925cde2 | ||
|
|
8147a2f0cf | ||
|
|
ec52f264b8 | ||
|
|
fbe3db6fa8 | ||
|
|
1bb895c165 | ||
|
|
a73423a276 | ||
|
|
c736416ca5 | ||
|
|
d1786e96ef | ||
|
|
f1ad249c11 | ||
|
|
ffe256f06d | ||
|
|
f631903000 | ||
|
|
aa6be50f5b | ||
|
|
fdaabedb7e | ||
|
|
1fa211fa6e | ||
|
|
dcaaa5f623 | ||
|
|
80b61f6757 | ||
|
|
5970be9c0b | ||
|
|
484990074d | ||
|
|
10cc76bbff | ||
|
|
11e9c0381f | ||
|
|
bf69100203 | ||
|
|
1faa336f5a | ||
|
|
1f25ad07e3 |
@@ -1,18 +1,45 @@
|
||||
# Shiroha
|
||||
|
||||
Shiroha is a fork of [Folia](https://github.com/PaperMC/Folia) — a multithreaded Minecraft server based on Paper.
|
||||

|
||||

|
||||

|
||||
|
||||
This project aims to provide additional performance optimizations and bug fixes on top of Folia, targeting the latest Minecraft versions (currently 26.2).
|
||||
Shiroha 是 [Folia](https://github.com/PaperMC/Folia) 的一个分支。Folia 是基于 Paper 的多线程 Minecraft 服务端,Shiroha 在其基础上跟进最新 Minecraft 版本(当前为 26.2,见 `gradle.properties`),做一些修正、性能优化和配置化的功能扩展。
|
||||
|
||||
## Building
|
||||
本项目为半闭源项目,以本仓库内的内容为准。
|
||||
|
||||
## 构建
|
||||
|
||||
需要 Java 25+(构建工具链见 `build.gradle.kts`)。
|
||||
|
||||
```bash
|
||||
./gradlew applyPatches
|
||||
./gradlew applyAllPatches
|
||||
./gradlew createPaperclipJar
|
||||
```
|
||||
|
||||
Requires Java 25+.
|
||||
产物为 paperclip jar,位于 `shiroha-server/build/libs/`。构建任务基于 paperweight-patcher,其余任务可通过 `./gradlew tasks` 查看。
|
||||
|
||||
## License
|
||||
## 功能
|
||||
|
||||
Licensed under the [GNU General Public License v3.0](LICENSE).
|
||||
功能大多带有配置开关,配置项定义集中在 `shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/modules/`,各项的说明直接写在配置文件的注释中,建议以生成出的配置文件和源码注释为准。
|
||||
|
||||
具体改动以 patch 文件为准:
|
||||
|
||||
- `shiroha-server/minecraft-patches/features/` — 对 Minecraft 源码的改动
|
||||
- `shiroha-server/paper-patches/features/` — 对上游 Paper 的改动
|
||||
- `shiroha-api/paper-patches/features/` — API 侧改动
|
||||
|
||||
主要类别:
|
||||
|
||||
- **修正**:Folia 相关的线程与区域化问题、传送与末影珍珠、地狱门 ticket、实体同步等,对应文件名前缀多为 `Fix-*` / `Correct-*`。
|
||||
- **优化**:包含部分来自 Leaf、Gale、Purpur、Pufferfish、Lithium 等项目的移植与改写,对应 patch 文件名带有来源前缀;移植的准确性建议对照 patch 内容与原项目确认。
|
||||
- **配置系统**:自研的注解式配置框架(`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/`),支持热重载与基于 dialog 的图形化配置界面,由 `/shirohaconfig` 命令操作(`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/commands/config/`)。
|
||||
- **存档格式**:除原版 `.mca` 外支持 `b_linear`(带缓冲刷写的 Linear)区域格式(`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/enums/EnumRegionFormat.java`)。
|
||||
- **状态栏**:TPS、内存、区域信息状态栏,由 `/bar` 命令与配置控制(`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/functions/bars/`)。
|
||||
- **其他**:实体唤醒时长、实体数量限制(Kaiiju)、传送门速率限制、CPU 亲和性等,详见对应 patch 与配置模块。
|
||||
|
||||
以上列表不保证完整,未列出的改动请自行查阅 patch 目录。
|
||||
|
||||
## 许可
|
||||
|
||||
本项目按 [GPL-3.0](LICENSE) 许可。其中从其他项目移植的代码,其归属与许可情况见各 patch 文件内的说明。
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Shiroha
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
Shiroha is a fork of [Folia](https://github.com/PaperMC/Folia), a multithreaded Minecraft server based on Paper. It tracks recent Minecraft versions (currently 26.2, see `gradle.properties`) and applies fixes, performance optimizations, and configurable features on top of upstream.
|
||||
|
||||
This is a partially closed-source project; the contents of this repository are the reference.
|
||||
|
||||
## Building
|
||||
|
||||
Requires Java 25+ (build toolchain configuration is in `build.gradle.kts`).
|
||||
|
||||
```bash
|
||||
./gradlew applyAllPatches
|
||||
./gradlew createPaperclipJar
|
||||
```
|
||||
|
||||
The output is a paperclip jar in `shiroha-server/build/libs/`. The build is based on paperweight-patcher; other tasks can be listed with `./gradlew tasks`.
|
||||
|
||||
## Features
|
||||
|
||||
Most features are behind configuration switches. Config definitions live in `shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/modules/`, with per-option documentation written directly into the generated config file comments — treat the generated config and the source annotations as the authoritative description.
|
||||
|
||||
The actual changes are tracked as patch files:
|
||||
|
||||
- `shiroha-server/minecraft-patches/features/` — changes to Minecraft sources
|
||||
- `shiroha-server/paper-patches/features/` — changes to upstream Paper
|
||||
- `shiroha-api/paper-patches/features/` — API-side changes
|
||||
|
||||
Main categories:
|
||||
|
||||
- **Fixes**: Folia threading and regionization issues, teleport and ender pearl behavior, nether portal tickets, entity desync, etc. — patch filenames mostly use the `Fix-*` / `Correct-*` prefixes.
|
||||
- **Optimizations**: includes ports and reworkings taken from projects such as Leaf, Gale, Purpur, Pufferfish, and Lithium; these are marked with their source prefixes in patch filenames. Verify the patch contents against the original projects for attribution and accuracy.
|
||||
- **Config system**: a custom annotation-based configuration framework (`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/`) with hot reload and a dialog-based GUI editor, operated through the `/shirohaconfig` command (`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/commands/config/`).
|
||||
- **Region formats**: supports `b_linear` (buffered-flush Linear) region format in addition to vanilla `.mca` (`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/enums/EnumRegionFormat.java`).
|
||||
- **Status bars**: TPS, memory, and region info bars, controlled via the `/bar` command and config (`shiroha-server/src/main/java/io/nanachiyo0721/shiroha/functions/bars/`).
|
||||
- **Miscellaneous**: entity wake-up duration, entity limits (Kaiiju), portal rate limiting, CPU affinity, and more — see the corresponding patches and config modules.
|
||||
|
||||
This list is not guaranteed to be complete; for anything not listed here, check the patch directories yourself.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under [GPL-3.0](LICENSE). Code ported from other projects retains its own attribution and licensing terms as documented in the respective patch files.
|
||||
+1
-1
@@ -9,7 +9,7 @@ release=pre
|
||||
# true for push to repo, false for skip push repo, auto for detect by release value
|
||||
pushRepo=auto
|
||||
|
||||
foliaRef=602048cb815db2ded68cca8cd43f480b983185a1
|
||||
foliaRef=14b7fee5c866fca9a40ede4a58998fb928140f65
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
--- a/folia-api/build.gradle.kts
|
||||
+++ b/folia-api/build.gradle.kts
|
||||
@@ -105,17 +_,21 @@
|
||||
@@ -109,7 +_,7 @@
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher:6.0.3")
|
||||
|
||||
// checkstyle
|
||||
- checkstyle(project(":folia-checkstyle"))
|
||||
+ //checkstyle(project(":folia-checkstyle"))
|
||||
}
|
||||
|
||||
val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
|
||||
@@ -123,17 +_,21 @@
|
||||
java {
|
||||
srcDir(generatedDir)
|
||||
srcDir(file("../paper-api/src/main/java"))
|
||||
@@ -22,7 +31,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,4 +_,15 @@
|
||||
@@ -276,4 +_,15 @@
|
||||
}
|
||||
tasks.check {
|
||||
dependsOn(scanJarForBadCalls)
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Rebrand to Shiroha
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
index 652ff54e7c50412503725d628bfe72ed03059790..add32abb29a291e77fe4d74a6d9f10344897ab26 100644
|
||||
index 4e099b584c3435ba1ebce492011d35ae1ac0cdf8..92aadf5602049ea22a10625b2a04f3bfef5aae4d 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
@@ -19,6 +19,17 @@ public interface ServerBuildInfo {
|
||||
@@ -17,6 +17,17 @@ public interface ServerBuildInfo {
|
||||
*/
|
||||
Key BRAND_PAPER_ID = Key.key("papermc", "paper");
|
||||
|
||||
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Sun, 28 Jun 2026 16:40:49 +0800
|
||||
Subject: [PATCH] KioCG Chunk API
|
||||
Date: Sat, 8 Aug 2026 11:42:50 +0800
|
||||
Subject: [PATCH] KioCG ChunkHot API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
|
||||
@@ -16,13 +16,13 @@ index d873b78f6935a23ff8f6092b80968267b182cc0f..b4323370859dd4d9e86614484cdb9d2e
|
||||
+ long getChunkHotAvg(); // KioCG
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7a719d31fbc7633a9bb87ea97338190ee3a6047a..b79b9a2ad108c0488d3cc3862f72985059bb4988 100644
|
||||
index 65e83e171ab4c514662b9344e08f7065fa9efaa1..274af6397b5f7c0b6787e2669de80e54858950a2 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -4020,4 +4020,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
default ObjectContents asObjectContents() {
|
||||
return this.getPlayerProfile().asObjectContents();
|
||||
}
|
||||
@@ -4050,4 +4050,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* clearing any fixed pose in the process.
|
||||
*/
|
||||
void unsetFixedPose();
|
||||
+
|
||||
+ long getNearbyChunkHot(); // KioCG
|
||||
}
|
||||
@@ -1,13 +1,5 @@
|
||||
--- a/folia-server/build.gradle.kts
|
||||
+++ b/folia-server/build.gradle.kts
|
||||
@@ -12,6 +_,7 @@
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
+val bacteriawaMavenPublicUrl = "https://repo.bacteriawa.com/repository/maven-public/"
|
||||
|
||||
dependencies {
|
||||
mache("io.papermc:mache:26.2+build.1")
|
||||
@@ -24,6 +_,7 @@
|
||||
gitFilePatches = false
|
||||
|
||||
@@ -41,17 +33,9 @@
|
||||
|
||||
|
||||
updatingMinecraft {
|
||||
@@ -44,6 +_,7 @@
|
||||
libraryRepositories.addAll(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
paperMavenPublicUrl,
|
||||
+ bacteriawaMavenPublicUrl
|
||||
)
|
||||
}
|
||||
|
||||
@@ -103,10 +_,14 @@
|
||||
main {
|
||||
java { srcDir("../paper-server/src/main/java"); srcDir("../paper-server/src/generated/java") }
|
||||
java { srcDir("../paper-server/src/main/java") }
|
||||
resources { srcDir("../paper-server/src/main/resources") }
|
||||
+ java { srcDir("../folia-server/src/main/java") }
|
||||
+ resources { srcDir("../folia-server/src/main/resources") }
|
||||
@@ -64,22 +48,31 @@
|
||||
}
|
||||
}
|
||||
val log4jPlugins = sourceSets.create("log4jPlugins") {
|
||||
@@ -134,7 +_,14 @@
|
||||
@@ -134,7 +_,7 @@
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":folia-api"))
|
||||
+ implementation(project(":shiroha-api"))
|
||||
implementation("ca.spottedleaf:leafpile:1.2.0")
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||
@@ -182,6 +_,15 @@
|
||||
// Spark
|
||||
implementation("me.lucko:spark-api:0.1-20240720.200737-2")
|
||||
implementation("me.lucko:spark-paper:1.10.177")
|
||||
+ // Shiroha start - dependencies
|
||||
+ implementation("com.electronwill.night-config:toml:3.8.4")
|
||||
+ implementation("net.openhft:affinity:3.23.3")
|
||||
+ implementation("com.github.luben:zstd-jni:1.5.4-1")
|
||||
+ implementation("net.openhft:zero-allocation-hashing:0.16")
|
||||
+ implementation("net.objecthunter:exp4j:0.4.8")
|
||||
+ implementation("tools.profiler:async-profiler:4.5")
|
||||
+ implementation("tools.profiler:jfr-converter:4.5")
|
||||
+ // Shiroha end
|
||||
implementation("ca.spottedleaf:leafpile:1.0.0")
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
@@ -189,21 +_,21 @@
|
||||
val git = Git(rootProject.layout.projectDirectory.path)
|
||||
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
|
||||
@@ -102,13 +95,13 @@
|
||||
- "Specification-Vendor" to "Paper Team",
|
||||
- "Brand-Id" to "papermc:folia",
|
||||
- "Brand-Name" to "Folia",
|
||||
+ "Specification-Vendor" to "Nanachiyo0721 Community",
|
||||
+ "Brand-Id" to "nanachiyo0721:shiroha",
|
||||
+ "Specification-Vendor" to "EilsapMC",
|
||||
+ "Brand-Id" to "eilsapmc:shiroha",
|
||||
+ "Brand-Name" to "Shiroha",
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to buildTime.toString(),
|
||||
"Git-Branch" to gitBranch,
|
||||
@@ -341,7 +_,7 @@
|
||||
@@ -352,7 +_,7 @@
|
||||
}
|
||||
|
||||
fill {
|
||||
@@ -117,7 +110,7 @@
|
||||
versionFamily(paperweight.minecraftVersion.map { it.split(".", "-").takeWhile { part -> part.toIntOrNull() != null }.take(2).joinToString(".") })
|
||||
version(paperweight.minecraftVersion)
|
||||
|
||||
@@ -355,4 +_,16 @@
|
||||
@@ -366,4 +_,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,5 +125,4 @@
|
||||
+ compilerArgs.add("-Xlint:-module")
|
||||
+ compilerArgs.add("-Xlint:-removal")
|
||||
+ compilerArgs.add("-Xlint:-dep-ann")
|
||||
+
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Config system framework
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
|
||||
index a4d608d64b7d3477c9144d93547fd3b4f39a1b02..f588a46d019e205be0775f0fd59dea3a57207ea4 100644
|
||||
index 693ce1c23c7be6406eda22da57aa4a1b86a08f5f..7ecfbadf673b7a90f570cb668d9a1d5116d39fdb 100644
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -107,6 +107,7 @@ public class Main {
|
||||
@@ -110,6 +110,7 @@ public class Main {
|
||||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ index a4d608d64b7d3477c9144d93547fd3b4f39a1b02..f588a46d019e205be0775f0fd59dea3a
|
||||
Bootstrap.bootStrap();
|
||||
Bootstrap.validate();
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 6f13870a1b463049dd37cf1c65d0bdecfc35b5c4..9038249341851ed67ef8392b19d49d7fb70d4137 100644
|
||||
index be15a671e0b39b455cd5983f4b90f8f3022a2ebc..28a90b03bde5e2aafefe8d9a20160ef5e4c7e3e9 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1169,6 +1169,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1168,6 +1168,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
ca.spottedleaf.moonrise.common.util.MoonriseCommon.haltExecutors();
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..a2816add1137b05cba8ba0f4581df959
|
||||
+ public void moonrise$write(final io.nanachiyo0721.shiroha.data.RegionFile regionFile) throws IOException; // Shiroha - Configurable region file format
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 9038249341851ed67ef8392b19d49d7fb70d4137..bb40ee426b09b5cc60f83145858651770b83685f 100644
|
||||
index 28a90b03bde5e2aafefe8d9a20160ef5e4c7e3e9..743b12af380c7026e741abd43f227f52207a5342 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -986,10 +986,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Correct player respawn place
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index fbe0ef19bfabfc42d9e0e08e17b08159321b3804..846b150c221fe82aef557e4fb72446dba33aa40d 100644
|
||||
index 16f49ae6736c475207f31392307e280ec06edbc3..38f327804ab6fc24bd313d14c4d28a69365a4283 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -511,8 +511,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -43,7 +43,7 @@ index fbe0ef19bfabfc42d9e0e08e17b08159321b3804..846b150c221fe82aef557e4fb72446db
|
||||
if (inChunk == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -2018,7 +2030,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1997,7 +2009,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
}
|
||||
|
||||
if (newLevel.dimension() == lastDimension) {
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ Subject: [PATCH] Do not enable any debug subscriptions
|
||||
Really this would really crash the server by accident when the operators used F3 + J or toggled the debug synchronizer
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 846b150c221fe82aef557e4fb72446dba33aa40d..e66cfcaa92b90f6b0fd26fd3cec1a5cdbb025117 100644
|
||||
index 38f327804ab6fc24bd313d14c4d28a69365a4283..297269e18111b93692bdfbc318de6e9e38c18d50 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -3504,7 +3504,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -3483,7 +3483,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
}
|
||||
|
||||
public Set<DebugSubscription<?>> debugSubscriptions() {
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Mon, 17 Aug 2026 12:14:42 +0800
|
||||
Subject: [PATCH] Do not fire teleport or respawn events anymore
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index c86b1fd5e200c478d178be32791b6e8c960d47e2..626761226aaacc7b6e429026b248be980a21d749 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1931,7 +1931,7 @@ public class ServerGamePacketListenerImpl
|
||||
}
|
||||
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags));
|
||||
// Paper end - Teleport API
|
||||
- this.cserver.getPluginManager().callEvent(event);
|
||||
+ // this.cserver.getPluginManager().callEvent(event); // Shiroha - Do not fire teleport or respawn events anymore
|
||||
|
||||
if (event.isCancelled() || !to.equals(event.getTo())) {
|
||||
relatives = Set.of(); // target pos is absolute
|
||||
@@ -1,67 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 21:32:08 +0800
|
||||
Subject: [PATCH] Entity portal-teleport speed fix
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index c6434ff2e5c211887c2e98c8462a49e0e1cb5b21..d25b1c7d1347b2731cd12cdcea7190276913de49 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1492,7 +1492,35 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
foliaProfiler.startTimer(timerId);
|
||||
try {
|
||||
// Folia end - profiler
|
||||
+ // Shiroha start - Entity portal-teleport speed fix
|
||||
if (isActive) { // Paper - EAR 2
|
||||
+ if (!(entity instanceof Player) && entity.teleportTickType == 2) { // Shiroha - after portal compensate tick
|
||||
+ entity.tick();
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
+ // removed from region while ticking
|
||||
+ return;
|
||||
+ }
|
||||
+ if (entity.handlePortal()) {
|
||||
+ // portalled
|
||||
+ return;
|
||||
+ }
|
||||
+ entity.tick();
|
||||
+ entity.teleportTickType = 0;
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (entity.handlePortal()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } else if (!(entity instanceof Player) && entity.teleportTickType == 1) { // Shiroha - portal teleport only
|
||||
+ entity.teleportTickType++;
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (entity.handlePortal()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
entity.tick();
|
||||
// Folia start - region threading
|
||||
if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
@@ -1503,6 +1531,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
// portalled
|
||||
return;
|
||||
}
|
||||
+ }
|
||||
+ // Shiroha end - Entity portal-teleport speed fix
|
||||
// Folia end - region threading
|
||||
} else {entity.inactiveTick();} // Paper - EAR 2
|
||||
profiler.pop();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index a2b57f62b745dd21e215f919d335f14f5cb1706f..af3a85087d292d3782acf4c7d15fbfb9f749868d 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -387,6 +387,7 @@ public abstract class Entity
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
public boolean isTemporarilyActive;
|
||||
public long activatedImmunityTick = Integer.MIN_VALUE;
|
||||
+ public int teleportTickType = 0; // Shiroha - Entity portal-teleport speed fix
|
||||
|
||||
public void inactiveTick() {
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Mon, 20 Apr 2026 01:10:30 +0800
|
||||
Subject: [PATCH] Entity portal-teleport speed fix
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index 35ab432bbd59aba80a6eaca1769e6aa82c8a7e46..e541189887f446844ffd77ff099d1f4dba556fe9 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1492,7 +1492,31 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
foliaProfiler.startTimer(timerId);
|
||||
try {
|
||||
// Folia end - profiler
|
||||
+ // Shiroha start - Entity portal-teleport speed fix
|
||||
if (isActive) { // Paper - EAR 2
|
||||
+ if (!(entity instanceof Player) && entity.teleportTickType == io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NEED_SYNC) { // Luminol - after portal compensate tick
|
||||
+ entity.tick();
|
||||
+ while (entity.losingTicks-- > 0) {
|
||||
+ entity.tick();
|
||||
+ }
|
||||
+ entity.teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NORMAL;
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (entity.handlePortal()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } else if (!(entity instanceof Player) && entity.teleportTickType == io.nanachiyo0721.shiroha.enums.EnumTeleportStage.STOP_TICKING) { // Luminol - portal teleport only
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.TeleportConfig.enableDelayCompensation && entity.losingTicks < io.nanachiyo0721.shiroha.config.modules.fixes.TeleportConfig.maxDelayCompensationTicks) {
|
||||
+ entity.losingTicks++;
|
||||
+ }
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (entity.handlePortal()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
entity.tick();
|
||||
// Folia start - region threading
|
||||
if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
@@ -1503,6 +1527,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
// portalled
|
||||
return;
|
||||
}
|
||||
+ }
|
||||
+ // Shiroha end - Entity portal-teleport speed fix
|
||||
// Folia end - region threading
|
||||
} else {entity.inactiveTick();} // Paper - EAR 2
|
||||
profiler.pop();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 75dabd3e7b6077b5ae8ee30048786442742b93f9..5d4d4d07cae83a98fcf16370c98a5118c39e1f5a 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -388,6 +388,8 @@ public abstract class Entity
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
public boolean isTemporarilyActive;
|
||||
public long activatedImmunityTick = Integer.MIN_VALUE;
|
||||
+ public io.nanachiyo0721.shiroha.enums.EnumTeleportStage teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NORMAL; // Shiroha - Entity portal-teleport speed fix
|
||||
+ public int losingTicks = 0; // Shiroha - Entity portal-teleport speed fix
|
||||
|
||||
public void inactiveTick() {
|
||||
}
|
||||
@@ -3597,6 +3599,7 @@ public abstract class Entity
|
||||
} else {
|
||||
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
|
||||
this.portalProcess = new PortalProcessor(portal, pos.immutable());
|
||||
+ this.teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.STOP_TICKING; // Shiroha - Entity portal-teleport speed fix
|
||||
} else if (!this.portalProcess.isInsidePortalThisTick()) {
|
||||
this.portalProcess.updateEntryPosition(pos.immutable());
|
||||
this.portalProcess.setAsInsidePortalThisTick(true);
|
||||
@@ -4559,6 +4562,7 @@ public abstract class Entity
|
||||
|
||||
public void postChangeDimension() {
|
||||
this.resetStoredPositions();
|
||||
+ this.teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NEED_SYNC; // Shiroha - Entity portal-teleport speed fix
|
||||
}
|
||||
|
||||
protected static enum PortalType {
|
||||
+125
-17
@@ -93,19 +93,27 @@ index 3ac52b025ac3e1a3f9135b8e593a385a847afe0f..d2c68c78d0a2f334169a92171081eeb4
|
||||
+ // Shiroha end
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
index b40da004b5281a041ee896ae176bfb9c4660f353..90ed5c2f1055b460472085f79a18af95fede5bb0 100644
|
||||
index b40da004b5281a041ee896ae176bfb9c4660f353..5b1baab6d52647ebec5ecb48189256b3eb4f8754 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
@@ -117,7 +117,9 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
|
||||
private boolean tryComputePath(final Mob body, final WalkTarget walkTarget, final long timestamp) {
|
||||
BlockPos targetPos = walkTarget.getTarget().currentBlockPosition();
|
||||
+ if (ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(body.level(), targetPos)) // Shiroha - Fix region threading with entity ai data access
|
||||
this.path = body.getNavigation().createPath(targetPos, 0);
|
||||
+ else this.path = null; // Shiroha - Fix region threading with entity ai data access
|
||||
this.speedModifier = walkTarget.getSpeedModifier();
|
||||
@@ -52,7 +52,7 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
Brain<?> brain = body.getBrain();
|
||||
if (this.reachedTarget(body, walkTarget)) {
|
||||
WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get();
|
||||
boolean reachedTarget = this.reachedTarget(body, walkTarget);
|
||||
- if (!reachedTarget && this.tryComputePath(body, walkTarget, level.getGameTime())) {
|
||||
+ if (!reachedTarget && walkTarget.getTarget().checkThread(body.level()) && this.tryComputePath(body, walkTarget, level.getGameTime())) { // Shiroha - Fix region threading with entity ai data access
|
||||
this.lastTargetPos = walkTarget.getTarget().currentBlockPosition();
|
||||
return true;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
|
||||
if (newPath != null && this.lastTargetPos != null) {
|
||||
WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get();
|
||||
- if (walkTarget.getTarget().currentBlockPosition().distSqr(this.lastTargetPos) > 4.0 && this.tryComputePath(body, walkTarget, level.getGameTime())) {
|
||||
+ if (walkTarget.getTarget().currentBlockPosition().distSqr(this.lastTargetPos) > 4.0 && walkTarget.getTarget().checkThread(body.level()) && this.tryComputePath(body, walkTarget, level.getGameTime())) { // Shiroha - Fix region threading with entity ai data access
|
||||
this.lastTargetPos = walkTarget.getTarget().currentBlockPosition();
|
||||
this.start(level, body, timestamp);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/PositionTracker.java b/net/minecraft/world/entity/ai/behavior/PositionTracker.java
|
||||
index ce6cf5ecfb190428e3ef9b7dd39c98e3d27a7b9d..3eea48aad910760683e30594a9c1851aa17ce88c 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/PositionTracker.java
|
||||
@@ -142,7 +150,7 @@ index 16017d819c28b077f732e2ef571eac179d24e323..2e248e4fcdec5830d83ecabf3df16311
|
||||
if (blockState == null) return false; // Paper - Prevent sync chunk loads when villagers try to find beds
|
||||
return target.pos().closerToCenterThan(body.position(), 2.0) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED);
|
||||
diff --git a/net/minecraft/world/entity/ai/memory/MemorySlot.java b/net/minecraft/world/entity/ai/memory/MemorySlot.java
|
||||
index 88a89b4c72cc99dc89d3f3cc928b2dfda4125759..b4bdc7eff97b058ee8ae2c9e4321b53c824478c5 100644
|
||||
index 88a89b4c72cc99dc89d3f3cc928b2dfda4125759..9f85ba205d4e7b69e56ba538c00b1be6e1a5a617 100644
|
||||
--- a/net/minecraft/world/entity/ai/memory/MemorySlot.java
|
||||
+++ b/net/minecraft/world/entity/ai/memory/MemorySlot.java
|
||||
@@ -13,7 +13,7 @@ public class MemorySlot<T> {
|
||||
@@ -154,7 +162,7 @@ index 88a89b4c72cc99dc89d3f3cc928b2dfda4125759..b4bdc7eff97b058ee8ae2c9e4321b53c
|
||||
if (this.hasValue() && this.canExpire()) {
|
||||
if (this.hasExpired()) {
|
||||
this.clear();
|
||||
@@ -21,6 +21,41 @@ public class MemorySlot<T> {
|
||||
@@ -21,6 +21,57 @@ public class MemorySlot<T> {
|
||||
this.timeToLive--;
|
||||
}
|
||||
}
|
||||
@@ -168,6 +176,22 @@ index 88a89b4c72cc99dc89d3f3cc928b2dfda4125759..b4bdc7eff97b058ee8ae2c9e4321b53c
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // type: list of entity
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enabledForEntityListed && this.value instanceof java.util.List<?> list) {
|
||||
+ // check first if it's matched type
|
||||
+ if (!list.isEmpty() && list.getFirst() instanceof net.minecraft.world.entity.Entity) {
|
||||
+ // matched, do check
|
||||
+ for (Object entityInObject : list) {
|
||||
+ final net.minecraft.world.entity.Entity entity = (net.minecraft.world.entity.Entity) entityInObject;
|
||||
+
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
||||
+ this.clear();
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // type: block_pos
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enabledForBlockPos && this.value instanceof net.minecraft.core.BlockPos blockPos) {
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ownerLevel, blockPos)) {
|
||||
@@ -196,15 +220,68 @@ index 88a89b4c72cc99dc89d3f3cc928b2dfda4125759..b4bdc7eff97b058ee8ae2c9e4321b53c
|
||||
}
|
||||
|
||||
public static <T> MemorySlot<T> create() {
|
||||
diff --git a/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java b/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java
|
||||
index 5c967b55f6ad3b660e9cdf74fadd90c5ea67afb9..7af28b58afa6538aa47fc25da4f3b911942b7c5a 100644
|
||||
--- a/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java
|
||||
+++ b/net/minecraft/world/entity/ai/memory/NearestVisibleLivingEntities.java
|
||||
@@ -39,7 +39,7 @@ public class NearestVisibleLivingEntities {
|
||||
|
||||
public Optional<LivingEntity> findClosest(final Predicate<LivingEntity> filter) {
|
||||
for (LivingEntity nearbyEntity : this.nearbyEntities) {
|
||||
- if (filter.test(nearbyEntity) && this.lineOfSightTest.test(nearbyEntity)) {
|
||||
+ if (this.getExtraFilterForThreadCheck(filter).test(nearbyEntity) && this.lineOfSightTest.test(nearbyEntity)) { // Shiroha - Fix region threading with entity ai data access (one side is enough for thread checking)
|
||||
return Optional.of(nearbyEntity);
|
||||
}
|
||||
}
|
||||
@@ -48,24 +48,35 @@ public class NearestVisibleLivingEntities {
|
||||
}
|
||||
|
||||
public Iterable<LivingEntity> findAll(final Predicate<LivingEntity> filter) {
|
||||
- return Iterables.filter(this.nearbyEntities, entity -> filter.test(entity) && this.lineOfSightTest.test(entity));
|
||||
+ return Iterables.filter(this.nearbyEntities, entity -> this.getExtraFilterForThreadCheck(filter).test(entity) && this.lineOfSightTest.test(entity)); // Shiroha - Fix region threading with entity ai data access (one side is enough for thread checking)
|
||||
}
|
||||
|
||||
public Stream<LivingEntity> find(final Predicate<LivingEntity> filter) {
|
||||
- return this.nearbyEntities.stream().filter(entity -> filter.test(entity) && this.lineOfSightTest.test(entity));
|
||||
+ return this.nearbyEntities.stream().filter(entity -> this.getExtraFilterForThreadCheck(filter).test(entity) && this.lineOfSightTest.test(entity)); // Shiroha - Fix region threading with entity ai data access (one side is enough for thread checking)
|
||||
}
|
||||
|
||||
public boolean contains(final LivingEntity targetEntity) {
|
||||
- return this.nearbyEntities.contains(targetEntity) && this.lineOfSightTest.test(targetEntity);
|
||||
+ return this.nearbyEntities.contains(targetEntity) && this.getExtraFilterForThreadCheck(this.lineOfSightTest).test(targetEntity); // Shiroha - Fix region threading with entity ai data access
|
||||
}
|
||||
|
||||
public boolean contains(final Predicate<LivingEntity> filter) {
|
||||
for (LivingEntity nearbyEntity : this.nearbyEntities) {
|
||||
- if (filter.test(nearbyEntity) && this.lineOfSightTest.test(nearbyEntity)) {
|
||||
+ if (this.getExtraFilterForThreadCheck(filter).test(nearbyEntity) && this.lineOfSightTest.test(nearbyEntity)) { // Shiroha - Fix region threading with entity ai data access (one side is enough for thread checking)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
+ // Shiroha start - Fix region threading with entity ai data access
|
||||
+ private Predicate<LivingEntity> getExtraFilterForThreadCheck(Predicate<LivingEntity> original) {
|
||||
+ return io.nanachiyo0721.shiroha.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enableForNearestLivingEntities ? ent -> {
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ent)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return original.test(ent);
|
||||
+ } : original;
|
||||
+ }
|
||||
+ // Shiroha end - Fix region threading with entity ai data access
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
|
||||
index e44814cfb6afb594456b8215bd13a92e93de2c85..c174330cc437e92a7221ff369fbf69da98d481dd 100644
|
||||
index e44814cfb6afb594456b8215bd13a92e93de2c85..d4b65f13c137495d436b7e8133e0ce09ee2e08c0 100644
|
||||
--- a/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
|
||||
+++ b/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
|
||||
@@ -60,6 +60,17 @@ public class FlyingPathNavigation extends PathNavigation {
|
||||
|
||||
if (!this.isDone()) {
|
||||
Vec3 target = this.path.getNextEntityPos(this.mob);
|
||||
+ // Shiroha - Fix region threading with entity ai data access
|
||||
+ // Shiroha start - Fix region threading with entity ai data access
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.PathfindingFixesConfig.breakDownPathfindingWhenOutOfRegion) {
|
||||
+ // we assume that:
|
||||
+ // 1. The code above doesn't touch the 'main thread context' with the position from 'this.path'
|
||||
@@ -219,7 +296,7 @@ index e44814cfb6afb594456b8215bd13a92e93de2c85..c174330cc437e92a7221ff369fbf69da
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
index 2ea1ec39a37899ae1510d0036aa670e758077537..15c739ce4dc521b58811f72b11e557fe715d803a 100644
|
||||
index 2ea1ec39a37899ae1510d0036aa670e758077537..3acafc2aa1219efb0d7a591b91afa42640bcd584 100644
|
||||
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
@@ -188,6 +188,18 @@ public abstract class PathNavigation {
|
||||
@@ -241,8 +318,39 @@ index 2ea1ec39a37899ae1510d0036aa670e758077537..15c739ce4dc521b58811f72b11e557fe
|
||||
ProfilerFiller profiler = Profiler.get();
|
||||
profiler.push("pathfind");
|
||||
BlockPos fromPos = above ? this.mob.blockPosition().above() : this.mob.blockPosition();
|
||||
@@ -286,6 +298,17 @@ public abstract class PathNavigation {
|
||||
|
||||
if (!this.isDone()) {
|
||||
Vec3 target = this.path.getNextEntityPos(this.mob);
|
||||
+ // Shiroha start - Fix region threading with entity ai data access
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.PathfindingFixesConfig.breakDownPathfindingWhenOutOfRegion) {
|
||||
+ // we assume that:
|
||||
+ // 1. The code above doesn't touch the 'main thread context' with the position from 'this.path'
|
||||
+ // 2. The pathfinder could correctly recompute or discard the incorrect target position and this situation is happening rarely
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.mob.level(), target)) {
|
||||
+ this.hasDelayedRecomputation = true;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Shiroha end
|
||||
this.mob.getMoveControl().setWantedPosition(target.x, this.getGroundY(target), target.z, this.speedModifier);
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java b/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
|
||||
index 2b5ba8f01b57b5e54bba4a8624f17e1b550d818e..bf127e91354b784dc8f7db910c46e3f7c42eec67 100644
|
||||
--- a/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
|
||||
+++ b/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java
|
||||
@@ -44,7 +44,7 @@ public class WallClimberNavigation extends GroundPathNavigation {
|
||||
super.tick();
|
||||
} else {
|
||||
if (this.pathToPosition != null) {
|
||||
- if (!this.pathToPosition.closerToCenterThan(this.mob.position(), this.mob.getBbWidth())
|
||||
+ if ((io.nanachiyo0721.shiroha.config.modules.fixes.PathfindingFixesConfig.breakDownPathfindingWhenOutOfRegion && ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.mob.level(), this.pathToPosition)) && !this.pathToPosition.closerToCenterThan(this.mob.position(), this.mob.getBbWidth()) // Shiroha - Fix region threading with entity ai data access
|
||||
&& (
|
||||
!(this.mob.getY() > this.pathToPosition.getY())
|
||||
|| !BlockPos.containing(this.pathToPosition.getX(), this.mob.getY(), this.pathToPosition.getZ())
|
||||
diff --git a/net/minecraft/world/entity/animal/allay/AllayAi.java b/net/minecraft/world/entity/animal/allay/AllayAi.java
|
||||
index c3667e7997551e0f5ce63bc6ee890082d1431400..7caa2b2ee9b4063696d1bd80803d6ec84f24c1f5 100644
|
||||
index c3667e7997551e0f5ce63bc6ee890082d1431400..edf2be5c1a48d80eaf900c782d02ea6f517fee2c 100644
|
||||
--- a/net/minecraft/world/entity/animal/allay/AllayAi.java
|
||||
+++ b/net/minecraft/world/entity/animal/allay/AllayAi.java
|
||||
@@ -112,6 +112,16 @@ public class AllayAi {
|
||||
@@ -254,7 +362,7 @@ index c3667e7997551e0f5ce63bc6ee890082d1431400..7caa2b2ee9b4063696d1bd80803d6ec8
|
||||
+ final BlockPos targetPos = position.pos();
|
||||
+
|
||||
+ // thread checks
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(targetLevel, targetPos)) {
|
||||
+ if (targetLevel == null || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(targetLevel, targetPos)) {
|
||||
+ brain.eraseMemory(MemoryModuleType.LIKED_NOTEBLOCK_POSITION); // The memory value is not being belong to current tick region anymore
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+2
-2
@@ -8,10 +8,10 @@ Inspired by https://github.com/CraftCanvasMC/Canvas/blob/ver/1.21.8/canvas-serve
|
||||
but Canvas loses its main thread checks so fixed that btw
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
index 40b4eeb561a91264b9ab6ddc49cb8a93daae84a4..c62584e022260cf781a0414be04a3af4a70160ef 100644
|
||||
index 77c4670868a95dc7b13461dfa67af34b0a3c329a..0485ce2a56adedc200cc0cd441df7cce88da66a8 100644
|
||||
--- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -290,13 +290,14 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
@@ -299,13 +299,14 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
// Paper start
|
||||
@Override
|
||||
public void disconnectAsync(final net.minecraft.network.DisconnectionDetails disconnectionInfo) {
|
||||
+5
-5
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix riding statistics desync
|
||||
Referred to: https://github.com/CraftCanvasMC/Canvas/commit/057175b0c10d5a4d1d9059fd9d077750c32633b2
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index e66cfcaa92b90f6b0fd26fd3cec1a5cdbb025117..b08af3a31b80125d02a4f2ff85311d2f9fdcc0ae 100644
|
||||
index 297269e18111b93692bdfbc318de6e9e38c18d50..c29167dee1855b142c78d9ae8700b25d97301f12 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2537,7 +2537,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -2516,7 +2516,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ index e66cfcaa92b90f6b0fd26fd3cec1a5cdbb025117..b08af3a31b80125d02a4f2ff85311d2f
|
||||
int distance = Math.round((float)Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
Entity vehicle = this.getVehicle();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index af3a85087d292d3782acf4c7d15fbfb9f749868d..aa3ed23fbfd85117101e4ef15123b48d9673c5b0 100644
|
||||
index 5d4d4d07cae83a98fcf16370c98a5118c39e1f5a..f18f8e24442ceb418996a86bca20ae7c0700af8a 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4199,7 +4199,13 @@ public abstract class Entity
|
||||
@@ -4203,7 +4203,13 @@ public abstract class Entity
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ index af3a85087d292d3782acf4c7d15fbfb9f749868d..aa3ed23fbfd85117101e4ef15123b48d
|
||||
java.util.ArrayDeque<EntityTreeNode> queue = new java.util.ArrayDeque<>();
|
||||
queue.add(this);
|
||||
|
||||
@@ -4212,14 +4218,24 @@ public abstract class Entity
|
||||
@@ -4216,14 +4222,24 @@ public abstract class Entity
|
||||
|
||||
for (EntityTreeNode passenger : passengers) {
|
||||
queue.add(passenger);
|
||||
+1
-1
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix player auto saving ignores interval
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index b08af3a31b80125d02a4f2ff85311d2f9fdcc0ae..5f5c8f20169015627a265d0a974e89cb47a4a70c 100644
|
||||
index c29167dee1855b142c78d9ae8700b25d97301f12..1cafca1758e7fcac59a3b3dadf28b432da82e51a 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -208,7 +208,7 @@ import org.slf4j.Logger;
|
||||
+11
-7
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix dragon part desync
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
|
||||
index b31b55f00e2ce1bd6c1011fe852bd1dbb37de524..772e07af051b0f88582434b4cfcba42a666ab7a0 100644
|
||||
index aa53138b3670a8337b639472a6ab5ce46702ff76..6be786dcd9f02c0b59ca90453ddabff936d1cfdf 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
|
||||
@@ -97,6 +97,7 @@ public final class ServerEntityLookup extends EntityLookup {
|
||||
@@ -93,6 +93,7 @@ public final class ServerEntityLookup extends EntityLookup {
|
||||
if (entity instanceof ThrownEnderpearl enderpearl) {
|
||||
this.addEnderPearl(CoordinateUtils.getChunkKey(enderpearl.chunkPosition()), enderpearl.getId()); // Folia - region threading
|
||||
}
|
||||
@@ -17,10 +17,10 @@ index b31b55f00e2ce1bd6c1011fe852bd1dbb37de524..772e07af051b0f88582434b4cfcba42a
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index aa3ed23fbfd85117101e4ef15123b48d9673c5b0..fee93b64bc42cd49ea9ff007e2fbd7d4ef80d58b 100644
|
||||
index f18f8e24442ceb418996a86bca20ae7c0700af8a..dee189bea3e90fd5dd503a2fe6b8a5c986589c62 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4459,6 +4459,7 @@ public abstract class Entity
|
||||
@@ -4463,6 +4463,7 @@ public abstract class Entity
|
||||
Entity copy = this.getType().create(destination, EntitySpawnReason.DIMENSION_TRAVEL);
|
||||
copy.restoreFrom(this);
|
||||
copy.transform(pos, yaw, pitch, velocity);
|
||||
@@ -29,10 +29,10 @@ index aa3ed23fbfd85117101e4ef15123b48d9673c5b0..fee93b64bc42cd49ea9ff007e2fbd7d4
|
||||
// for example, clearing of inventory after switching dimensions
|
||||
this.postRemoveAfterChangingDimensions();
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index ab921ab4b4cc860abd77744f2bd201013e136e51..0ddf5ef000103b1ef88f3d3e232d734b2e198944 100644
|
||||
index ab921ab4b4cc860abd77744f2bd201013e136e51..226198ae04bf53528dbeb6a45f6cfb6f42342a36 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -1011,4 +1011,12 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
@@ -1011,4 +1011,16 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
return 500;
|
||||
}
|
||||
// Paper end - init expToDrop for already dying spawned dragon
|
||||
@@ -40,7 +40,11 @@ index ab921ab4b4cc860abd77744f2bd201013e136e51..0ddf5ef000103b1ef88f3d3e232d734b
|
||||
+ // Shiroha start - Fix dragon part desync
|
||||
+ public void syncDragonPartsAfterTeleportTransform() {
|
||||
+ for (EnderDragonPart part : this.subEntities) {
|
||||
+ this.tickPart(part, 0.0, 0.0, 0.0); // offset -> 0.0
|
||||
+ this.tickPart(part,
|
||||
+ Math.abs(part.getBoundingBox().maxX - part.getBoundingBox().minX),
|
||||
+ Math.abs(part.getBoundingBox().maxY - part.getBoundingBox().minY),
|
||||
+ Math.abs(part.getBoundingBox().maxZ - part.getBoundingBox().minZ)
|
||||
+ ); // offset -> 0.0
|
||||
+ }
|
||||
+ }
|
||||
+ // Shiroha end
|
||||
+1
-1
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix misbehaved ender pearls when player switched dimension
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
index 501a0e89cc7bcfce6793f059b080b38666e0fb64..e8015ed6f4885fb324964a44752014bf0bbd7326 100644
|
||||
index d0dba5cc351903fb762e231a95f302479794185f..465b21e6f787938993cc329873a826d9454fcd4b 100644
|
||||
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
@@ -264,7 +264,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
+28
-3
@@ -8,10 +8,10 @@ On folia, entity usually cannot move out of the tickregion, but sometimes it act
|
||||
Reference from : https://github.com/KaiijuMC/Kaiiju/blob/ver/1.20.1/patches/server/0040-Teleport-async-if-we-cannot-move-entity-off-main.patch
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index fee93b64bc42cd49ea9ff007e2fbd7d4ef80d58b..375d4a504cd3f2f2495315cc7456dd245e9d2547 100644
|
||||
index dee189bea3e90fd5dd503a2fe6b8a5c986589c62..6715a4c8078fe49c929f24d87df76bef04e5b43a 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1163,6 +1163,19 @@ public abstract class Entity
|
||||
@@ -1165,6 +1165,20 @@ public abstract class Entity
|
||||
this.moveStartZ = this.getZ();
|
||||
this.moveVector = delta;
|
||||
}
|
||||
@@ -22,15 +22,40 @@ index fee93b64bc42cd49ea9ff007e2fbd7d4ef80d58b..375d4a504cd3f2f2495315cc7456dd24
|
||||
+ // not NaN (Prevent incorrect checks under NaN minecarts)
|
||||
+ if (!Double.isNaN(finalPosition.x) && !Double.isNaN(finalPosition.y) && !Double.isNaN(finalPosition.z)) {
|
||||
+ // kill tick passively if it's moving out of region and we'll catch this exception
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level,finalPosition)) {
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, finalPosition)) {
|
||||
+ throw new io.nanachiyo0721.shiroha.utils.entity.EntityMoveOutOfRegionException(this, delta, moverType);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Guard delta too large at the initial input
|
||||
+ // Shiroha end
|
||||
try {
|
||||
// Paper end - detailed watchdog information
|
||||
if (this.noPhysics) {
|
||||
@@ -1203,6 +1217,23 @@ public abstract class Entity
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Shiroha start - Fix high velocity moving issue
|
||||
+ // Filter the threads as it may be called by the chunk system worker thread
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.FoliaEntityMovingFixConfig.enabled && ca.spottedleaf.moonrise.common.util.TickThread.isTickThread()){
|
||||
+ var finalPosition = delta.add(this.position);
|
||||
+ // not NaN (Prevent incorrect checks under NaN minecarts)
|
||||
+ if (!Double.isNaN(finalPosition.x) && !Double.isNaN(finalPosition.y) && !Double.isNaN(finalPosition.z)) {
|
||||
+ // kill tick passively if it's moving out of region and we'll catch this exception
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, finalPosition)) {
|
||||
+ throw new io.nanachiyo0721.shiroha.utils.entity.EntityMoveOutOfRegionException(this, delta, moverType);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Guard against delta too large when it was processed above
|
||||
+ // note: following method call "maybeBackOffFromEdge" have indirect access to world data, so gurad is needed.
|
||||
+ // We ignore to check the final delta movemnt after calling "colliding" as it's clamped at least unless the AABB of the entity is
|
||||
+ // in a large scale, but it's never allowed and reasonable to have
|
||||
+ // Shiroha end
|
||||
delta = this.maybeBackOffFromEdge(delta, moverType);
|
||||
Vec3 movement = this.collide(delta);
|
||||
double movementLength = movement.lengthSqr();
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index a0eb1f608a99301e0197ab1d1a6fbbb0a0be4ce0..21b3fcba9e80082ad33a4331f27758cffef163f8 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+1
-16
@@ -17,23 +17,8 @@ index 2a64a5b2cf049661fe3f5a22ddfa39979624f5ec..0879af04be9dca539f0543f858e2fe46
|
||||
cause, teleportFlags, onComplete
|
||||
);
|
||||
},
|
||||
diff --git a/net/minecraft/server/commands/TeleportCommand.java b/net/minecraft/server/commands/TeleportCommand.java
|
||||
index 13d7965fd4f99f0848b080349df41f8b1c31a19b..4e58868bfb23671bde6296ee9361931564a77f9c 100644
|
||||
--- a/net/minecraft/server/commands/TeleportCommand.java
|
||||
+++ b/net/minecraft/server/commands/TeleportCommand.java
|
||||
@@ -248,8 +248,8 @@ public class TeleportCommand {
|
||||
// Folia start - region threading
|
||||
if (true) {
|
||||
Vec3 posFinal = new Vec3(x, y, z);
|
||||
- Float yawFinal = Float.valueOf(newYRot);
|
||||
- Float pitchFinal = Float.valueOf(newXRot);
|
||||
+ Float yawFinal = Float.valueOf(newYRot + victim.getYRot()); // Shiroha - Fix teleport missing original rotation and velocity
|
||||
+ Float pitchFinal = Float.valueOf(newXRot + victim.getXRot()); // Shiroha - Fix teleport missing original rotation and velocity
|
||||
victim.getBukkitEntity().taskScheduler.schedule((Entity nmsEntity) -> {
|
||||
nmsEntity.stopRiding();
|
||||
nmsEntity.teleportAsync(
|
||||
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
index e8015ed6f4885fb324964a44752014bf0bbd7326..93aee574b340739c6686f8ad9ab523e6257023f7 100644
|
||||
index 465b21e6f787938993cc329873a826d9454fcd4b..35ec38780ed3c171fb9ae522a4693ac69ace5b2e 100644
|
||||
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
@@ -99,7 +99,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sun, 26 Jul 2026 22:25:52 +0800
|
||||
Subject: [PATCH] Fix wrong variable passing in RegionizedWorldData
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index c8f13da82c55cc5c1fe1c922a87e3eccb1117937..55dabe4dd77cff25ec9b1bc26749a1b56c36e2a2 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -720,7 +720,7 @@ public final class RegionizedWorldData {
|
||||
}
|
||||
|
||||
public void setTickingBlockEntities(final boolean to) {
|
||||
- this.tickingBlockEntities = true;
|
||||
+ this.tickingBlockEntities = to; // Shiroha - Fix wrong variable passing in RegionizedWorldData
|
||||
}
|
||||
|
||||
public List<TickingBlockEntity> getBlockEntityTickers() {
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sun, 26 Jul 2026 22:14:00 +0800
|
||||
Subject: [PATCH] Fix wrong variable passing in ThreadedRegionizer
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
index 3449918b5001bb39c541ce1168eac4acf9144e1f..a8333bfa5951537621620658dcd9544a8aca6aff 100644
|
||||
--- a/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
+++ b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
@@ -752,8 +752,8 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
|
||||
final int x1 = CoordinateUtils.getChunkX(k1);
|
||||
final int x2 = CoordinateUtils.getChunkX(k2);
|
||||
|
||||
- final int z1 = CoordinateUtils.getChunkZ(x1);
|
||||
- final int z2 = CoordinateUtils.getChunkZ(x2);
|
||||
+ final int z1 = CoordinateUtils.getChunkZ(k1); // Shiroha - Fix wrong variable passing in ThreadedRegionizer
|
||||
+ final int z2 = CoordinateUtils.getChunkZ(k2); // Shiroha - Fix wrong variable passing in ThreadedRegionizer
|
||||
|
||||
final int zCompare = Integer.compare(z1, z2);
|
||||
if (zCompare != 0) {
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sun, 26 Jul 2026 20:42:44 +0800
|
||||
Subject: [PATCH] Fix wrong ticket update determination in RegionizedTaskQueue
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
index fefec2930716b02b8e14f4b4f0fe3226fe53a617..037697e6364c73057b1fbac354bd78d8bf35bc7b 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
@@ -289,14 +289,17 @@ public final class RegionizedTaskQueue {
|
||||
boolean executeTickTasks = allowedTickTasks > 0;
|
||||
boolean executeChunkTasks = allowedChunkTasks > 0;
|
||||
boolean executeGlobalTasks = true;
|
||||
+ boolean processedChunkTask = false; // Shiroha - Fix wrong ticket update determination in RegionizedTaskQueue
|
||||
|
||||
do {
|
||||
executeTickTasks = executeTickTasks && allowedTickTasks-- > 0 && tickTaskQueue.executeTask();
|
||||
executeChunkTasks = executeChunkTasks && allowedChunkTasks-- > 0 && chunkTaskQueue.executeTask();
|
||||
executeGlobalTasks = executeGlobalTasks && this.worldRegionTaskData.executeGlobalChunkTask();
|
||||
+
|
||||
+ processedChunkTask |= (executeChunkTasks | executeGlobalTasks); // Shiroha - Fix wrong ticket update determination in RegionizedTaskQueue
|
||||
} while (executeTickTasks | executeChunkTasks | executeGlobalTasks);
|
||||
|
||||
- if (allowedChunkTasks > 0) {
|
||||
+ if (processedChunkTask) { // Shiroha - Fix wrong ticket update determination in RegionizedTaskQueue
|
||||
// if we executed chunk tasks, we should try to process ticket updates for full status changes
|
||||
this.worldRegionTaskData.world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates();
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Tue, 28 Jul 2026 19:25:20 +0800
|
||||
Subject: [PATCH] Fix folia nether portal ticket placement
|
||||
|
||||
|
||||
diff --git a/net/minecraft/util/BlockUtil.java b/net/minecraft/util/BlockUtil.java
|
||||
index ea93ac07ec6d4e83d1d0904daf721132e2bbecc3..947413df55b972a5f866d5717fdb9e925a89ad60 100644
|
||||
--- a/net/minecraft/util/BlockUtil.java
|
||||
+++ b/net/minecraft/util/BlockUtil.java
|
||||
@@ -138,12 +138,20 @@ public class BlockUtil {
|
||||
public final BlockPos minCorner;
|
||||
public final int axis1Size;
|
||||
public final int axis2Size;
|
||||
+ public BlockPos foundOrigin; // Shiroha - Fix folia nether portal ticket placement
|
||||
|
||||
public FoundRectangle(final BlockPos minCorner, final int axis1Size, final int axis2Size) {
|
||||
this.minCorner = minCorner;
|
||||
this.axis1Size = axis1Size;
|
||||
this.axis2Size = axis2Size;
|
||||
+ this.foundOrigin = minCorner; // Shiroha - Fix folia nether portal ticket placement - prevent edge conditions(idk if someone would do this so just prevent it)
|
||||
}
|
||||
+ // Shiroha start - Fix folia nether portal ticket placement
|
||||
+ public FoundRectangle withFoundOrigin(BlockPos origin) {
|
||||
+ this.foundOrigin = origin;
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Shiroha end
|
||||
}
|
||||
|
||||
public static class IntBounds {
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 6715a4c8078fe49c929f24d87df76bef04e5b43a..216c7a6c9a139c998809b98134706a52ad271518 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4746,7 +4746,7 @@ public abstract class Entity
|
||||
portalInfoCompletable.complete(
|
||||
new TeleportTransition(destination, Vec3.atCenterOf(targetPos), Vec3.ZERO,
|
||||
90.0f, 0.0f,
|
||||
- TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET))
|
||||
+ TeleportTransition.PLAY_PORTAL_SOUND.then(ent -> ent.placePortalTicket(targetPos))) // Shiroha - Fix folia nether portal ticket placement
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -4758,7 +4758,7 @@ public abstract class Entity
|
||||
portalInfoCompletable.complete(
|
||||
net.minecraft.world.level.block.NetherPortalBlock.createDimensionTransition(
|
||||
destination, portal, originalPortalDirection, relativePos,
|
||||
- Entity.this, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET)
|
||||
+ Entity.this, TeleportTransition.PLAY_PORTAL_SOUND.then(ent -> ent.placePortalTicket(portal.foundOrigin)) // Shiroha - Fix folia nether portal ticket placement
|
||||
)
|
||||
);
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/block/NetherPortalBlock.java b/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
index 29fc9521c2c8333c999647dd833899393a838064..9022be7b8c415cd6341f45fa9525c59ec10ff985 100644
|
||||
--- a/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -204,7 +204,7 @@ public class NetherPortalBlock extends Block implements Portal {
|
||||
|
||||
return BlockUtil.getLargestRectangleAround(found, portalState.getValue(BlockStateProperties.HORIZONTAL_AXIS), 21, Direction.Axis.Y, 21, (pos) -> {
|
||||
return world.getBlockStateFromEmptyChunk(pos) == portalState;
|
||||
- });
|
||||
+ }).withFoundOrigin(found); // Shiroha - Fix folia nether portal ticket placement
|
||||
}
|
||||
// Folia end - region threading
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sun, 9 Aug 2026 14:35:48 +0800
|
||||
Subject: [PATCH] Fix incorrect ticket lock size computing
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
index 8b06d0c893e07c969d35c4d7528927552c27b48b..352325aeea9e4f797893911d81703262b198ecd5 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
@@ -941,14 +941,18 @@ public final class ChunkHolderManager {
|
||||
|
||||
final int lowerChunkX = CoordinateUtils.getChunkX(sectionKey) << sectionShift;
|
||||
final int lowerChunkZ = CoordinateUtils.getChunkZ(sectionKey) << sectionShift;
|
||||
+ // Shiroha start - Fix incorrect ticket lock size computing
|
||||
+ final int upperChunkX = lowerChunkX + (1 << sectionShift) - 1;
|
||||
+ final int upperChunkZ = lowerChunkZ + (1 << sectionShift) - 1;
|
||||
+ // Shiroha end - Fix incorrect ticket lock size computing
|
||||
|
||||
final int ticketShift = ThreadedTicketLevelPropagator.SECTION_SHIFT;
|
||||
final int ticketMask = (1 << ticketShift) - 1;
|
||||
final ReentrantAreaLock.Node ticketLock = this.ticketLockArea.lock(
|
||||
((lowerChunkX >> ticketShift) - 1) << ticketShift,
|
||||
((lowerChunkZ >> ticketShift) - 1) << ticketShift,
|
||||
- (((lowerChunkX >> ticketShift) + 1) << ticketShift) | ticketMask,
|
||||
- (((lowerChunkZ >> ticketShift) + 1) << ticketShift) | ticketMask
|
||||
+ (((upperChunkX >> ticketShift) + 1) << ticketShift) | ticketMask, // Shiroha - Fix incorrect ticket lock size computing
|
||||
+ (((upperChunkZ >> ticketShift) + 1) << ticketShift) | ticketMask // Shiroha - Fix incorrect ticket lock size computing
|
||||
);
|
||||
|
||||
try {
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Wed, 12 Aug 2026 16:31:01 +0800
|
||||
Subject: [PATCH] Fix thread unsafe collections use in PlayerList
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 259eb7574841b1b885093b534440f8a40db4e8e2..c70d3169002681c5f2131ca8e98ef7d42c6dc4fa 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -132,7 +132,7 @@ public abstract class PlayerList {
|
||||
|
||||
// CraftBukkit start
|
||||
private org.bukkit.craftbukkit.CraftServer cserver;
|
||||
- private final Map<String,ServerPlayer> playersByName = new java.util.HashMap<>();
|
||||
+ private final Map<String,ServerPlayer> playersByName = new java.util.concurrent.ConcurrentHashMap<>(); // Folia - region threading - change to CHM - Note: we do NOT expect concurrency PER KEY!
|
||||
public @Nullable String collideRuleTeamName; // Paper - Configurable player collision
|
||||
|
||||
// Folia start - region threading
|
||||
+6
-6
@@ -6,7 +6,7 @@ Subject: [PATCH] Force disable builtin spark plugin
|
||||
The spark passed down from paper has some memory leaking issue, so we fully removed it from the code to prevent that memory leaking issue.
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index bb40ee426b09b5cc60f83145858651770b83685f..3e62b4beb0e5ada82f83b0ebec35ca21a072a2e2 100644
|
||||
index 743b12af380c7026e741abd43f227f52207a5342..d4cb160e285a807597523de840a4d1c4f9fced27 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -672,8 +672,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -29,7 +29,7 @@ index bb40ee426b09b5cc60f83145858651770b83685f..3e62b4beb0e5ada82f83b0ebec35ca21
|
||||
this.server.disablePlugins();
|
||||
this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
|
||||
}
|
||||
@@ -1350,7 +1350,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1349,7 +1349,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.statusIcon = this.loadStatusIcon().orElse(null);
|
||||
this.status = this.buildServerStatus();
|
||||
|
||||
@@ -38,7 +38,7 @@ index bb40ee426b09b5cc60f83145858651770b83685f..3e62b4beb0e5ada82f83b0ebec35ca21
|
||||
// Folia start - region threading
|
||||
if (true) {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().init(); // Folia - region threading - only after loading worlds
|
||||
@@ -1664,7 +1664,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1663,7 +1663,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
if (this.emptyTicks >= emptyTickThreshold) {
|
||||
@@ -47,7 +47,7 @@ index bb40ee426b09b5cc60f83145858651770b83685f..3e62b4beb0e5ada82f83b0ebec35ca21
|
||||
if (this.emptyTicks == emptyTickThreshold) {
|
||||
LOGGER.info("Server empty for {} seconds, pausing", this.pauseWhenEmptySeconds());
|
||||
this.autoSave();
|
||||
@@ -1683,7 +1683,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1682,7 +1682,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end - avoid issues with certain tasks not processing during sleep
|
||||
//this.server.spark.executeMainThreadTasks(); // Paper - spark // Folia - region threading
|
||||
this.tickConnection();
|
||||
@@ -56,7 +56,7 @@ index bb40ee426b09b5cc60f83145858651770b83685f..3e62b4beb0e5ada82f83b0ebec35ca21
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1696,7 +1696,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1695,7 +1695,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
};
|
||||
// Folia end - region threading
|
||||
|
||||
@@ -65,7 +65,7 @@ index bb40ee426b09b5cc60f83145858651770b83685f..3e62b4beb0e5ada82f83b0ebec35ca21
|
||||
new com.destroystokyo.paper.event.server.ServerTickStartEvent((int)region.getCurrentTick()).callEvent(); // Paper - Server Tick Events // Folia - region threading
|
||||
// Folia start - region threading
|
||||
if (region != null) {
|
||||
@@ -1783,7 +1783,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1782,7 +1782,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long remaining = scheduledEnd - endTime; // Folia - region ticking
|
||||
new com.destroystokyo.paper.event.server.ServerTickEndEvent((int)io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick(), ((double)(endTime - startTime) / 1000000D), remaining).callEvent(); // Folia - region ticking
|
||||
// Paper end - Server Tick Events
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Wed, 29 Jul 2026 18:39:56 +0800
|
||||
Subject: [PATCH] RegionizedTaskQueue queue TTL optimization
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
index 037697e6364c73057b1fbac354bd78d8bf35bc7b..3a7e4b57dc41030295f5e9da58a0fcd1270c521f 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
public final class RegionizedTaskQueue {
|
||||
|
||||
private static final TicketType<Long> TASK_QUEUE_TICKET = ChunkSystemTicketType.create("task_queue_ticket", Long::compareTo);
|
||||
+ private static final long QUEUE_MAX_TTL_TICKS = 5L; // Shiroha - RegionizedTaskQueue queue TTL optimization
|
||||
|
||||
public PrioritisedExecutor.PrioritisedTask createChunkTask(final ServerLevel world, final int chunkX, final int chunkZ,
|
||||
final Runnable run) {
|
||||
@@ -155,6 +156,68 @@ public final class RegionizedTaskQueue {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Shiroha start - RegionizedTaskQueue queue TTL optimization
|
||||
+ public void tickQueueReferenceTTL() {
|
||||
+ final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> currentRegion
|
||||
+ = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegion();
|
||||
+ if (currentRegion == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final ReferenceCountData[] toRemoveTicket = new ReferenceCountData[1];
|
||||
+
|
||||
+ final it.unimi.dsi.fastutil.longs.LongIterator sectionsIterator = currentRegion.getOwnedSectionsUnsynchronised();
|
||||
+ while (sectionsIterator.hasNext()) {
|
||||
+ final long sectionKey = sectionsIterator.nextLong();
|
||||
+ final int sectionX = CoordinateUtils.getChunkX(sectionKey);
|
||||
+ final int sectionZ = CoordinateUtils.getChunkZ(sectionKey);
|
||||
+
|
||||
+ final int chunkX = sectionX << this.world.regioniser.sectionChunkShift;
|
||||
+ final int chunkZ = sectionZ << this.world.regioniser.sectionChunkShift;
|
||||
+ final long coord = CoordinateUtils.getChunkKey(chunkX, chunkZ);
|
||||
+ final ReferenceCountData counterData = this.referenceCounters.get(coord);
|
||||
+
|
||||
+ // removed
|
||||
+ if (counterData == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // do ttl
|
||||
+ long curr = counterData.referenceTTL.get();
|
||||
+ // successfully decreased ttl
|
||||
+ if (curr == (curr = counterData.referenceTTL.compareAndExchange(curr, curr - 1))) {
|
||||
+ if (counterData.referenceCount.get() != 0L) {
|
||||
+ // still has reference, pump back
|
||||
+ counterData.referenceTTL.set(QUEUE_MAX_TTL_TICKS);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // dead
|
||||
+ if (curr <= 0) {
|
||||
+ // parsed from decrementReference
|
||||
+ this.referenceCounters.computeIfPresent(coord, (final long keyInMap, final ReferenceCountData valueInMap) -> {
|
||||
+ // might be increased again
|
||||
+ if (valueInMap.referenceCount.get() != 0L) {
|
||||
+ valueInMap.referenceTTL.set(QUEUE_MAX_TTL_TICKS); // still has reference, pump back
|
||||
+ return valueInMap; // directly, the ttl was already charged in add logic
|
||||
+ }
|
||||
+
|
||||
+ // note: valueInMap may not be referenceCountData
|
||||
+ toRemoveTicket[0] = valueInMap;
|
||||
+
|
||||
+ return null;
|
||||
+ });
|
||||
+
|
||||
+ if (toRemoveTicket[0] != null) {
|
||||
+ this.removeTicket(coord, toRemoveTicket[0].id);
|
||||
+ toRemoveTicket[0] = null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Shiroha end - RegionizedTaskQueue queue TTL optimization
|
||||
+
|
||||
private void decrementReference(final ReferenceCountData referenceCountData, final long coord) {
|
||||
if (!referenceCountData.decreaseReferenceCount()) {
|
||||
return;
|
||||
@@ -212,9 +275,10 @@ public final class RegionizedTaskQueue {
|
||||
private final long id = ID_GENERATOR.getAndIncrement();
|
||||
|
||||
public final AtomicLong referenceCount = new AtomicLong(1L);
|
||||
+ public final AtomicLong referenceTTL = new AtomicLong(QUEUE_MAX_TTL_TICKS); // Shiroha - RegionizedTaskQueue queue TTL optimization
|
||||
public volatile boolean addedTicket;
|
||||
|
||||
- // returns false if reference count is 0, otherwise increments ref count
|
||||
+ // returns false if reference count or ttl is 0, otherwise increments ref count // Shiroha - RegionizedTaskQueue queue TTL optimization
|
||||
public boolean addCount() {
|
||||
int failures = 0;
|
||||
for (long curr = this.referenceCount.get();;) {
|
||||
@@ -227,6 +291,27 @@ public final class RegionizedTaskQueue {
|
||||
}
|
||||
|
||||
if (curr == (curr = this.referenceCount.compareAndExchange(curr, curr + 1L))) {
|
||||
+ // Shiroha start - RegionizedTaskQueue queue TTL optimization
|
||||
+ // now force charge back the ttl to max
|
||||
+ int ttlFailures = 0;
|
||||
+ for (long currTTL = this.referenceTTL.get();;) {
|
||||
+ for (int i = 0; i < ttlFailures; i++) {
|
||||
+ Thread.onSpinWait();
|
||||
+ }
|
||||
+
|
||||
+ // add failed, rollback (ttl reached)
|
||||
+ if (currTTL <= 0) {
|
||||
+ this.referenceCount.decrementAndGet(); // revert the addition
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (currTTL == (currTTL = this.referenceTTL.compareAndExchange(currTTL, QUEUE_MAX_TTL_TICKS))) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ++ttlFailures;
|
||||
+ }
|
||||
+ // Shiroha end - RegionizedTaskQueue queue TTL optimization
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -234,11 +319,11 @@ public final class RegionizedTaskQueue {
|
||||
}
|
||||
}
|
||||
|
||||
- // returns true if new reference count is 0
|
||||
+ // returns true if new reference count and ttl is 0 // Shiroha - RegionizedTaskQueue queue TTL optimization
|
||||
public boolean decreaseReferenceCount() {
|
||||
final long res = this.referenceCount.decrementAndGet();
|
||||
if (res >= 0L) {
|
||||
- return res == 0L;
|
||||
+ return res == 0L && this.referenceTTL.get() <= 0L; // Shiroha - RegionizedTaskQueue queue TTL optimization
|
||||
} else {
|
||||
throw new IllegalStateException("Negative reference count");
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index d4cb160e285a807597523de840a4d1c4f9fced27..a7100db6d1ce6434cd9ecfdff554a4ebcfde1e66 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1736,6 +1736,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
foliaProfiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.PASSENGER_DESYNC_CHECK);
|
||||
}
|
||||
// Folia end - fix passenger desync
|
||||
+ region.world.taskQueueRegionData.tickQueueReferenceTTL(); // Shiroha - RegionizedTaskQueue queue TTL optimization
|
||||
}
|
||||
// Folia end - region threading
|
||||
//this.tickCount++; // Folia - region threading
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Thu, 30 Jul 2026 21:16:31 +0800
|
||||
Subject: [PATCH] Reduce ticket operations in nether portal searching
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index e541189887f446844ffd77ff099d1f4dba556fe9..dfe1ebb4e016ef1c8c8bb47973b93834be707921 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
private final StructureCheck structureCheck;
|
||||
public final boolean tickTime; // Folia - region threading
|
||||
private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
|
||||
+ public final io.nanachiyo0721.shiroha.utils.ReferenceCountingChunkLoader portalSearchingChunkLoader = new io.nanachiyo0721.shiroha.utils.ReferenceCountingChunkLoader(this, net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY); // Shiroha - Reduce ticket operations in nether portal searching
|
||||
|
||||
// CraftBukkit start
|
||||
private final ResourceKey<LevelStem> typeKey;
|
||||
@@ -965,6 +966,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
|
||||
this.debugSynchronizers.tick(this.server.debugSubscribers());
|
||||
profiler.pop();
|
||||
+ this.portalSearchingChunkLoader.tickChunkReferenceTTL(); // Shiroha - Reduce ticket operations in nether portal searching
|
||||
}
|
||||
|
||||
// Folia start - region threading
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 216c7a6c9a139c998809b98134706a52ad271518..27a29be1be014bee576d64ff198d394a08f0601b 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4765,10 +4765,10 @@ public abstract class Entity
|
||||
);
|
||||
|
||||
// kick off search for existing portal or creation
|
||||
- destination.moonrise$loadChunksAsync(
|
||||
+ destination.portalSearchingChunkLoader.loadChunksAsync( // Shiroha - Reduce ticket operations in nether portal searching
|
||||
// add 32 so that the final search for a portal frame doesn't load any chunks
|
||||
targetPos, portalSearchRadius + 32,
|
||||
- net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY,
|
||||
+ //net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY, // Shiroha - Reduce ticket operations in nether portal searching
|
||||
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
||||
(chunks) -> {
|
||||
BlockUtil.FoundRectangle portal =
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sat, 22 Aug 2026 23:28:32 +0800
|
||||
Subject: [PATCH] Reduce conflict blocking for unnecessary situations in ticket
|
||||
update processing
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
index 352325aeea9e4f797893911d81703262b198ecd5..b4184b794c1e2a152531cffba493edc455399ff5 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
@@ -1566,7 +1566,12 @@ public final class ChunkHolderManager {
|
||||
BLOCK_TICKET_UPDATES.set(before);
|
||||
}
|
||||
|
||||
+ // Shiroha start - Reduce conflict blocking for unnecessary situations
|
||||
public boolean processTicketUpdates() {
|
||||
+ return processTicketUpdates(true);
|
||||
+ }
|
||||
+ // Shiroha end - Reduce conflict blocking for unnecessary situations
|
||||
+ public boolean processTicketUpdates(boolean blockForUnacquirable) { // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.TICKET_LEVEL_UPDATE_PROCESSING); try { // Folia - profiler
|
||||
if (BLOCK_TICKET_UPDATES.get() == Boolean.TRUE) {
|
||||
throw new IllegalStateException("Cannot update ticket level while unloading chunks or updating entity manager");
|
||||
@@ -1587,7 +1592,7 @@ public final class ChunkHolderManager {
|
||||
try {
|
||||
ret |= this.ticketLevelPropagator.performUpdates(
|
||||
this.ticketLockArea, this.taskScheduler.schedulingLockArea,
|
||||
- scheduledTasks, changedFullStatus
|
||||
+ scheduledTasks, changedFullStatus, blockForUnacquirable // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
);
|
||||
} finally {
|
||||
this.unblockTicketUpdates(Boolean.FALSE);
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
|
||||
index 3922616c82a9a38fb51038cd4f4c10d7921b649a..d88e7a9d681554e264429226bd695a1ce75b3876 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
|
||||
@@ -339,8 +339,15 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ // Shiroha start - Reduce conflict blocking for unnecessary situations
|
||||
public boolean performUpdates(final ReentrantAreaLock ticketLock, final ReentrantAreaLock schedulingLock,
|
||||
final List<ChunkProgressionTask> scheduledTasks, final List<NewChunkHolder> changedFullStatus) {
|
||||
+ return this.performUpdates(ticketLock, schedulingLock, scheduledTasks, changedFullStatus, true);
|
||||
+ }
|
||||
+ // Shiroha end - Reduce conflict blocking for unnecessary situations
|
||||
+
|
||||
+ public boolean performUpdates(final ReentrantAreaLock ticketLock, final ReentrantAreaLock schedulingLock,
|
||||
+ final List<ChunkProgressionTask> scheduledTasks, final List<NewChunkHolder> changedFullStatus, boolean blockForUnacquirableNode) { // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
if (this.updateQueue.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -351,9 +358,9 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
Propagator propagator = null;
|
||||
|
||||
for (;;) {
|
||||
- final UpdateQueue.UpdateQueueNode toUpdate = this.updateQueue.acquireNextOrWait(maxOrder);
|
||||
+ final UpdateQueue.UpdateQueueNode toUpdate = this.updateQueue.acquireNextOrWait(maxOrder, blockForUnacquirableNode); // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
if (toUpdate == null) {
|
||||
- if (!this.updateQueue.hasRemainingUpdates(maxOrder)) {
|
||||
+ if (!this.updateQueue.hasRemainingUpdates(maxOrder) || !blockForUnacquirableNode) { // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
if (propagator != null) {
|
||||
Propagator.returnPropagator(propagator);
|
||||
}
|
||||
@@ -467,7 +474,7 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
}
|
||||
}
|
||||
|
||||
- public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
|
||||
+ public UpdateQueueNode acquireNextOrWait(final long maxOrder, boolean blockForUnacquirable) { // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
final List<UpdateQueueNode> blocking = new ArrayList<>();
|
||||
|
||||
node_search:
|
||||
@@ -497,7 +504,7 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
return curr;
|
||||
}
|
||||
|
||||
- if (!blocking.isEmpty()) {
|
||||
+ if (!blocking.isEmpty() && blockForUnacquirable) { // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
await(blocking.get(0));
|
||||
}
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
index aa575f3b76ef70ffb9f0410e7e5cfe7af384bfbd..4b8287ab2c674b773c5ed254f5c6e72ece851684 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
@@ -371,7 +371,7 @@ public final class RegionizedServer {
|
||||
|
||||
world.updateTickData();
|
||||
|
||||
- world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates(); // required to eventually process ticket updates
|
||||
+ world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates(false); // required to eventually process ticket updates // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
|
||||
this.autoSaveMaps(world);
|
||||
}
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
index 3a7e4b57dc41030295f5e9da58a0fcd1270c521f..863421cedc33204a60ac77af30b67cca8a268dea 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
|
||||
@@ -386,7 +386,7 @@ public final class RegionizedTaskQueue {
|
||||
|
||||
if (processedChunkTask) { // Shiroha - Fix wrong ticket update determination in RegionizedTaskQueue
|
||||
// if we executed chunk tasks, we should try to process ticket updates for full status changes
|
||||
- this.worldRegionTaskData.world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates();
|
||||
+ this.worldRegionTaskData.world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates(false); // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/TickRegions.java b/io/papermc/paper/threadedregions/TickRegions.java
|
||||
index ab94ea7f18799d9dd3cf164a1332db69f40a9278..ca24971a1dc7576e6f216dfc0fe56d2e5195a14f 100644
|
||||
--- a/io/papermc/paper/threadedregions/TickRegions.java
|
||||
+++ b/io/papermc/paper/threadedregions/TickRegions.java
|
||||
@@ -508,7 +508,7 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
|
||||
|
||||
if (processedChunkTask) {
|
||||
// if we processed any chunk tasks, try to process ticket level updates for full status changes
|
||||
- this.region.world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates();
|
||||
+ this.region.world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates(false); // Shiroha - Reduce conflict blocking for unnecessary situations
|
||||
}
|
||||
} finally { profiler.stopInBetweenTick(); } // Folia - profiler
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Wed, 5 Aug 2026 23:53:48 +0800
|
||||
Subject: [PATCH] Reduce allocation in PoiAccess
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/poi_lookup/PoiAccess.java b/ca/spottedleaf/moonrise/patches/poi_lookup/PoiAccess.java
|
||||
index 85d80b3952a76b0ca7f67401a659cf35dd55b082..d4f95458d2e35aedb0fd5230fcd74b968437d8a5 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/poi_lookup/PoiAccess.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/poi_lookup/PoiAccess.java
|
||||
@@ -89,6 +89,23 @@ public final class PoiAccess {
|
||||
return (centerDiffX * centerDiffX) + (centerDiffY * centerDiffY) + (centerDiffZ * centerDiffZ);
|
||||
}
|
||||
|
||||
+ // Shiroha start- Reduce allocation in PoiAccess
|
||||
+ private static int getSectionIndex(
|
||||
+ final int x,
|
||||
+ final int y,
|
||||
+ final int z,
|
||||
+ final int lowerX,
|
||||
+ final int lowerY,
|
||||
+ final int lowerZ,
|
||||
+ final int spanY,
|
||||
+ final int spanZ
|
||||
+ ) {
|
||||
+ return (x - lowerX) * spanY * spanZ
|
||||
+ + (y - lowerY) * spanZ
|
||||
+ + (z - lowerZ);
|
||||
+ }
|
||||
+ // Shiroha end - Reduce allocation in PoiAccess
|
||||
+
|
||||
public static void findClosestPoiDataRecords(final PoiManager poiStorage,
|
||||
final Predicate<Holder<PoiType>> villagePlaceType,
|
||||
// position predicate must not modify chunk POI
|
||||
@@ -116,9 +133,15 @@ public final class PoiAccess {
|
||||
final int centerZ = sourcePosition.getZ() >> 4;
|
||||
final long centerKey = CoordinateUtils.getChunkSectionKey(centerX, centerY, centerZ);
|
||||
|
||||
+ // Shiroha start - Reduce allocation in PoiAccess
|
||||
+ final int spanX = upperX - lowerX + 1;
|
||||
+ final int spanY = upperY - lowerY + 1;
|
||||
+ final int spanZ = upperZ - lowerZ + 1;
|
||||
+ // Shiroha end - Reduce allocation in PoiAccess
|
||||
+
|
||||
final LongArrayFIFOQueue queue = new LongArrayFIFOQueue();
|
||||
- final LongOpenHashSet seen = new LongOpenHashSet();
|
||||
- seen.add(centerKey);
|
||||
+ final java.util.BitSet seen = new java.util.BitSet(spanX * spanY * spanZ); // Shiroha - Reduce allocation in PoiAccess
|
||||
+ seen.set(getSectionIndex(centerX, centerY, centerZ, lowerX, lowerY, lowerZ, spanY, spanZ)); // Shiroha - Reduce allocation in PoiAccess
|
||||
queue.enqueue(centerKey);
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
@@ -159,8 +182,18 @@ public final class PoiAccess {
|
||||
final int neighbourY = sectionY + dy;
|
||||
final int neighbourZ = sectionZ + dz;
|
||||
|
||||
+ // Shiroha start - Reduce allocation in PoiAccess
|
||||
+ if (neighbourX < lowerX || neighbourX > upperX
|
||||
+ || neighbourY < lowerY || neighbourY > upperY
|
||||
+ || neighbourZ < lowerZ || neighbourZ > upperZ) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final int neighbourIndex = getSectionIndex(neighbourX, neighbourY, neighbourZ, lowerX, lowerY, lowerZ, spanY, spanZ);
|
||||
+ // Shiroha end - Reduce allocation in PoiAccess
|
||||
final long neighbourKey = CoordinateUtils.getChunkSectionKey(neighbourX, neighbourY, neighbourZ);
|
||||
- if (seen.add(neighbourKey)) {
|
||||
+ if (!seen.get(neighbourIndex)) { // Shiroha - Reduce allocation in PoiAccess
|
||||
+ seen.set(neighbourIndex); // Shiroha - Reduce allocation in PoiAccess
|
||||
queue.enqueue(neighbourKey);
|
||||
}
|
||||
}
|
||||
@@ -359,9 +392,15 @@ public final class PoiAccess {
|
||||
final int centerZ = sourcePosition.getZ() >> 4;
|
||||
final long centerKey = CoordinateUtils.getChunkSectionKey(centerX, centerY, centerZ);
|
||||
|
||||
+ // Shiroha start - Reduce allocation in PoiAccess
|
||||
+ final int spanX = upperX - lowerX + 1;
|
||||
+ final int spanY = upperY - lowerY + 1;
|
||||
+ final int spanZ = upperZ - lowerZ + 1;
|
||||
+ // Shiroha end - Reduce allocation in PoiAccess
|
||||
+
|
||||
final LongArrayFIFOQueue queue = new LongArrayFIFOQueue();
|
||||
- final LongOpenHashSet seen = new LongOpenHashSet();
|
||||
- seen.add(centerKey);
|
||||
+ final java.util.BitSet seen = new java.util.BitSet(spanX * spanY * spanZ); // Shiroha - Reduce allocation in PoiAccess
|
||||
+ seen.set(getSectionIndex(centerX, centerY, centerZ, lowerX, lowerY, lowerZ, spanY, spanZ)); // Shiroha - Reduce allocation in PoiAccess
|
||||
queue.enqueue(centerKey);
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
@@ -403,8 +442,18 @@ public final class PoiAccess {
|
||||
final int neighbourY = sectionY + dy;
|
||||
final int neighbourZ = sectionZ + dz;
|
||||
|
||||
+ // Shiroha start - Reduce allocation in PoiAccess
|
||||
+ if (neighbourX < lowerX || neighbourX > upperX
|
||||
+ || neighbourY < lowerY || neighbourY > upperY
|
||||
+ || neighbourZ < lowerZ || neighbourZ > upperZ) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final int neighbourIndex = getSectionIndex(neighbourX, neighbourY, neighbourZ, lowerX, lowerY, lowerZ, spanY, spanZ);
|
||||
+ // Shiroha end - Reduce allocation in PoiAccess
|
||||
final long neighbourKey = CoordinateUtils.getChunkSectionKey(neighbourX, neighbourY, neighbourZ);
|
||||
- if (seen.add(neighbourKey)) {
|
||||
+ if (!seen.get(neighbourIndex)) { // Shiroha - Reduce allocation in PoiAccess
|
||||
+ seen.set(neighbourIndex); // Shiroha - Reduce allocation in PoiAccess
|
||||
queue.enqueue(neighbourKey);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Fri, 7 Aug 2026 15:42:07 +0800
|
||||
Subject: [PATCH] Reduce allocation in SignalGetter
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/SignalGetter.java b/net/minecraft/world/level/SignalGetter.java
|
||||
index b2ff063a5bfc7e73557f17896a1eadee0d39b735..435cd36c961158dd900af473d5c9c89980a1abab 100644
|
||||
--- a/net/minecraft/world/level/SignalGetter.java
|
||||
+++ b/net/minecraft/world/level/SignalGetter.java
|
||||
@@ -17,32 +17,47 @@ public interface SignalGetter extends BlockGetter {
|
||||
|
||||
default int getDirectSignalTo(final BlockPos pos) {
|
||||
int result = 0;
|
||||
- result = Math.max(result, this.getDirectSignal(pos.below(), Direction.DOWN));
|
||||
+ // Shiroha start - Reduce allocation in SignalGetter
|
||||
+ var localPosForCompute = new net.minecraft.core.BlockPos.MutableBlockPos(pos.getX(), pos.getY(), pos.getZ()); // replace with singleton to reduce allocation
|
||||
+ localPosForCompute.setY(localPosForCompute.getY() - 1); // below
|
||||
+ result = Math.max(result, this.getDirectSignal(localPosForCompute, Direction.DOWN));
|
||||
+ // Shiroha end - Reduce allocation in SignalGetter
|
||||
if (result >= Redstone.SIGNAL_MAX) {
|
||||
return result;
|
||||
}
|
||||
|
||||
- result = Math.max(result, this.getDirectSignal(pos.above(), Direction.UP));
|
||||
+ localPosForCompute.setY(localPosForCompute.getY() + 2); // Shiroha - Reduce allocation in SignalGetter - reset below, above -> 1+1(2)
|
||||
+ result = Math.max(result, this.getDirectSignal(localPosForCompute, Direction.UP)); // Shiroha - Reduce allocation in SignalGetter
|
||||
if (result >= Redstone.SIGNAL_MAX) {
|
||||
return result;
|
||||
}
|
||||
|
||||
- result = Math.max(result, this.getDirectSignal(pos.north(), Direction.NORTH));
|
||||
+ // Shiroha start - Reduce allocation in SignalGetter
|
||||
+ localPosForCompute.setY(localPosForCompute.getY() - 1);
|
||||
+ localPosForCompute.setZ(localPosForCompute.getZ() - 1);
|
||||
+ // Shiroha end - Reduce allocation in SignalGetter
|
||||
+ result = Math.max(result, this.getDirectSignal(localPosForCompute, Direction.NORTH)); // Shiroha - Reduce allocation in SignalGetter
|
||||
if (result >= Redstone.SIGNAL_MAX) {
|
||||
return result;
|
||||
}
|
||||
|
||||
- result = Math.max(result, this.getDirectSignal(pos.south(), Direction.SOUTH));
|
||||
+ localPosForCompute.setZ(localPosForCompute.getZ() + 2); // Shiroha - Reduce allocation in SignalGetter - reset north, south -> 1+1(2)
|
||||
+ result = Math.max(result, this.getDirectSignal(localPosForCompute, Direction.SOUTH)); // Shiroha - Reduce allocation in SignalGetter
|
||||
if (result >= Redstone.SIGNAL_MAX) {
|
||||
return result;
|
||||
}
|
||||
|
||||
- result = Math.max(result, this.getDirectSignal(pos.west(), Direction.WEST));
|
||||
+ // Shiroha start - Reduce allocation in SignalGetter
|
||||
+ localPosForCompute.setZ(localPosForCompute.getZ() - 1);
|
||||
+ localPosForCompute.setX(localPosForCompute.getX() - 1);
|
||||
+ // Shiroha end - Reduce allocation in SignalGetter
|
||||
+ result = Math.max(result, this.getDirectSignal(localPosForCompute, Direction.WEST)); // Shiroha - Reduce allocation in SignalGetter
|
||||
if (result >= Redstone.SIGNAL_MAX) {
|
||||
return result;
|
||||
}
|
||||
|
||||
- result = Math.max(result, this.getDirectSignal(pos.east(), Direction.EAST));
|
||||
+ localPosForCompute.setX(localPosForCompute.getX() + 2); // Shiroha - Reduce allocation in SignalGetter - reset west, east -> 1+1(2)
|
||||
+ result = Math.max(result, this.getDirectSignal(localPosForCompute, Direction.EAST)); // Shiroha - Reduce allocation in SignalGetter
|
||||
return result >= Redstone.SIGNAL_MAX ? result : result;
|
||||
}
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Fri, 7 Aug 2026 14:07:55 +0800
|
||||
Subject: [PATCH] Reduce allocation in unlistened spawn events
|
||||
|
||||
|
||||
diff --git a/net/minecraft/util/SpawnUtil.java b/net/minecraft/util/SpawnUtil.java
|
||||
index 625ee78221324ce4959770fe36e4334d057cbc74..ed0e28761b1f14b7907e8e6bfac0690aa2d0b962 100644
|
||||
--- a/net/minecraft/util/SpawnUtil.java
|
||||
+++ b/net/minecraft/util/SpawnUtil.java
|
||||
@@ -57,6 +57,7 @@ public class SpawnUtil {
|
||||
&& moveToPossibleSpawnPosition(level, spawnRangeY, searchPos, strategy)
|
||||
&& (!checkCollisions || level.noCollision(entityType.getSpawnAABB(searchPos.getX() + 0.5, searchPos.getY(), searchPos.getZ() + 0.5)))) {
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
+ if (com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent.getHandlerList().getRegisteredListeners().length != 0) { // Shiroha - Reduce allocation in unlistened spawn events
|
||||
final com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||
org.bukkit.craftbukkit.util.CraftLocation.toBukkit(start, level),
|
||||
org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entityType),
|
||||
@@ -71,6 +72,7 @@ public class SpawnUtil {
|
||||
}
|
||||
break;
|
||||
}
|
||||
+ } // Shiroha - Reduce allocation in unlistened spawn events
|
||||
// Paper end - PreCreatureSpawnEvent
|
||||
T mob = (T)entityType.create(level, null, searchPos, spawnReason, false, false);
|
||||
if (mob != null) {
|
||||
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
|
||||
index 6efaa78faca15c7a48bdffb24480d1bac29f3ba8..93f94d5b8f66b97bfd6a2fe3a35bbcbcfb18d699 100644
|
||||
--- a/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/net/minecraft/world/entity/EntityType.java
|
||||
@@ -230,6 +230,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T>,
|
||||
) {
|
||||
// CraftBukkit end
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
+ if (com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent.getHandlerList().getRegisteredListeners().length != 0) { // Shiroha - Reduce allocation in unlistened spawn events
|
||||
com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||
org.bukkit.craftbukkit.util.CraftLocation.toBukkit(spawnPos, level),
|
||||
org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(this),
|
||||
@@ -238,6 +239,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T>,
|
||||
if (!event.callEvent()) {
|
||||
return null;
|
||||
}
|
||||
+ } // Shiroha - Reduce allocation in unlistened spawn events
|
||||
// Paper end - PreCreatureSpawnEvent
|
||||
T entity = this.create(level, postSpawnConfig, spawnPos, spawnReason, tryMoveDown, movedUp);
|
||||
if (entity != null) {
|
||||
diff --git a/net/minecraft/world/level/BaseSpawner.java b/net/minecraft/world/level/BaseSpawner.java
|
||||
index 2f89a9145902e514089924462003709f256ac3f4..01a68ad7c5d32bafd5ab24398f71a8ac0eb560a0 100644
|
||||
--- a/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -140,6 +140,7 @@ public abstract class BaseSpawner {
|
||||
}
|
||||
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
+ if (com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent.getHandlerList().getRegisteredListeners().length != 0) { // Shiroha - Reduce allocation in unlistened spawn events
|
||||
com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
|
||||
org.bukkit.craftbukkit.util.CraftLocation.toBukkit(spawnPos, level),
|
||||
org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entityType.get()),
|
||||
@@ -152,6 +153,7 @@ public abstract class BaseSpawner {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
+ } // Shiroha - Reduce allocation in unlistened spawn events
|
||||
// Paper end - PreCreatureSpawnEvent
|
||||
|
||||
Entity entity = EntityType.loadEntityRecursive(input, level, EntitySpawnReason.SPAWNER, e -> {
|
||||
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 500dcbe924fca160bd673592e1aba384f6eb9ed2..ecdd27be9ac86c396d1cf430356637ee237cf368 100644
|
||||
--- a/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -391,6 +391,7 @@ public final class NaturalSpawner {
|
||||
) {
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
EntityType<?> type = currentSpawnData.type();
|
||||
+ if (com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent.getHandlerList().getRegisteredListeners().length != 0) { // Shiroha - Reduce allocation in unlistened spawn events
|
||||
com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||
org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level),
|
||||
org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(type), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL
|
||||
@@ -401,6 +402,7 @@ public final class NaturalSpawner {
|
||||
}
|
||||
return PreSpawnStatus.CANCELLED;
|
||||
}
|
||||
+ } // Shiroha - Reduce allocation in unlistened spawn events
|
||||
final boolean success = type.getCategory() != MobCategory.MISC
|
||||
// Paper end - PreCreatureSpawnEvent
|
||||
&& (type.canSpawnFarFromPlayer() || !(nearestPlayerDistanceSqr > type.getCategory().getDespawnDistance() * type.getCategory().getDespawnDistance()))
|
||||
+12
-12
@@ -5,10 +5,10 @@ Subject: [PATCH] Async protocol switching optimization
|
||||
|
||||
|
||||
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
|
||||
index 40f54536422fa38bd84017fc634808016b4de58b..d3fb20f465c0b69662d81b53201963634d8b53d2 100644
|
||||
index c3922310ef1fce26eca60793b75bcb480683778a..cc9459273762cde3e6b87a7eaf225607f527315c 100644
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
+++ b/net/minecraft/network/Connection.java
|
||||
@@ -1067,4 +1067,127 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -1108,4 +1108,127 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
}
|
||||
// Paper end - Optimize network
|
||||
@@ -137,10 +137,10 @@ index 40f54536422fa38bd84017fc634808016b4de58b..d3fb20f465c0b69662d81b5320196363
|
||||
+
|
||||
}
|
||||
diff --git a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
index c62584e022260cf781a0414be04a3af4a70160ef..aff95d34d21dc69150f0402bae9b770cab57498e 100644
|
||||
index 0485ce2a56adedc200cc0cd441df7cce88da66a8..344d2aa66f1fb720ca7abcc426ef438e8651ecd4 100644
|
||||
--- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -188,8 +188,9 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
@@ -197,8 +197,9 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
public void handleConfigurationFinished(final ServerboundFinishConfigurationPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.server.packetProcessor());
|
||||
this.finishCurrentTask(JoinWorldTask.TYPE);
|
||||
@@ -151,7 +151,7 @@ index c62584e022260cf781a0414be04a3af4a70160ef..aff95d34d21dc69150f0402bae9b770c
|
||||
try {
|
||||
PlayerList playerList = this.server.getPlayerList();
|
||||
if (playerList.getPlayer(this.gameProfile.id()) != null) {
|
||||
@@ -235,6 +236,18 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
@@ -244,6 +245,18 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
LOGGER.error("Couldn't place player in world", e);
|
||||
this.disconnect(DISCONNECT_REASON_INVALID_DATA);
|
||||
}
|
||||
@@ -171,10 +171,10 @@ index c62584e022260cf781a0414be04a3af4a70160ef..aff95d34d21dc69150f0402bae9b770c
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index c1faaf7d514c23d756aa626fa93aabd8bb503463..6c2d75f312f970ab9d35f6e6b8a1fa3805ebc37c 100644
|
||||
index 626761226aaacc7b6e429026b248be980a21d749..0bcc7c157b32cdef930c195def8f6be77fddec0a 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2897,7 +2897,13 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2898,7 +2898,13 @@ public class ServerGamePacketListenerImpl
|
||||
} // Folia end - rewrite login process - move connection ownership to global region
|
||||
this.waitingForSwitchToConfig = true; // Folia - rewrite login process - fix bad ordering of this field write - moved down
|
||||
this.send(ClientboundStartConfigurationPacket.INSTANCE);
|
||||
@@ -188,7 +188,7 @@ index c1faaf7d514c23d756aa626fa93aabd8bb503463..6c2d75f312f970ab9d35f6e6b8a1fa38
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3782,12 +3788,26 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -3783,12 +3789,26 @@ public class ServerGamePacketListenerImpl
|
||||
}
|
||||
|
||||
final ServerConfigurationPacketListenerImpl listener = new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())); // Paper
|
||||
@@ -216,10 +216,10 @@ index c1faaf7d514c23d756aa626fa93aabd8bb503463..6c2d75f312f970ab9d35f6e6b8a1fa38
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index f2329d1a9d9d4bf4c9d771e25e54f2f9ef65a76c..1b4229085f9d4189efb20c083bbfe2e6712e72a4 100644
|
||||
index 95787d6d29ddb8dca78506bb2a115fa612fdaa29..8c4b60e7c7c44f20e13e917bc0bc3b75e98a36c1 100644
|
||||
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -435,12 +435,30 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -439,12 +439,30 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
public void handleLoginAcknowledgement(final ServerboundLoginAcknowledgedPacket packet) {
|
||||
net.minecraft.network.protocol.PacketUtils.ensureRunningOnSameThread(packet, this, this.server.packetProcessor()); // CraftBukkit
|
||||
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet");
|
||||
@@ -253,12 +253,12 @@ index f2329d1a9d9d4bf4c9d771e25e54f2f9ef65a76c..1b4229085f9d4189efb20c083bbfe2e6
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index e7579a9873362317dd82b63306cf650af9472574..9770ced361547b98179ec09dc85cea399f1a88cb 100644
|
||||
index c70d3169002681c5f2131ca8e98ef7d42c6dc4fa..ac5f82eaa9965f7b610f7df2d0cd4cb028951d65 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -237,9 +237,11 @@ public abstract class PlayerList {
|
||||
// only after setting the connection listener to game type, add the connection to this regions list
|
||||
level.getCurrentWorldData().connections.add(connection);
|
||||
level.getCurrentWorldData().addConnection(player);
|
||||
// Folia end - rewrite login process
|
||||
+ if (!io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch // we will run async switch once these main thread logics became done
|
||||
connection.setupInboundProtocol(
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bacteriawa <A3167717663@hotmail.com>
|
||||
Date: Tue, 21 Apr 2026 01:41:14 +0800
|
||||
From: Bacteriawa <a3167717663@hotmail.com>
|
||||
Date: Sat, 8 Aug 2026 11:36:52 +0800
|
||||
Subject: [PATCH] Kaiiju: Entity tick and removal limiter
|
||||
|
||||
Co-authored by: Xymb <xymb@endcrystal.me>
|
||||
@@ -8,22 +8,22 @@ As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2e
|
||||
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index cb15cfbc684ae9e9d9634886f707c2df10063139..f32d118e1e925b2155cef3fcdcb1e194c541e242 100644
|
||||
index 55dabe4dd77cff25ec9b1bc26749a1b56c36e2a2..fbbc05e946b72da1079271810fdb3034510c6280 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -354,6 +354,7 @@ public final class RegionizedWorldData {
|
||||
@@ -349,6 +349,7 @@ public final class RegionizedWorldData {
|
||||
private final IteratorSafeOrderedReferenceSet<Mob> navigatingMobs = new IteratorSafeOrderedReferenceSet<>();
|
||||
public final ReferenceList<Entity> trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
|
||||
public final ReferenceList<Entity> trackerUnloadedEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
|
||||
public ReferenceList<Entity> trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
|
||||
public boolean iteratingTrackerEntities;
|
||||
+ public final dev.kaiijumc.kaiiju.KaiijuEntityThrottler entityThrottler = new dev.kaiijumc.kaiiju.KaiijuEntityThrottler(); // Kaiiju
|
||||
|
||||
// block ticking
|
||||
private final ObjectLinkedOpenHashSet<BlockEventData> blockEvents = new ObjectLinkedOpenHashSet<>();
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index d25b1c7d1347b2731cd12cdcea7190276913de49..5668f80c2ac1fcf2ac0e1e5378c789d7fce655f3 100644
|
||||
index dfe1ebb4e016ef1c8c8bb47973b93834be707921..553395d07ec436280ff1415564ece10f544a37e7 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -911,6 +911,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -912,6 +912,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
}
|
||||
|
||||
foliaProfiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ACTIVATE_ENTITIES); try { // Folia - profiler
|
||||
@@ -31,7 +31,7 @@ index d25b1c7d1347b2731cd12cdcea7190276913de49..5668f80c2ac1fcf2ac0e1e5378c789d7
|
||||
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
|
||||
} finally { foliaProfiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ACTIVATE_ENTITIES); } // Folia - profiler
|
||||
foliaProfiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); try { // Folia - profiler
|
||||
@@ -932,6 +933,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -933,6 +934,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
|
||||
entity.stopRiding();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ index d25b1c7d1347b2731cd12cdcea7190276913de49..5668f80c2ac1fcf2ac0e1e5378c789d7
|
||||
|
||||
profiler.push("tick");
|
||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
@@ -941,6 +949,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -942,6 +950,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -54,7 +54,7 @@ index d25b1c7d1347b2731cd12cdcea7190276913de49..5668f80c2ac1fcf2ac0e1e5378c789d7
|
||||
if (this.paperConfig().unsupportedSettings.ticking.blockEntities) { // Paper - option to disable ticking
|
||||
profiler.popPush("blockEntities");
|
||||
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
|
||||
index 6efaa78faca15c7a48bdffb24480d1bac29f3ba8..31619890f1bd4f458b6f9a31fac8cefaafe09e8e 100644
|
||||
index 93f94d5b8f66b97bfd6a2fe3a35bbcbcfb18d699..c164e3fa59b47d58c57d65d4330df3a2b31795c6 100644
|
||||
--- a/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/net/minecraft/world/entity/EntityType.java
|
||||
@@ -73,6 +73,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T>,
|
||||
+17
-13
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 22:35:59 +0800
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Mon, 27 Jul 2026 20:43:17 +0800
|
||||
Subject: [PATCH] Kaiiju: Vanilla end portal teleportation
|
||||
|
||||
Co-authored by: Sofiane H. Djerbi <46628754+kugge@users.noreply.github.com>
|
||||
@@ -8,10 +8,10 @@ As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2e
|
||||
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 375d4a504cd3f2f2495315cc7456dd245e9d2547..319997dca2b461b41b02ca2d9b0e3ed9fd05ac88 100644
|
||||
index 27a29be1be014bee576d64ff198d394a08f0601b..ce1d50bfeb598e3ef3172766d575a89d0c87f921 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4640,14 +4640,18 @@ public abstract class Entity
|
||||
@@ -4663,15 +4663,19 @@ public abstract class Entity
|
||||
targetPos, 16, // load 16 blocks to be safe from block physics
|
||||
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
||||
(chunks) -> {
|
||||
@@ -28,13 +28,14 @@ index 375d4a504cd3f2f2495315cc7456dd245e9d2547..319997dca2b461b41b02ca2d9b0e3ed9
|
||||
portalInfoCompletable.complete(
|
||||
new net.minecraft.world.level.portal.TeleportTransition(
|
||||
- destination, Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, Direction.WEST.toYRot(), 0.0f,
|
||||
- Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)),
|
||||
+ destination, finalPos, this.getDeltaMovement(), Direction.WEST.toYRot(), 0.0f, // Kaiiju - Vanilla end teleportation
|
||||
+ /*Relative.union(Relative.DELTA, Set.of(Relative.X_ROT))*/Set.of(), // Kaiiju - Vanilla end teleportation
|
||||
false, false,
|
||||
- Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)),
|
||||
+ java.util.Collections.EMPTY_SET, // Kaiiju - Vanilla end teleportation
|
||||
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
|
||||
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
|
||||
)
|
||||
@@ -4662,11 +4666,15 @@ public abstract class Entity
|
||||
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL,
|
||||
TeleportTransition.PassengerTeleportationMode.POSITION_RIDER
|
||||
@@ -4687,13 +4691,17 @@ public abstract class Entity
|
||||
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
||||
(chunks) -> {
|
||||
BlockPos adjustedSpawn = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawnPos);
|
||||
@@ -49,10 +50,13 @@ index 375d4a504cd3f2f2495315cc7456dd245e9d2547..319997dca2b461b41b02ca2d9b0e3ed9
|
||||
new net.minecraft.world.level.portal.TeleportTransition(
|
||||
- destination, Vec3.atBottomCenterOf(adjustedSpawn), Vec3.ZERO, 0.0f, 0.0f,
|
||||
+ destination, finalPos, this.getDeltaMovement(), 0.0f, 0.0f, // Kaiiju - Vanilla end teleportation
|
||||
Relative.union(Relative.DELTA, Relative.ROTATION),
|
||||
false, false,
|
||||
- Relative.union(Relative.DELTA, Relative.ROTATION),
|
||||
+ java.util.Collections.EMPTY_SET, // Kaiiju - Vanilla end teleportation
|
||||
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
|
||||
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
|
||||
@@ -4845,6 +4853,10 @@ public abstract class Entity
|
||||
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL,
|
||||
TeleportTransition.PassengerTeleportationMode.POSITION_RIDER
|
||||
@@ -4872,6 +4880,10 @@ public abstract class Entity
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +67,7 @@ index 375d4a504cd3f2f2495315cc7456dd245e9d2547..319997dca2b461b41b02ca2d9b0e3ed9
|
||||
Vec3 initialPosition = this.position();
|
||||
ChunkPos initialPositionChunk = new ChunkPos(
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(initialPosition),
|
||||
@@ -4908,9 +4920,14 @@ public abstract class Entity
|
||||
@@ -4935,9 +4947,14 @@ public abstract class Entity
|
||||
info.postTeleportTransition().onTransition(teleported);
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ Some long commands can be run through the dialog command, but paper has prohibit
|
||||
Revert to vanilla to fix it.
|
||||
|
||||
diff --git a/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java b/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
|
||||
index 491af2413a4e793a121fec368259ff8211ed031e..5e235767cdd21ee9b3706eb8635e383dad139dc3 100644
|
||||
index 491af2413a4e793a121fec368259ff8211ed031e..88784f4c9bcd4b21c1caa33bc3df007c94cb3937 100644
|
||||
--- a/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
|
||||
@@ -12,7 +12,7 @@ public record ServerboundChatCommandPacket(String command) implements Packet<Ser
|
||||
@@ -15,7 +15,7 @@ index 491af2413a4e793a121fec368259ff8211ed031e..5e235767cdd21ee9b3706eb8635e383d
|
||||
|
||||
private ServerboundChatCommandPacket(final FriendlyByteBuf input) {
|
||||
- this(input.readUtf(MAX_CHAT_PACKET_INPUT_SIZE)); // Paper - limit chat command inputs
|
||||
+ this(io.nanachiyo0721.shiroha.config.modules.fixes.LongCommandSupportConfig.enabled ? input.readUtf() : input.readUtf(MAX_CHAT_PACKET_INPUT_SIZE)); // Paper - limit chat command inputs // Shiroha - Add config to support for long command inputs
|
||||
+ this(io.nanachiyo0721.shiroha.config.modules.fixes.LongCommandSupportConfig.enabled ? input.readUtf() : input.readUtf(io.nanachiyo0721.shiroha.config.modules.fixes.LongCommandSupportConfig.maximumCommandLength)); // Paper - limit chat command inputs // Shiroha - Add config to support for long command inputs
|
||||
}
|
||||
|
||||
private void write(final FriendlyByteBuf output) {
|
||||
+2
-2
@@ -5,10 +5,10 @@ Subject: [PATCH] Add config for server mod name
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 3e62b4beb0e5ada82f83b0ebec35ca21a072a2e2..6025675b7004c9700ddc26638761f76d64ecc026 100644
|
||||
index a7100db6d1ce6434cd9ecfdff554a4ebcfde1e66..28f5c28bdf9a3090b98451e559f807c4364ea259 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2070,7 +2070,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2084,7 +2084,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
+1
-1
@@ -27,7 +27,7 @@ index 480b6b2405706fd4d7158d0e160adafd84099887..51ccfda1d7579cb4109d78e3cc3942d0
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/block/EndPortalBlock.java b/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
index d42bb2a1721e4ab8c9956e18c3ca418b8d648c59..a7066cc2083302c50be008d38e466c5d33aa85e5 100644
|
||||
index 123df098fa987030fe3789f36ff95aeee2979834..4c92fee3fbb3d739a9ed962d39395a118db853fa 100644
|
||||
--- a/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
+++ b/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
@@ -76,6 +76,12 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
|
||||
+1
-1
@@ -5,7 +5,7 @@ Subject: [PATCH] Add force the data command to be enabled config
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index bc9f6cc286536b87513de81855ad0b61cf787c84..6f0e1eae0cdc488d7afad18017205f3cd20e994a 100644
|
||||
index 4ddb5e7ce3529466c3930caa9aa6b18158e9a63d..22c7cddef55727ad00f909e551f40a544316e5ca 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -202,7 +202,9 @@ public class Commands {
|
||||
+3
-3
@@ -8,10 +8,10 @@ is for Anarchy servers or Crystal PVP servers this allows them to pvp
|
||||
without stopping the item mid animation.
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 6c2d75f312f970ab9d35f6e6b8a1fa3805ebc37c..392c4b39a9c31be4b5b1fa61f6836920b43e58a3 100644
|
||||
index 0bcc7c157b32cdef930c195def8f6be77fddec0a..4f2ea3d0a3e15dd78bd4cece163d37bf773958bd 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2182,7 +2182,9 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2183,7 +2183,9 @@ public class ServerGamePacketListenerImpl
|
||||
this.player.sendSpawnProtectionMessage(pos);
|
||||
} else if (this.awaitingPositionFromClient == null && (level.mayInteract(this.player, pos) || passthroughSignInteraction)) {
|
||||
// Paper end - Allow using signs inside spawn protection
|
||||
@@ -21,7 +21,7 @@ index 6c2d75f312f970ab9d35f6e6b8a1fa3805ebc37c..392c4b39a9c31be4b5b1fa61f6836920
|
||||
InteractionResult interactionResult = this.player.gameMode.useItemOn(this.player, level, itemStack, hand, blockHit);
|
||||
if (interactionResult.consumesAction()) {
|
||||
CriteriaTriggers.ANY_BLOCK_USE.trigger(this.player, blockHit.getBlockPos(), itemStack);
|
||||
@@ -2381,9 +2383,13 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2382,9 +2384,13 @@ public class ServerGamePacketListenerImpl
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+2
-2
@@ -6,7 +6,7 @@ Subject: [PATCH] Add config to enable tick command
|
||||
only freeze/unfreeze/step/query can run when enabled
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
index aa575f3b76ef70ffb9f0410e7e5cfe7af384bfbd..5f6d6533067863d609484d1463fe4e64ff5f683c 100644
|
||||
index 4b8287ab2c674b773c5ed254f5c6e72ece851684..feb21d91691e849c15976ff1f9482ad1049c4ab8 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
@@ -233,6 +233,11 @@ public final class RegionizedServer {
|
||||
@@ -47,7 +47,7 @@ index e9d22c4b5f30284ca8e026533c24dca2bdb3001d..724332d074bd7d3dfdcb60e83cf1fd6c
|
||||
this.scheduler.regionFailed(this, false, thr);
|
||||
// regionFailed will schedule a shutdown, so we should avoid letting this region tick further
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index 6f0e1eae0cdc488d7afad18017205f3cd20e994a..570c3523821155d4272161608db7f11a525a783b 100644
|
||||
index 22c7cddef55727ad00f909e551f40a544316e5ca..9b411a23545572ff38f624b0a5ac7053935076ea 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -259,7 +259,11 @@ public class Commands {
|
||||
+10
-10
@@ -5,10 +5,10 @@ Subject: [PATCH] Add portal rate limiter
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index f32d118e1e925b2155cef3fcdcb1e194c541e242..eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58 100644
|
||||
index fbbc05e946b72da1079271810fdb3034510c6280..c04dbcd615c97cb6dcb5f14fec88daf73e6e9b4a 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -157,6 +157,10 @@ public final class RegionizedWorldData {
|
||||
@@ -154,6 +154,10 @@ public final class RegionizedWorldData {
|
||||
for (final ChunkHolder chunkHolder : from.chunkHoldersToBroadcast) {
|
||||
into.chunkHoldersToBroadcast.add(chunkHolder);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ index f32d118e1e925b2155cef3fcdcb1e194c541e242..eef3f6b5d13d8a5ba3d66f5fe297b431
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,6 +326,12 @@ public final class RegionizedWorldData {
|
||||
@@ -316,6 +320,12 @@ public final class RegionizedWorldData {
|
||||
into.chunkHoldersToBroadcast.add(chunkHolder);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ index f32d118e1e925b2155cef3fcdcb1e194c541e242..eef3f6b5d13d8a5ba3d66f5fe297b431
|
||||
}
|
||||
};
|
||||
|
||||
@@ -343,6 +353,35 @@ public final class RegionizedWorldData {
|
||||
@@ -338,6 +348,35 @@ public final class RegionizedWorldData {
|
||||
return this.isHandlingTick;
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ index f32d118e1e925b2155cef3fcdcb1e194c541e242..eef3f6b5d13d8a5ba3d66f5fe297b431
|
||||
// this is copy on write to allow packet processing to iterate safely
|
||||
private final CopyOnWriteArrayList<ServerPlayer> localPlayers = new CopyOnWriteArrayList<>();
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 6025675b7004c9700ddc26638761f76d64ecc026..5be3e493f1638cc0befe5530c58ea15467a3a7ac 100644
|
||||
index 28f5c28bdf9a3090b98451e559f807c4364ea259..170ff99a055d7ea582d6a18ef6acd57269d943c4 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1932,6 +1932,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1938,6 +1938,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = level.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers // Folia - region threading
|
||||
profiler.push(() -> level + " " + level.dimension().identifier());
|
||||
profiler.push("tick");
|
||||
@@ -82,7 +82,7 @@ index 6025675b7004c9700ddc26638761f76d64ecc026..5be3e493f1638cc0befe5530c58ea154
|
||||
|
||||
try {
|
||||
foliaProfiler.startTimer(level.tickTimerId); try { // Folia - profiler
|
||||
@@ -1946,6 +1949,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1952,6 +1955,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
profiler.pop();
|
||||
profiler.pop();
|
||||
regionizedWorldData.explosionDensityCache.clear(); // Paper - Optimize explosions // Folia - region threading
|
||||
@@ -93,10 +93,10 @@ index 6025675b7004c9700ddc26638761f76d64ecc026..5be3e493f1638cc0befe5530c58ea154
|
||||
//this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked // Folia - region threading
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index 5668f80c2ac1fcf2ac0e1e5378c789d7fce655f3..ecb1b98723e78e9d2f3ce182be8f78f8f32a52da 100644
|
||||
index 553395d07ec436280ff1415564ece10f544a37e7..4e1a035f8797196c765f59553ff3a0c9749bacfb 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1536,8 +1536,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1534,8 +1534,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
// removed from region while ticking
|
||||
return;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ index 5668f80c2ac1fcf2ac0e1e5378c789d7fce655f3..ecb1b98723e78e9d2f3ce182be8f78f8
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1581,8 +1588,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1579,8 +1586,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
// removed from region while ticking
|
||||
return;
|
||||
}
|
||||
+10
-10
@@ -17,7 +17,7 @@ index 52dcbcf64c3a510d4a4524b7d0ee226d9a73511d..051d601e7e809518e8d82ae4ae325905
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 5be3e493f1638cc0befe5530c58ea15467a3a7ac..15e7d8f1fbc950f79486704f2133a7b10e303a8a 100644
|
||||
index 170ff99a055d7ea582d6a18ef6acd57269d943c4..c4dddd5c66098301de2abc2de93d4409cd14531d 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1741,7 +1741,46 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -68,10 +68,10 @@ index 5be3e493f1638cc0befe5530c58ea15467a3a7ac..15e7d8f1fbc950f79486704f2133a7b1
|
||||
this.lastServerStatus = nano;
|
||||
this.status = this.buildServerStatus();
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index ecb1b98723e78e9d2f3ce182be8f78f8f32a52da..ce0dca54b551c67797e197f848334f34e1fb3da7 100644
|
||||
index 4e1a035f8797196c765f59553ff3a0c9749bacfb..137d81703024eec114132982904cdaa2609966c2 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1485,6 +1485,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1487,6 +1487,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
public void tickNonPassenger(final Entity entity) {
|
||||
// Paper start - log detailed entity tick information
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot tick an entity off-main");
|
||||
@@ -80,7 +80,7 @@ index ecb1b98723e78e9d2f3ce182be8f78f8f32a52da..ce0dca54b551c67797e197f848334f34
|
||||
try {
|
||||
// Folia - region threading
|
||||
// Paper end - log detailed entity tick information
|
||||
@@ -1561,6 +1563,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1559,6 +1561,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
} finally {
|
||||
// Folia - region threading
|
||||
}
|
||||
@@ -88,7 +88,7 @@ index ecb1b98723e78e9d2f3ce182be8f78f8f32a52da..ce0dca54b551c67797e197f848334f34
|
||||
// Paper end - log detailed entity tick information
|
||||
}
|
||||
|
||||
@@ -1572,6 +1575,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1570,6 +1573,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
final int timerId = isActive ? entity.getType().tickTimerId : entity.getType().inactiveTickTimerId;
|
||||
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle foliaProfiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler();
|
||||
foliaProfiler.startTimer(timerId);
|
||||
@@ -97,7 +97,7 @@ index ecb1b98723e78e9d2f3ce182be8f78f8f32a52da..ce0dca54b551c67797e197f848334f34
|
||||
try {
|
||||
// Folia end - profiler
|
||||
entity.setOldPosAndRot();
|
||||
@@ -1613,6 +1618,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1611,6 +1616,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
this.tickPassenger(entity, passenger, isActive); // Paper - EAR 2
|
||||
}
|
||||
} finally { foliaProfiler.stopTimer(timerId); } // Folia - profiler
|
||||
@@ -106,7 +106,7 @@ index ecb1b98723e78e9d2f3ce182be8f78f8f32a52da..ce0dca54b551c67797e197f848334f34
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 5f5c8f20169015627a265d0a974e89cb47a4a70c..421882473989084d387f7fc1c2fc6d1ad570f18c 100644
|
||||
index 1cafca1758e7fcac59a3b3dadf28b432da82e51a..306bac1feb35b2957a6acd2b394bdd3d500e6191 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -889,6 +889,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -171,10 +171,10 @@ index f03fa06c0ba56f7f5e1e45bc1568a490751efde3..eee1c14249addbf4714df733870da974
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 319997dca2b461b41b02ca2d9b0e3ed9fd05ac88..d03267acc5209512e15065fcfb2dd32e9eb2f878 100644
|
||||
index ce1d50bfeb598e3ef3172766d575a89d0c87f921..7cf2319ea6bf4e46b7a5bedc71d46d0a3cd454eb 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -6421,4 +6421,6 @@ public abstract class Entity
|
||||
@@ -6460,4 +6460,6 @@ public abstract class Entity
|
||||
return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition());
|
||||
}
|
||||
// Paper end
|
||||
@@ -246,7 +246,7 @@ index f79353aa58b03d00839e4e95d1fd2480a635a592..0a43947bcc9f505ad9bc4d54c564709c
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index 2eb5fc819e2e17c69de87f8aa1a99e02bc5a62d5..d3f60d6414786e0eab1c99c277f79a23abffe803 100644
|
||||
index 5ffcf20d06f8a0cc0394347d8ef4cfa1e89ebab2..4e64eb78a4e3af2c23bdd9f61f77630b71ce97f4 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -170,6 +170,7 @@ public abstract class Player extends Avatar implements ContainerUser {
|
||||
+43
-30
@@ -1,24 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Thu, 9 Jul 2026 11:54:24 +0800
|
||||
Subject: [PATCH] Leaves Vanilla Hopper
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Mon, 17 Aug 2026 23:38:00 +0800
|
||||
Subject: [PATCH] Leaves Vanilla hopper
|
||||
|
||||
A part from leaves
|
||||
Co-Authored-By: Creeam <102713261+HaHaWTH@users.noreply.github.com>
|
||||
|
||||
Origin patch link: https://github.com/LeavesMC/Leaves/blob/master/leaves-server/minecraft-patches/features/0092-Vanilla-hopper.patch
|
||||
Origin license: https://github.com/LeavesMC/Leaves/blob/master/LICENSE.md
|
||||
Original license: GPL-3.0-only
|
||||
Original project: https://github.com/LeavesMC/Leaves
|
||||
|
||||
This is a temporary solution designed to attempt to restore the vanilla behavior of the funnel while preserving optimizations as much as possible. It should ultimately be replaced by the optimization solution provided by lithium.
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index a858cb658af70f07614fa1f4d9e8a3435d5c161f..4c9d0bcd8820b250b51c06fff4531021ab57d408 100644
|
||||
index a858cb658af70f07614fa1f4d9e8a3435d5c161f..5ab92e215c41f02c2a8260071f64dddae35dd15f 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -281,36 +281,55 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -281,36 +281,67 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
ItemStack movedItem = origItemStack;
|
||||
final int originalItemCount = origItemStack.getCount();
|
||||
final int movedItemCount = Math.min(level.spigotConfig.hopperAmount, originalItemCount);
|
||||
- container.setChanged(); // original logic always marks source inv as changed even if no move happens.
|
||||
- movedItem.setCount(movedItemCount);
|
||||
-
|
||||
+ // Leaves start - Vanilla hopper
|
||||
+ if (movedItemCount == 1) {
|
||||
+ movedItem.setCount(movedItemCount);
|
||||
+ if (!worldData.skipPullModeEventFire) {
|
||||
+ movedItem = callPullMoveEvent(hopper, container, movedItem);
|
||||
+ if (movedItem == null) { // cancelled
|
||||
+ origItemStack.setCount(originalItemCount);
|
||||
+ // Drastically improve performance by returning true.
|
||||
+ // No plugin could have relied on the behavior of false as the other call
|
||||
+ // site for IMIE did not exhibit the same behavior
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ final boolean removeOriginalItem = movedItem == origItemStack;
|
||||
+ if (removeOriginalItem) {
|
||||
+ movedItem = container.removeItem(i, movedItemCount);
|
||||
+ }
|
||||
|
||||
- if (!worldData.skipPullModeEventFire) { // Folia - region threading
|
||||
- movedItem = callPullMoveEvent(hopper, container, movedItem);
|
||||
- if (movedItem == null) { // cancelled
|
||||
@@ -26,34 +45,28 @@ index a858cb658af70f07614fa1f4d9e8a3435d5c161f..4c9d0bcd8820b250b51c06fff4531021
|
||||
- // Drastically improve performance by returning true.
|
||||
- // No plugin could have relied on the behavior of false as the other call
|
||||
- // site for IMIE did not exhibit the same behavior
|
||||
+ // Leaves start - fix vanilla hopper
|
||||
+ if (movedItem.getCount() <= movedItemCount) {
|
||||
+ if (!worldData.skipPullModeEventFire) {
|
||||
+ movedItem = callPullMoveEvent(hopper, container, movedItem);
|
||||
+ if (movedItem == null) { // cancelled
|
||||
+ origItemStack.setCount(originalItemCount);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ movedItem = origItemStack.copy();
|
||||
+ final ItemStack remainingItem = addItem(container, hopper, container.removeItem(i, movedItemCount), null);
|
||||
+ if (remainingItem.isEmpty()) {
|
||||
+ final int itemCountToMove = movedItem.getCount();
|
||||
+ final ItemStack remainingItem = addItem(container, hopper, movedItem, null);
|
||||
+ if (remainingItem.getCount() != itemCountToMove) {
|
||||
+ origItemStack.setCount(removeOriginalItem ? originalItemCount - movedItemCount : originalItemCount);
|
||||
+ container.setItem(i, origItemStack);
|
||||
+ container.setChanged();
|
||||
return true;
|
||||
}
|
||||
- }
|
||||
+ container.setItem(i, movedItem);
|
||||
+ } else {
|
||||
+ container.setChanged(); // original logic always marks source inv as changed even if no move happens.
|
||||
+ movedItem.setCount(movedItemCount);
|
||||
|
||||
-
|
||||
- final ItemStack remainingItem = addItem(container, hopper, movedItem, null);
|
||||
- final int remainingItemCount = remainingItem.getCount();
|
||||
- if (remainingItemCount != movedItemCount) {
|
||||
- origItemStack = origItemStack.copy(true);
|
||||
- origItemStack.setCount(originalItemCount);
|
||||
origItemStack.setCount(originalItemCount);
|
||||
- if (!origItemStack.isEmpty()) {
|
||||
- origItemStack.setCount(originalItemCount - movedItemCount + remainingItemCount);
|
||||
+ container.setItem(i, origItemStack);
|
||||
+ } else {
|
||||
+ container.setChanged(); // original logic always marks source inv as changed even if no move happens.
|
||||
+ movedItem.setCount(movedItemCount);
|
||||
+
|
||||
+ if (!worldData.skipPullModeEventFire) {
|
||||
+ movedItem = callPullMoveEvent(hopper, container, movedItem);
|
||||
+ if (movedItem == null) { // cancelled
|
||||
@@ -79,16 +92,16 @@ index a858cb658af70f07614fa1f4d9e8a3435d5c161f..4c9d0bcd8820b250b51c06fff4531021
|
||||
+ origItemStack.setCount(originalItemCount - movedItemCount + remainingItemCount);
|
||||
+ }
|
||||
+
|
||||
+ IGNORE_TILE_UPDATES.set(true);
|
||||
+ IGNORE_TILE_UPDATES.set(true); // Folia - region threading
|
||||
+ container.setItem(i, origItemStack);
|
||||
+ IGNORE_TILE_UPDATES.set(false);
|
||||
+ IGNORE_TILE_UPDATES.set(false); // Folia - region threading
|
||||
+ container.setChanged();
|
||||
+ return true;
|
||||
+ }
|
||||
+ origItemStack.setCount(originalItemCount);
|
||||
}
|
||||
- origItemStack.setCount(originalItemCount);
|
||||
+ // Leaves end - fix vanilla hopper
|
||||
+ // Leaves end - Vanilla hopper
|
||||
|
||||
if (level.paperConfig().hopper.cooldownWhenFull) {
|
||||
applyCooldown(hopper);
|
||||
+18
-18
@@ -9,7 +9,7 @@ Origin patch link: https://github.com/LeavesMC/Leaves/blob/master/leaves-server/
|
||||
Origin license: https://github.com/LeavesMC/Leaves/blob/master/LICENSE.md
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58..5a72d922af1af3a4e2314b8fa441787e7875ed77 100644
|
||||
index c04dbcd615c97cb6dcb5f14fec88daf73e6e9b4a..53970fff0c119b190195e07823d5796a99de9c3b 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -65,6 +65,10 @@ import java.util.Set;
|
||||
@@ -56,7 +56,7 @@ index eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58..5a72d922af1af3a4e2314b8fa441787e
|
||||
// connections
|
||||
for (final Connection conn : from.connections) {
|
||||
into.connections.add(conn);
|
||||
@@ -114,16 +144,22 @@ public final class RegionizedWorldData {
|
||||
@@ -111,16 +141,22 @@ public final class RegionizedWorldData {
|
||||
from.fluidLevelTicks.merge(into.fluidLevelTicks, fromRedstoneTimeOffset);
|
||||
|
||||
// tile entity ticking
|
||||
@@ -83,7 +83,7 @@ index eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58..5a72d922af1af3a4e2314b8fa441787e
|
||||
if (tileEntity != null) {
|
||||
tileEntity.updateTicks(fromTickOffset, fromRedstoneTimeOffset);
|
||||
}
|
||||
@@ -167,6 +203,37 @@ public final class RegionizedWorldData {
|
||||
@@ -164,6 +200,37 @@ public final class RegionizedWorldData {
|
||||
public void split(final RegionizedWorldData from, final int chunkToRegionShift,
|
||||
final Long2ReferenceOpenHashMap<RegionizedWorldData> regionToData,
|
||||
final ReferenceOpenHashSet<RegionizedWorldData> dataSet) {
|
||||
@@ -121,7 +121,7 @@ index eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58..5a72d922af1af3a4e2314b8fa441787e
|
||||
// connections
|
||||
for (final Connection conn : from.connections) {
|
||||
final ServerPlayer player = conn.getPlayer();
|
||||
@@ -243,8 +310,9 @@ public final class RegionizedWorldData {
|
||||
@@ -237,8 +304,9 @@ public final class RegionizedWorldData {
|
||||
from.fluidLevelTicks.split(chunkToRegionShift, levelTicksFluidRegionData);
|
||||
|
||||
// tile entity ticking
|
||||
@@ -133,7 +133,7 @@ index eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58..5a72d922af1af3a4e2314b8fa441787e
|
||||
final int chunkX = pos.getX() >> 4;
|
||||
final int chunkZ = pos.getZ() >> 4;
|
||||
|
||||
@@ -254,8 +322,9 @@ public final class RegionizedWorldData {
|
||||
@@ -248,8 +316,9 @@ public final class RegionizedWorldData {
|
||||
} // else: when a chunk unloads, it does not actually _remove_ the tile entity from the list, it just gets
|
||||
// marked as removed. So if there is no section, it's probably removed!
|
||||
}
|
||||
@@ -145,7 +145,7 @@ index eef3f6b5d13d8a5ba3d66f5fe297b431cff28f58..5a72d922af1af3a4e2314b8fa441787e
|
||||
final int chunkX = pos.getX() >> 4;
|
||||
final int chunkZ = pos.getZ() >> 4;
|
||||
|
||||
@@ -483,6 +552,11 @@ public final class RegionizedWorldData {
|
||||
@@ -478,6 +547,11 @@ public final class RegionizedWorldData {
|
||||
public final io.papermc.paper.redstone.RedstoneWireTurbo turbo;
|
||||
// Environment attribute system
|
||||
public Reference2ObjectOpenHashMap<EnvironmentAttribute<?>, EnvironmentAttributeSystem.ValueSampler<?>> attributeSamplers;
|
||||
@@ -240,7 +240,7 @@ index 6e08d50794c4af4405f3e164a3fd46f376b3f78f..dd2d0940eece3e85078e574f66f71a4c
|
||||
|
||||
int getContainerSize();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index d03267acc5209512e15065fcfb2dd32e9eb2f878..17129f6c094b976a209e25773bef24d4b38f4156 100644
|
||||
index 7cf2319ea6bf4e46b7a5bedc71d46d0a3cd454eb..6be5b9d82686c52eb04ee501fc762b5ddfbc2cca 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -324,7 +324,7 @@ public abstract class Entity
|
||||
@@ -252,7 +252,7 @@ index d03267acc5209512e15065fcfb2dd32e9eb2f878..17129f6c094b976a209e25773bef24d4
|
||||
private final VecDeltaCodec packetPositionCodec = new VecDeltaCodec();
|
||||
public boolean needsSync;
|
||||
public boolean syncPosition;
|
||||
@@ -4467,11 +4467,13 @@ public abstract class Entity
|
||||
@@ -4489,11 +4489,13 @@ public abstract class Entity
|
||||
}
|
||||
|
||||
protected Entity transformForAsyncTeleport(ServerLevel destination, Vec3 pos, Float yaw, Float pitch, Vec3 velocity) {
|
||||
@@ -266,7 +266,7 @@ index d03267acc5209512e15065fcfb2dd32e9eb2f878..17129f6c094b976a209e25773bef24d4
|
||||
if (copy instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon dragon) dragon.syncDragonPartsAfterTeleportTransform(); // Shiroha - Fix dragon part desync
|
||||
// vanilla code used to call remove _after_ copying, and some stuff is required to be after copy - so add hook here
|
||||
// for example, clearing of inventory after switching dimensions
|
||||
@@ -6027,8 +6029,29 @@ public abstract class Entity
|
||||
@@ -6061,8 +6063,29 @@ public abstract class Entity
|
||||
this.setBoundingBox(this.makeBoundingBox());
|
||||
}
|
||||
// Paper end - Block invalid positions and bounding box
|
||||
@@ -1573,7 +1573,7 @@ index 6109d8da984b398bb1eb6cd6ab9a55f0511a615c..d3d6b3aeb24da7f3bf92c327095a9dc9
|
||||
+ // Leaves end - Lithium Sleeping Block Entity
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3d32f0d42 100644
|
||||
index 5ab92e215c41f02c2a8260071f64dddae35dd15f..a847bcf24b7ac1ed702027b43438e28037daba84 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -27,8 +27,29 @@ import net.minecraft.world.level.storage.ValueInput;
|
||||
@@ -1660,7 +1660,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -406,6 +447,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -418,6 +459,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
private static void applyCooldown(final Hopper hopper) {
|
||||
if (hopper instanceof HopperBlockEntity blockEntity && blockEntity.getLevel() != null) {
|
||||
blockEntity.setCooldown(blockEntity.getLevel().spigotConfig.hopperTransfer);
|
||||
@@ -1668,7 +1668,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,12 +491,20 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -461,12 +503,20 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
// Paper end - Perf: Optimize Hoppers
|
||||
|
||||
private static boolean ejectItems(final Level level, final BlockPos blockPos, final HopperBlockEntity self) {
|
||||
@@ -1690,7 +1690,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
if (isFullContainer(container, direction)) {
|
||||
return false;
|
||||
}
|
||||
@@ -510,13 +560,21 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -522,13 +572,21 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
io.papermc.paper.threadedregions.RegionizedWorldData worldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - region threading
|
||||
BlockPos blockPos = BlockPos.containing(hopper.getLevelX(), hopper.getLevelY() + 1.0, hopper.getLevelZ());
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
@@ -1716,7 +1716,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -527,7 +585,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -539,7 +597,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
&& blockState.isCollisionShapeFullBlock(level, blockPos)
|
||||
&& !blockState.is(BlockTags.DOES_NOT_BLOCK_HOPPERS);
|
||||
if (!isBlocked) {
|
||||
@@ -1725,7 +1725,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
if (addItem(hopper, entity)) {
|
||||
return true;
|
||||
}
|
||||
@@ -649,7 +707,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -661,7 +719,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
// CraftBukkit start
|
||||
private static @Nullable Container runHopperInventorySearchEvent(
|
||||
@@ -1734,7 +1734,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
org.bukkit.craftbukkit.block.CraftBlock hopper,
|
||||
org.bukkit.craftbukkit.block.CraftBlock searchLocation,
|
||||
org.bukkit.event.inventory.HopperInventorySearchEvent.ContainerType containerType
|
||||
@@ -775,6 +833,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -787,6 +845,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
}
|
||||
|
||||
public void setCooldown(final int time) {
|
||||
@@ -1754,7 +1754,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
this.cooldownTime = time;
|
||||
}
|
||||
|
||||
@@ -794,6 +865,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -806,6 +877,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@Override
|
||||
protected void setItems(final NonNullList<ItemStack> items) {
|
||||
this.items = items;
|
||||
@@ -1762,7 +1762,7 @@ index 4c9d0bcd8820b250b51c06fff4531021ab57d408..fb0f4edfa0c6d08364db5a62b13e98a3
|
||||
}
|
||||
|
||||
public static void entityInside(final Level level, final BlockPos pos, final BlockState blockState, final Entity entity, final HopperBlockEntity hopper) {
|
||||
@@ -808,4 +880,758 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -820,4 +892,758 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) {
|
||||
return new HopperMenu(containerId, inventory, this);
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18
|
||||
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
index f649c46cc9a34e646f8da3244866c6e011d30aa3..184637ac35a92097391f13bc6355f88495deb483 100644
|
||||
index 0869ecb4b7fe07efa33d521bef2f525955bd3c30..947094f64d1f2270377ad1e688bd0db503e1c76c 100644
|
||||
--- a/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
@@ -190,6 +190,53 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
|
||||
+4
-4
@@ -9,10 +9,10 @@ Original patch: https://github.com/pufferfish-gg/Pufferfish/blob/ver/1.21/puffer
|
||||
Original license(GPL-3.0): https://github.com/pufferfish-gg/Pufferfish/blob/ver/1.21/PATCH-LICENSE
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index 5a72d922af1af3a4e2314b8fa441787e7875ed77..1d393b97d09083eee5e21e00be5223741b5b7819 100644
|
||||
index 53970fff0c119b190195e07823d5796a99de9c3b..08e4adac3425a94f9bcf5191883d333cfe5bf5c9 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -408,6 +408,10 @@ public final class RegionizedWorldData {
|
||||
@@ -402,6 +402,10 @@ public final class RegionizedWorldData {
|
||||
|
||||
private RegionizedServer.WorldLevelData tickData;
|
||||
|
||||
@@ -21,8 +21,8 @@ index 5a72d922af1af3a4e2314b8fa441787e7875ed77..1d393b97d09083eee5e21e00be522374
|
||||
+ public long pufferfish$loadedTick = 0L;
|
||||
+ // Shiroha end
|
||||
// connections
|
||||
public final List<Connection> connections = new ArrayList<>();
|
||||
|
||||
private static final Connection[] EMPTY_CONNECTION_ARRAY = new Connection[0];
|
||||
private final ReferenceList<Connection> connections = new ReferenceList<>(EMPTY_CONNECTION_ARRAY);
|
||||
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 721e3b083846fd363a31311196bc4c681969215c..cc3aebbd42a876fcc982a9bf1c3dc1bd11f3a4e0 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+4
-4
@@ -8,7 +8,7 @@ As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40
|
||||
Licensed under: GPL-3.0 (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/GPL-3.0.txt)
|
||||
|
||||
diff --git a/net/minecraft/server/commands/SeedCommand.java b/net/minecraft/server/commands/SeedCommand.java
|
||||
index 86ee3b3ae028597576b9549bc4954dfcbaa6732c..56bab28e8fcae16a4e71527afb73e5794098723e 100644
|
||||
index 86ee3b3ae028597576b9549bc4954dfcbaa6732c..4a4f45b02a6ff32065a521552f50cba2a2bdd1ff 100644
|
||||
--- a/net/minecraft/server/commands/SeedCommand.java
|
||||
+++ b/net/minecraft/server/commands/SeedCommand.java
|
||||
@@ -13,6 +13,15 @@ public class SeedCommand {
|
||||
@@ -18,7 +18,7 @@ index 86ee3b3ae028597576b9549bc4954dfcbaa6732c..56bab28e8fcae16a4e71527afb73e579
|
||||
+ // Leaf start - Matter - SecureSeed Command
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.function.SecureSeedConfig.enabled) {
|
||||
+ su.plo.matter.Globals.setupGlobals(c.getSource().getLevel());
|
||||
+ String seedStr = su.plo.matter.Globals.seedToString(su.plo.matter.Globals.worldSeed);
|
||||
+ String seedStr = su.plo.matter.Globals.seedToString(su.plo.matter.Globals.worldSeed.get());
|
||||
+ Component featureSeedComponent = ComponentUtils.copyOnClickText(seedStr);
|
||||
+
|
||||
+ c.getSource().sendSuccess(() -> Component.translatable(("Feature seed: %s"), featureSeedComponent), false);
|
||||
@@ -63,10 +63,10 @@ index 7927769cf9bccb892745f4d1390eb83b2861d1bb..414c21345879f589fb61130180d0ca60
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index ce0dca54b551c67797e197f848334f34e1fb3da7..8634e0b6d280e2c5900197420ad457f778245087 100644
|
||||
index 137d81703024eec114132982904cdaa2609966c2..579e40e74cd90fae60237f0b6d307b971161bfbf 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -633,6 +633,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -634,6 +634,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
generator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, generator, gen);
|
||||
}
|
||||
// CraftBukkit end
|
||||
+1
-1
@@ -9,7 +9,7 @@ As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40
|
||||
Licensed under: MIT (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/MIT.txt)
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 9770ced361547b98179ec09dc85cea399f1a88cb..d9e22ca839e6ed756ff15597ba639113342d15e4 100644
|
||||
index ac5f82eaa9965f7b610f7df2d0cd4cb028951d65..206af6865525d238ae1501ef023f5e5ade11faa5 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1294,22 +1294,26 @@ public abstract class PlayerList {
|
||||
+2
-2
@@ -8,10 +8,10 @@ This is a part of Leaf(https://github.com/Winds-Studio/Leaf/blob/d0ed97cf45dfa94
|
||||
Original license: https://github.com/Winds-Studio/Leaf/blob/d0ed97cf45dfa94f686ef32f0eea1ec7323f78d5/LICENSE.md
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index 1d393b97d09083eee5e21e00be5223741b5b7819..f46f3b24b2ef75bb091cf4e2286b56cb9fcba680 100644
|
||||
index 08e4adac3425a94f9bcf5191883d333cfe5bf5c9..e540458c7b21dd01c05012a82deee6a3ad613e24 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -530,6 +530,7 @@ public final class RegionizedWorldData {
|
||||
@@ -525,6 +525,7 @@ public final class RegionizedWorldData {
|
||||
public final PathTypeCache pathTypesByPosCache = new PathTypeCache();
|
||||
public final List<LevelChunk> temporaryChunkTickList = new java.util.ArrayList<>();
|
||||
public final Set<ChunkHolder> chunkHoldersToBroadcast = new ReferenceLinkedOpenHashSet<>();
|
||||
+5
-5
@@ -8,7 +8,7 @@ A part of Leaf(https://github.com/Winds-Studio/Leaf/blob/edb0504069139beaa6f39ef
|
||||
License: https://github.com/Winds-Studio/Leaf/blob/edb0504069139beaa6f39efa4702370c2576b3fc/LICENSE.md
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 15e7d8f1fbc950f79486704f2133a7b10e303a8a..95ae9d9882b27fa1e7df13002e793f27a8d86c09 100644
|
||||
index c4dddd5c66098301de2abc2de93d4409cd14531d..24ccb47605427f83bbfe552edf4d92e9c16e2a1f 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -217,7 +217,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -21,7 +21,7 @@ index 15e7d8f1fbc950f79486704f2133a7b10e303a8a..95ae9d9882b27fa1e7df13002e793f27
|
||||
private final List<Runnable> tickables = Lists.newArrayList();
|
||||
// Paper - per-level GameRules
|
||||
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 1b4229085f9d4189efb20c083bbfe2e6712e72a4..822e69a975b5c08547b17f8abfa0d512c70a2625 100644
|
||||
index 8c4b60e7c7c44f20e13e917bc0bc3b75e98a36c1..6a423ec8d0b909485cc3fabd554e4431af369c7e 100644
|
||||
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -167,11 +167,20 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -63,7 +63,7 @@ index 1b4229085f9d4189efb20c083bbfe2e6712e72a4..822e69a975b5c08547b17f8abfa0d512
|
||||
|
||||
gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent
|
||||
ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.name(), gameprofile.id());
|
||||
@@ -341,7 +359,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -345,7 +363,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
server.getPluginManager().callEvent(asyncEvent);
|
||||
profile = asyncEvent.getPlayerProfile();
|
||||
profile.complete(true); // Paper - setPlayerProfileAPI
|
||||
@@ -86,12 +86,12 @@ index 7443744e3f256983e52a1cefcaf66082e4a46a7b..b7553611723f7120c66e1f3e51d89df2
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index d9e22ca839e6ed756ff15597ba639113342d15e4..af00f2f278f81d3ab156bc48161d454c981bc084 100644
|
||||
index 206af6865525d238ae1501ef023f5e5ade11faa5..11c49f4b19a2a7221c34203fe0b26d256b4fac26 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -134,6 +134,7 @@ public abstract class PlayerList {
|
||||
private org.bukkit.craftbukkit.CraftServer cserver;
|
||||
private final Map<String,ServerPlayer> playersByName = new java.util.HashMap<>();
|
||||
private final Map<String,ServerPlayer> playersByName = new java.util.concurrent.ConcurrentHashMap<>(); // Folia - region threading - change to CHM - Note: we do NOT expect concurrency PER KEY!
|
||||
public @Nullable String collideRuleTeamName; // Paper - Configurable player collision
|
||||
+ public final List<String> playedPlayers = new java.util.concurrent.CopyOnWriteArrayList<>(); // Leaf - Configurable vanilla username check
|
||||
|
||||
+5
-5
@@ -6,7 +6,7 @@ Subject: [PATCH] Leaves: Disable packet limit & Shiroha: Option to full
|
||||
|
||||
|
||||
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
|
||||
index d3fb20f465c0b69662d81b53201963634d8b53d2..4e557a304e2c1c6d581fdf4a8d30c6a23dd945af 100644
|
||||
index cc9459273762cde3e6b87a7eaf225607f527315c..ddcb9370b316441a78e95c19bc34812e63a514e2 100644
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
+++ b/net/minecraft/network/Connection.java
|
||||
@@ -258,8 +258,8 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -21,7 +21,7 @@ index d3fb20f465c0b69662d81b53201963634d8b53d2..4e557a304e2c1c6d581fdf4a8d30c6a2
|
||||
synchronized (PACKET_LIMIT_LOCK) {
|
||||
if (this.allPacketCounts != null) {
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 392c4b39a9c31be4b5b1fa61f6836920b43e58a3..9ed70554904b90fc686a6cf9039a7d24b6b040e1 100644
|
||||
index 4f2ea3d0a3e15dd78bd4cece163d37bf773958bd..85c74dd76c34a816ddb1f84fa572d4396bfda9fe 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -890,7 +890,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -33,7 +33,7 @@ index 392c4b39a9c31be4b5b1fa61f6836920b43e58a3..9ed70554904b90fc686a6cf9039a7d24
|
||||
this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect
|
||||
return;
|
||||
}
|
||||
@@ -2124,6 +2124,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2125,6 +2125,7 @@ public class ServerGamePacketListenerImpl
|
||||
private long lastLimitedPacket = -1;
|
||||
|
||||
private boolean checkLimit(long timestamp) {
|
||||
@@ -41,7 +41,7 @@ index 392c4b39a9c31be4b5b1fa61f6836920b43e58a3..9ed70554904b90fc686a6cf9039a7d24
|
||||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.incomingPacketThreshold.enabled()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2690,6 +2691,8 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2691,6 +2692,8 @@ public class ServerGamePacketListenerImpl
|
||||
|
||||
// Spigot start - spam exclusions
|
||||
private void detectRateSpam(final TickThrottler throttler, final String message) {
|
||||
@@ -50,7 +50,7 @@ index 392c4b39a9c31be4b5b1fa61f6836920b43e58a3..9ed70554904b90fc686a6cf9039a7d24
|
||||
if (org.spigotmc.SpigotConfig.enableSpamExclusions) {
|
||||
for (String exclude : org.spigotmc.SpigotConfig.spamExclusions) {
|
||||
if (exclude != null && message.startsWith(exclude)) {
|
||||
@@ -3488,7 +3491,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -3489,7 +3492,7 @@ public class ServerGamePacketListenerImpl
|
||||
@Override
|
||||
public void handlePlaceRecipe(final ServerboundPlaceRecipePacket packet) {
|
||||
// Paper start - auto recipe limit
|
||||
+2
-2
@@ -8,7 +8,7 @@ As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/c5f18b7864206cea4411
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
index 8d2518600ad518999b75124f0a87db9efe541f2e..d66e65fdee6117b0da7368a3ef9c3ae063974afa 100644
|
||||
index bc91b87da9c8034fc142007bfb0be4927bd958d6..a299de892feb1b0c37ba3d7e2a63e20076fcc1e2 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -101,6 +101,14 @@ public final class CollisionUtil {
|
||||
@@ -35,7 +35,7 @@ index 8d2518600ad518999b75124f0a87db9efe541f2e..d66e65fdee6117b0da7368a3ef9c3ae0
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2087,6 +2095,18 @@ public final class CollisionUtil {
|
||||
@@ -2088,6 +2096,18 @@ public final class CollisionUtil {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Thu, 16 Jul 2026 23:04:23 +0800
|
||||
Subject: [PATCH] Frustum filtering tracker
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
|
||||
index 163999d50213e0167eb09f0eae883388849f28fa..6059aa66b779d625ad1a4d4bdfe444a46cd9f3ab 100644
|
||||
--- a/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -933,6 +933,7 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP
|
||||
public void move(final ServerPlayer player) {
|
||||
// Paper - optimise entity tracker
|
||||
|
||||
+ if (player.culling != null) player.culling.updateFrustum(); // Shiroha - Frustum filtering tracker
|
||||
SectionPos oldSection = player.getLastSectionPos();
|
||||
SectionPos newSection = SectionPos.of(player);
|
||||
//boolean wasIgnored = this.playerMap.ignored(player); // Folia - region threading
|
||||
@@ -1055,6 +1056,11 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP
|
||||
final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup)((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getEntityLookup();;
|
||||
final ca.spottedleaf.moonrise.common.misc.NearbyPlayers nearbyPlayers = this.level.moonrise$getNearbyPlayers(); // Folia - region threading
|
||||
|
||||
+ // Shiroha start - Frustum filtering tracker
|
||||
+ for (var player : worldData.getLocalPlayers()) {
|
||||
+ if (player.culling != null) player.culling.updateFrustum();
|
||||
+ }
|
||||
+ // Shiroha end - Frustum filtering tracker
|
||||
final ca.spottedleaf.moonrise.common.list.ReferenceList<net.minecraft.world.entity.Entity> trackerEntities = worldData.trackerEntities; // Folia - region threading
|
||||
final Entity[] trackerEntitiesRaw = trackerEntities.getRawDataUnchecked();
|
||||
for (int i = 0, len = totalEntities = trackerEntities.size(); i < len; ++i) { // Folia - region threading
|
||||
@@ -1372,6 +1378,15 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP
|
||||
if (visibleToPlayer && (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(player) || !player.getBukkitEntity().canSee(this.entity.getBukkitEntity()))) { // Paper - only consider hits // Folia - region threading
|
||||
visibleToPlayer = false;
|
||||
}
|
||||
+ // Shiroha start - Frustum filtering tracker
|
||||
+ if (player.culling != null) {
|
||||
+ player.culling.far((float) Math.sqrt(distanceSquared));
|
||||
+
|
||||
+ if (visibleToPlayer && !player.isSpectator() && distanceSquared > (io.nanachiyo0721.shiroha.config.modules.optimizations.FrustumFilteringTrackerConfig.minForceVisibleDistance * io.nanachiyo0721.shiroha.config.modules.optimizations.FrustumFilteringTrackerConfig.minForceVisibleDistance)) {
|
||||
+ visibleToPlayer = player.culling.isVisibleFor(this.entity.getBoundingBox());
|
||||
+ }
|
||||
+ }
|
||||
+ // Shiroha end - Frustum filtering tracker
|
||||
// CraftBukkit end
|
||||
if (visibleToPlayer) {
|
||||
if (this.seenBy.add(player.connection)) {
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index e5e5e1da691dc71dc806d3b039ff02b1fa50eacf..6a314d934e476cf2579034324950961cf35bac84 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -186,6 +186,8 @@ public abstract class Player extends Avatar implements ContainerUser {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ public io.nanachiyo0721.shiroha.utils.Culling culling = io.nanachiyo0721.shiroha.config.modules.optimizations.FrustumFilteringTrackerConfig.enabled ? io.nanachiyo0721.shiroha.utils.Culling.fromConfig(this) : null; // Shiroha - Frustum filtering tracker
|
||||
+
|
||||
public Player(final Level level, final GameProfile gameProfile) {
|
||||
super(EntityTypes.PLAYER, level);
|
||||
this.setUUID(gameProfile.id());
|
||||
+3
-3
@@ -10,10 +10,10 @@ VMP (https://github.com/RelativityMC/VMP-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 17129f6c094b976a209e25773bef24d4b38f4156..5d52a4e0a9d32957bb74472fa385d9fab8c241f1 100644
|
||||
index 6be5b9d82686c52eb04ee501fc762b5ddfbc2cca..7365aa216ece4c04d0315da7e12ead1af235eccd 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1152,8 +1152,14 @@ public abstract class Entity
|
||||
@@ -1154,8 +1154,14 @@ public abstract class Entity
|
||||
private double moveStartY;
|
||||
private double moveStartZ;
|
||||
// Paper end - detailed watchdog information
|
||||
@@ -28,7 +28,7 @@ index 17129f6c094b976a209e25773bef24d4b38f4156..5d52a4e0a9d32957bb74472fa385d9fa
|
||||
final Vec3 originalMovement = delta; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
@@ -5521,6 +5527,11 @@ public abstract class Entity
|
||||
@@ -5555,6 +5561,11 @@ public abstract class Entity
|
||||
}
|
||||
|
||||
public final void setBoundingBox(final AABB bb) {
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sat, 25 Jul 2026 21:16:19 +0800
|
||||
Subject: [PATCH] Lithium Optimizes Hoglin repellent search.
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
|
||||
index 7022679c84e184999b416e06d1af2cc2500cb12b..ac8f4acc2aaee8ca9f7598d842ecf29f2ad73be3 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
|
||||
@@ -16,6 +16,14 @@ import net.minecraft.world.entity.monster.hoglin.Hoglin;
|
||||
import net.minecraft.world.entity.monster.piglin.Piglin;
|
||||
|
||||
public class HoglinSpecificSensor extends Sensor<Hoglin> {
|
||||
+ // Shiroha start - Lithium Optimizes Hoglin repellent search.
|
||||
+ private static final java.util.function.Predicate<net.minecraft.world.level.block.state.BlockState> IS_VALID_REPELLENT_PREDICATE =
|
||||
+ HoglinSpecificSensor::lithium$isValidRepellent;
|
||||
+
|
||||
+ private static boolean lithium$isValidRepellent(net.minecraft.world.level.block.state.BlockState blockState) {
|
||||
+ return blockState.is(BlockTags.HOGLIN_REPELLENTS);
|
||||
+ }
|
||||
+ // Shiroha end - Lithium Optimizes Hoglin repellent search.
|
||||
@Override
|
||||
public Set<MemoryModuleType<?>> requires() {
|
||||
return ImmutableSet.of(
|
||||
@@ -30,8 +38,8 @@ public class HoglinSpecificSensor extends Sensor<Hoglin> {
|
||||
|
||||
@Override
|
||||
protected void doTick(final ServerLevel level, final Hoglin body) {
|
||||
- Brain<?> brain = body.getBrain();
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, this.findNearestRepellent(level, body));
|
||||
+ Brain<?> brain = body.getBrain();;
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CommonBlockSearchesCheckAndCache.blockPosFindClosestMatch(level, body, 8, 4, IS_VALID_REPELLENT_PREDICATE, true)); // Shiroha - Lithium Optimizes Hoglin repellent search.
|
||||
Optional<Piglin> adultPiglin = Optional.empty();
|
||||
int adultPiglinCount = 0;
|
||||
List<Hoglin> adultHoglins = Lists.newArrayList();
|
||||
+3
-3
@@ -57,10 +57,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index 8634e0b6d280e2c5900197420ad457f778245087..05aa5cd8869d4997da137661dcdc9f2f61c6e438 100644
|
||||
index 579e40e74cd90fae60237f0b6d307b971161bfbf..c7bad58fded53e03988a462e0def43113b4c8c94 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1052,7 +1052,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1054,7 +1054,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
}
|
||||
|
||||
// Paper start - optimise random ticking
|
||||
@@ -69,7 +69,7 @@ index 8634e0b6d280e2c5900197420ad457f778245087..05aa5cd8869d4997da137661dcdc9f2f
|
||||
|
||||
private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) {
|
||||
final LevelChunkSection[] sections = chunk.getSections();
|
||||
@@ -1134,7 +1134,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
@@ -1136,7 +1136,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
||||
int minZ = chunkPos.getMinBlockZ();
|
||||
ProfilerFiller profiler = Profiler.get();
|
||||
profiler.push("thunder");
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sat, 25 Jul 2026 21:30:26 +0800
|
||||
Subject: [PATCH] Lithium Optimizes Piglin repellent search.
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
|
||||
index 060a53da799a3036a343cc6f1d73e3e5ca4b7af9..7e5accce5a9183165e7604ca5e144e600b6f503d 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
|
||||
@@ -26,6 +26,15 @@ import net.minecraft.world.level.block.CampfireBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class PiglinSpecificSensor extends Sensor<LivingEntity> {
|
||||
+ // Shiroha start - Lithium Optimizes Piglin repellent search.
|
||||
+ private static final java.util.function.Predicate<BlockState> IS_VALID_REPELLENT_PREDICATE =
|
||||
+ PiglinSpecificSensor::lithium$isValidRepellent;
|
||||
+ private static boolean lithium$isValidRepellent(BlockState blockState){
|
||||
+ final boolean isPiglinRepellent = blockState.is(BlockTags.PIGLIN_REPELLENTS);
|
||||
+ return isPiglinRepellent && blockState.is(Blocks.SOUL_CAMPFIRE) ?
|
||||
+ CampfireBlock.isLitCampfire(blockState) : isPiglinRepellent;
|
||||
+ }
|
||||
+ // Shiroha end - Lithium Optimizes Piglin repellent search.
|
||||
@Override
|
||||
public Set<MemoryModuleType<?>> requires() {
|
||||
return ImmutableSet.of(
|
||||
@@ -47,7 +56,7 @@ public class PiglinSpecificSensor extends Sensor<LivingEntity> {
|
||||
@Override
|
||||
protected void doTick(final ServerLevel level, final LivingEntity body) {
|
||||
Brain<?> brain = body.getBrain();
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, findNearestRepellent(level, body));
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CommonBlockSearchesCheckAndCache.blockPosFindClosestMatch(level, body, 8, 4, IS_VALID_REPELLENT_PREDICATE, true)); // Shiroha - Lithium Optimizes Piglin repellent search.
|
||||
Optional<Mob> nemesis = Optional.empty();
|
||||
Optional<Hoglin> huntableHoglin = Optional.empty();
|
||||
Optional<Hoglin> babyHoglin = Optional.empty();
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sat, 25 Jul 2026 21:33:58 +0800
|
||||
Subject: [PATCH] Lithium Optimize remove block goal
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
index ff0f99d4b560a1c0721885b0eba5bd5ab2087bd7..90beeee7b74324f81690776546713b4f04887f75 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
@@ -25,6 +25,19 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
private final Mob removerMob;
|
||||
private int ticksSinceReachedGoal;
|
||||
private static final int WAIT_AFTER_BLOCK_FOUND = 20;
|
||||
+ // Shiroha start - Lithium Optimize remove block goal
|
||||
+ private static final java.util.function.BiPredicate<ChunkAccess, BlockPos.MutableBlockPos> IS_VALID_TARGET_ABOVE_BIPREDICATE =
|
||||
+ RemoveBlockGoal::lithium$isValidTargetAbove;
|
||||
+ //Split check condition in order to use maybeHas
|
||||
+ private boolean lithium$isValidTargetBlock(net.minecraft.world.level.block.state.BlockState blockState){
|
||||
+ return blockState.is(this.blockToRemove);
|
||||
+ }
|
||||
+
|
||||
+ private static boolean lithium$isValidTargetAbove(ChunkAccess chunkAccess, BlockPos.MutableBlockPos mutable) {
|
||||
+ return chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir()
|
||||
+ && chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir();
|
||||
+ }
|
||||
+ // Shiroha end - Lithium Optimize remove block goal
|
||||
|
||||
public RemoveBlockGoal(final Block blockToRemove, final PathfinderMob mob, final double speedModifier, final int verticalSearchRange) {
|
||||
super(mob, speedModifier, 24, verticalSearchRange);
|
||||
@@ -39,7 +52,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
} else if (this.nextStartTick > 0) {
|
||||
this.nextStartTick--;
|
||||
return false;
|
||||
- } else if (this.findNearestBlock()) {
|
||||
+ } else if (((net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.LithiumMoveToBlockGoal) this).lithium$findNearestBlock(this::lithium$isValidTargetBlock, IS_VALID_TARGET_ABOVE_BIPREDICATE, false)) { // Shiroha - Lithium Optimize remove block goal
|
||||
this.nextStartTick = reducedTickDelay(20);
|
||||
return true;
|
||||
} else {
|
||||
+4
-4
@@ -20,10 +20,10 @@ As part of: Akarin (https://github.com/Akarin-project/Akarin)
|
||||
Licensed under: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 5d52a4e0a9d32957bb74472fa385d9fab8c241f1..2e07b56b94aaf9026320a11105caa892a943879c 100644
|
||||
index 7365aa216ece4c04d0315da7e12ead1af235eccd..2a51f2fefc93c9a4ef42e93e83af4e8a305ea35a 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -2438,8 +2438,8 @@ public abstract class Entity
|
||||
@@ -2458,8 +2458,8 @@ public abstract class Entity
|
||||
}
|
||||
|
||||
public void push(final Entity entity) {
|
||||
@@ -31,5 +31,5 @@ index 5d52a4e0a9d32957bb74472fa385d9fab8c241f1..2e07b56b94aaf9026320a11105caa892
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
- if (!entity.noPhysics && !this.noPhysics) {
|
||||
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
|
||||
double xa = entity.getX() - this.getX();
|
||||
double za = entity.getZ() - this.getZ();
|
||||
// Paper start - Add EntityCollideWithEntity Event
|
||||
if (io.papermc.paper.event.entity.EntityCollideWithEntityEvent.getHandlerList().getRegisteredListeners().length != 0 &&
|
||||
+2
-2
@@ -7,10 +7,10 @@ License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://github.com/GaleMC/Gale
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 2e07b56b94aaf9026320a11105caa892a943879c..14edc8947cf728e0e668ac20c2b9cd53fdaa387d 100644
|
||||
index 2a51f2fefc93c9a4ef42e93e83af4e8a305ea35a..fdf43e876d5387d93e2776885179f2478cbd1a19 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1299,8 +1299,17 @@ public abstract class Entity
|
||||
@@ -1319,8 +1319,17 @@ public abstract class Entity
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@ As part of: JettPack (https://gitlab.com/Titaniumtown/JettPack)
|
||||
Licensed under: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
index 8d9ce3d301d5f7e4106587ae00adb8dd5b8b6f88..dd8a4e445928d93667702dedbd35ab3e0f94f3be 100644
|
||||
index 5b7ed8e5067683143c99473a126e17baa531903c..ece13c12b793ede92ec67850ab6d5a88fddb8afa 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
@@ -400,7 +400,6 @@ public final class ChunkEntitySlices {
|
||||
@@ -137,7 +137,7 @@ index 2e71a1cbabf3405e3e4fd5349a1784d895e7e60c..42de919064680b1a464d813976ca5e69
|
||||
if (!itemStack.isEmpty()) {
|
||||
slots.add(Pair.of(slot, itemStack.copy()));
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 421882473989084d387f7fc1c2fc6d1ad570f18c..116568953a244b6d97935089a0b7e895b32b5cc9 100644
|
||||
index 306bac1feb35b2957a6acd2b394bdd3d500e6191..f169316ddef764a43ea38d8cdc017004d03e0a5f 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1422,7 +1422,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -150,10 +150,10 @@ index 421882473989084d387f7fc1c2fc6d1ad570f18c..116568953a244b6d97935089a0b7e895
|
||||
this.getInventory().equipment.set(value, net.minecraft.world.item.ItemStack.EMPTY);
|
||||
}
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 9ed70554904b90fc686a6cf9039a7d24b6b040e1..c3fe81c7116a249a19a893e1b15214377f65b703 100644
|
||||
index 85c74dd76c34a816ddb1f84fa572d4396bfda9fe..5cb1d887ed7f436d2eaf9ed4249df6d5bc83304b 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3022,7 +3022,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -3023,7 +3023,7 @@ public class ServerGamePacketListenerImpl
|
||||
// SPIGOT-7136 - Allays
|
||||
if (target instanceof net.minecraft.world.entity.animal.allay.Allay || target instanceof net.minecraft.world.entity.animal.equine.AbstractHorse) { // Paper - Fix horse armor desync
|
||||
ServerGamePacketListenerImpl.this.send(new net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket(
|
||||
@@ -287,7 +287,7 @@ index 9e4293c6df1851a852423b469577388d2254e169..952b09fba4cf7de90110a7aa4b96dc03
|
||||
ItemStack itemStack = this.equipment.get(slot); // Paper
|
||||
if (!itemStack.isEmpty() && !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index d3f60d6414786e0eab1c99c277f79a23abffe803..e5e5e1da691dc71dc806d3b039ff02b1fa50eacf 100644
|
||||
index 4e64eb78a4e3af2c23bdd9f61f77630b71ce97f4..bb2a62bfca35f19fd6721fea9610b3b5eb76a557 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -346,7 +346,7 @@ public abstract class Player extends Avatar implements ContainerUser {
|
||||
+97
-5
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sat, 25 Jul 2026 21:30:17 +0800
|
||||
Subject: [PATCH] Lithium Optimizes move to block goal
|
||||
Date: Sat, 25 Jul 2026 21:16:19 +0800
|
||||
Subject: [PATCH] Lithium optimized non poi block searching
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||
index c6e9b155c2341c13d569f28f54f0c1d2d7313676..7bd3c8a1c627cfd3e377a269c649c0c169634b49 100644
|
||||
index c6e9b155c2341c13d569f28f54f0c1d2d7313676..5b186bad86ae1465f2b2f9124ded943ad83fabc2 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.core.BlockPos;
|
||||
@@ -21,7 +21,7 @@ index c6e9b155c2341c13d569f28f54f0c1d2d7313676..7bd3c8a1c627cfd3e377a269c649c0c1
|
||||
}
|
||||
|
||||
protected abstract boolean isValidTarget(LevelReader level, BlockPos pos);
|
||||
+ // Shiorha start - Lithium Optimizes move to block goal
|
||||
+ // Shiroha start - Lithium Optimizes move to block goal
|
||||
+ /**
|
||||
+ * Finds the nearest block matching the predicates.
|
||||
+ * <p>
|
||||
@@ -183,5 +183,97 @@ index c6e9b155c2341c13d569f28f54f0c1d2d7313676..7bd3c8a1c627cfd3e377a269c649c0c1
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Shiorha end - Lithium Optimizes move to block goal
|
||||
+ // Shiroha end - Lithium Optimizes move to block goal
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
index ff0f99d4b560a1c0721885b0eba5bd5ab2087bd7..90beeee7b74324f81690776546713b4f04887f75 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
@@ -25,6 +25,19 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
private final Mob removerMob;
|
||||
private int ticksSinceReachedGoal;
|
||||
private static final int WAIT_AFTER_BLOCK_FOUND = 20;
|
||||
+ // Shiroha start - Lithium Optimize remove block goal
|
||||
+ private static final java.util.function.BiPredicate<ChunkAccess, BlockPos.MutableBlockPos> IS_VALID_TARGET_ABOVE_BIPREDICATE =
|
||||
+ RemoveBlockGoal::lithium$isValidTargetAbove;
|
||||
+ //Split check condition in order to use maybeHas
|
||||
+ private boolean lithium$isValidTargetBlock(net.minecraft.world.level.block.state.BlockState blockState){
|
||||
+ return blockState.is(this.blockToRemove);
|
||||
+ }
|
||||
+
|
||||
+ private static boolean lithium$isValidTargetAbove(ChunkAccess chunkAccess, BlockPos.MutableBlockPos mutable) {
|
||||
+ return chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir()
|
||||
+ && chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir();
|
||||
+ }
|
||||
+ // Shiroha end - Lithium Optimize remove block goal
|
||||
|
||||
public RemoveBlockGoal(final Block blockToRemove, final PathfinderMob mob, final double speedModifier, final int verticalSearchRange) {
|
||||
super(mob, speedModifier, 24, verticalSearchRange);
|
||||
@@ -39,7 +52,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
} else if (this.nextStartTick > 0) {
|
||||
this.nextStartTick--;
|
||||
return false;
|
||||
- } else if (this.findNearestBlock()) {
|
||||
+ } else if (((net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.LithiumMoveToBlockGoal) this).lithium$findNearestBlock(this::lithium$isValidTargetBlock, IS_VALID_TARGET_ABOVE_BIPREDICATE, false)) { // Shiroha - Lithium Optimize remove block goal
|
||||
this.nextStartTick = reducedTickDelay(20);
|
||||
return true;
|
||||
} else {
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
|
||||
index 7022679c84e184999b416e06d1af2cc2500cb12b..ac8f4acc2aaee8ca9f7598d842ecf29f2ad73be3 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
|
||||
@@ -16,6 +16,14 @@ import net.minecraft.world.entity.monster.hoglin.Hoglin;
|
||||
import net.minecraft.world.entity.monster.piglin.Piglin;
|
||||
|
||||
public class HoglinSpecificSensor extends Sensor<Hoglin> {
|
||||
+ // Shiroha start - Lithium Optimizes Hoglin repellent search.
|
||||
+ private static final java.util.function.Predicate<net.minecraft.world.level.block.state.BlockState> IS_VALID_REPELLENT_PREDICATE =
|
||||
+ HoglinSpecificSensor::lithium$isValidRepellent;
|
||||
+
|
||||
+ private static boolean lithium$isValidRepellent(net.minecraft.world.level.block.state.BlockState blockState) {
|
||||
+ return blockState.is(BlockTags.HOGLIN_REPELLENTS);
|
||||
+ }
|
||||
+ // Shiroha end - Lithium Optimizes Hoglin repellent search.
|
||||
@Override
|
||||
public Set<MemoryModuleType<?>> requires() {
|
||||
return ImmutableSet.of(
|
||||
@@ -30,8 +38,8 @@ public class HoglinSpecificSensor extends Sensor<Hoglin> {
|
||||
|
||||
@Override
|
||||
protected void doTick(final ServerLevel level, final Hoglin body) {
|
||||
- Brain<?> brain = body.getBrain();
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, this.findNearestRepellent(level, body));
|
||||
+ Brain<?> brain = body.getBrain();;
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CommonBlockSearchesCheckAndCache.blockPosFindClosestMatch(level, body, 8, 4, IS_VALID_REPELLENT_PREDICATE, true)); // Shiroha - Lithium Optimizes Hoglin repellent search.
|
||||
Optional<Piglin> adultPiglin = Optional.empty();
|
||||
int adultPiglinCount = 0;
|
||||
List<Hoglin> adultHoglins = Lists.newArrayList();
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
|
||||
index 060a53da799a3036a343cc6f1d73e3e5ca4b7af9..7e5accce5a9183165e7604ca5e144e600b6f503d 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
|
||||
@@ -26,6 +26,15 @@ import net.minecraft.world.level.block.CampfireBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class PiglinSpecificSensor extends Sensor<LivingEntity> {
|
||||
+ // Shiroha start - Lithium Optimizes Piglin repellent search.
|
||||
+ private static final java.util.function.Predicate<BlockState> IS_VALID_REPELLENT_PREDICATE =
|
||||
+ PiglinSpecificSensor::lithium$isValidRepellent;
|
||||
+ private static boolean lithium$isValidRepellent(BlockState blockState){
|
||||
+ final boolean isPiglinRepellent = blockState.is(BlockTags.PIGLIN_REPELLENTS);
|
||||
+ return isPiglinRepellent && blockState.is(Blocks.SOUL_CAMPFIRE) ?
|
||||
+ CampfireBlock.isLitCampfire(blockState) : isPiglinRepellent;
|
||||
+ }
|
||||
+ // Shiroha end - Lithium Optimizes Piglin repellent search.
|
||||
@Override
|
||||
public Set<MemoryModuleType<?>> requires() {
|
||||
return ImmutableSet.of(
|
||||
@@ -47,7 +56,7 @@ public class PiglinSpecificSensor extends Sensor<LivingEntity> {
|
||||
@Override
|
||||
protected void doTick(final ServerLevel level, final LivingEntity body) {
|
||||
Brain<?> brain = body.getBrain();
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, findNearestRepellent(level, body));
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CommonBlockSearchesCheckAndCache.blockPosFindClosestMatch(level, body, 8, 4, IS_VALID_REPELLENT_PREDICATE, true)); // Shiroha - Lithium Optimizes Piglin repellent search.
|
||||
Optional<Mob> nemesis = Optional.empty();
|
||||
Optional<Hoglin> huntableHoglin = Optional.empty();
|
||||
Optional<Hoglin> babyHoglin = Optional.empty();
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Fri, 7 Aug 2026 15:05:38 +0800
|
||||
Subject: [PATCH] Lithium skip unnecessary secondary poi sensing
|
||||
|
||||
This is a part of lithium(https://github.com/CaffeineMC/lithium/blob/c42972b6e9d21c8ff45559df6b271802050a22e2/common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/sensor/secondary_poi/SecondaryPoiSensorMixin.java#L13)
|
||||
|
||||
Original license: https://github.com/CaffeineMC/lithium/blob/c42972b6e9d21c8ff45559df6b271802050a22e2/LICENSE.md
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
index 7d3e843c2d3c5e15b7bea7302d6118419d3a4957..4c7326b3d6504038f7b359e37156f82b55ec7ccc 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
@@ -22,6 +22,12 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
|
||||
|
||||
@Override
|
||||
protected void doTick(final ServerLevel level, final Villager body) {
|
||||
+ // Shiroha start - lithium skip unnecessary secondary poi sensing
|
||||
+ if (body.getVillagerData().profession().value().secondaryPoi().isEmpty()) {
|
||||
+ body.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Shiroha end - lithium skip unnecessary secondary poi sensing
|
||||
ResourceKey<Level> dimensionType = level.dimension();
|
||||
BlockPos center = body.blockPosition();
|
||||
List<GlobalPos> jobSites = Lists.newArrayList();
|
||||
@@ -0,0 +1,83 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sun, 16 Aug 2026 01:31:31 +0800
|
||||
Subject: [PATCH] Per region async profiler
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
index 724332d074bd7d3dfdcb60e83cf1fd6ce706000e..eb65077d18d86fce3ae1131445ebdcb736f5dc93 100644
|
||||
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
@@ -220,6 +220,7 @@ public final class TickRegionScheduler {
|
||||
*/
|
||||
public void scheduleRegion(final RegionScheduleHandle region) {
|
||||
region.scheduler = this;
|
||||
+ region.scheduleProfiler = TickRegions.getScheduleProfilerManager().register(region.id); // Shiroha - per region async profiler
|
||||
this.scheduler.schedule(region);
|
||||
}
|
||||
|
||||
@@ -230,6 +231,7 @@ public final class TickRegionScheduler {
|
||||
public void descheduleRegion(final RegionScheduleHandle region) {
|
||||
// To avoid acquiring any of the locks the scheduler may be using, we
|
||||
// simply cancel the next action.
|
||||
+ TickRegions.getScheduleProfilerManager().deRegister(region.id); region.scheduleProfiler = null; // Shiroha - per region async profiler
|
||||
region.markNonSchedulable();
|
||||
}
|
||||
|
||||
@@ -296,6 +298,7 @@ public final class TickRegionScheduler {
|
||||
}
|
||||
|
||||
public static abstract class RegionScheduleHandle extends SchedulableTick {
|
||||
+ public io.nanachiyo0721.shiroha.utils.profiling.RegionScheduleProfiler scheduleProfiler = null; // Shiroha - per region async profiler
|
||||
|
||||
protected long currentTick;
|
||||
protected long lastTickStart;
|
||||
@@ -391,6 +394,7 @@ public final class TickRegionScheduler {
|
||||
|
||||
final FoliaWatchdogThread.RunningTick runningTick = new FoliaWatchdogThread.RunningTick(tickStart, this, Thread.currentThread()); // Folia - watchdog
|
||||
WATCHDOG_THREAD.addTick(runningTick); // Folia - watchdog
|
||||
+ if (this.scheduleProfiler != null) this.scheduleProfiler.taskBegin(); // Shiroha - per region async profiler
|
||||
try {
|
||||
this.runRegionTasks(() -> {
|
||||
return !RegionScheduleHandle.this.cancelled.get() && canContinue.getAsBoolean();
|
||||
@@ -400,6 +404,7 @@ public final class TickRegionScheduler {
|
||||
// don't release region for another tick
|
||||
return false;
|
||||
} finally {
|
||||
+ if (this.scheduleProfiler != null) this.scheduleProfiler.taskEnd(); // Shiroha - per region async profiler
|
||||
WATCHDOG_THREAD.removeTick(runningTick); // Folia - watchdog
|
||||
final long tickEnd = System.nanoTime();
|
||||
final long cpuEnd = MEASURE_CPU_TIME ? THREAD_MX_BEAN.getCurrentThreadCpuTime() : 0L;
|
||||
@@ -476,6 +481,7 @@ public final class TickRegionScheduler {
|
||||
|
||||
final FoliaWatchdogThread.RunningTick runningTick = new FoliaWatchdogThread.RunningTick(tickStart, this, Thread.currentThread()); // Folia - region threading
|
||||
WATCHDOG_THREAD.addTick(runningTick); // Folia - region threading
|
||||
+ if (this.scheduleProfiler != null) this.scheduleProfiler.tickBegin(); // Shiroha - per region async profiler
|
||||
try {
|
||||
// next start isn't updated until the end of this tick
|
||||
this.tickRegion(tickCount, tickStart, scheduledEnd);
|
||||
@@ -489,6 +495,7 @@ public final class TickRegionScheduler {
|
||||
// regionFailed will schedule a shutdown, so we should avoid letting this region tick further
|
||||
return false;
|
||||
} finally {
|
||||
+ if (this.scheduleProfiler != null) this.scheduleProfiler.tickEnd(); // Shiroha - per region async profiler
|
||||
WATCHDOG_THREAD.removeTick(runningTick); // Folia - region threading
|
||||
final long tickEnd = System.nanoTime();
|
||||
final long cpuEnd = MEASURE_CPU_TIME ? THREAD_MX_BEAN.getCurrentThreadCpuTime() : 0L;
|
||||
diff --git a/io/papermc/paper/threadedregions/TickRegions.java b/io/papermc/paper/threadedregions/TickRegions.java
|
||||
index ca24971a1dc7576e6f216dfc0fe56d2e5195a14f..aacf39922a7e338351a7fe89956162ba736d2cc2 100644
|
||||
--- a/io/papermc/paper/threadedregions/TickRegions.java
|
||||
+++ b/io/papermc/paper/threadedregions/TickRegions.java
|
||||
@@ -36,10 +36,12 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
|
||||
private static boolean initialised;
|
||||
private static boolean started;
|
||||
private static TickRegionScheduler scheduler;
|
||||
+ private static final io.nanachiyo0721.shiroha.utils.profiling.RegionScheduleProfilerManager scheduleProfilerManager = new io.nanachiyo0721.shiroha.utils.profiling.RegionScheduleProfilerManager(); // Shiroha - per region async profiler
|
||||
|
||||
public static TickRegionScheduler getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
+ public static io.nanachiyo0721.shiroha.utils.profiling.RegionScheduleProfilerManager getScheduleProfilerManager() { return scheduleProfilerManager; } // Shiroha - per region async profiler
|
||||
|
||||
private static int getTickThreads(final GlobalConfiguration.ThreadedRegions config) {
|
||||
int tickThreads;
|
||||
+1
-1
@@ -5,7 +5,7 @@ Subject: [PATCH] Force disable reload command and api
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9d0dc8815842a0583b212891680bd0c6461c30b9..fc789b5a4376db133558e698c65daddd9d8a4bd9 100644
|
||||
index 3fac32b420ce4ae74166eac43d38c51c1fd513cf..2ddb8d343c58e9005058dd50bfc6490b14402bed 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -981,6 +981,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user