Compare commits

..

77 Commits

Author SHA1 Message Date
MrHua269
8673e02ca3 Fix rebranding 2025-05-17 15:55:53 +08:00
MrHua269
dc973293d6 Added some license information into patches 2025-05-17 15:55:53 +08:00
MrHua269
e2b129df71 Add getId to TickRegion api class 2025-05-17 15:55:53 +08:00
MrHua269
533a41b5c9 Make tickregion object bind with nms object 2025-05-17 15:55:53 +08:00
Helvetica Volubi
511b4fafd4 feat: add Config to fix string dupe in end platform (#62) 2025-05-17 15:55:53 +08:00
MrHua269
d5dfcfa253 Retidy patches 2025-05-17 15:55:53 +08:00
Helvetica Volubi
df72ac7a55 [ci skip]docs: update Contributing files 2025-05-17 15:55:53 +08:00
Helvetica Volubi
21440dbbce refactor: organize patches 2025-05-17 15:55:53 +08:00
Bacteriawa
a99b5fd8c6 Faster chunk serialization 2025-05-17 15:55:53 +08:00
Helvetica Volubi
649473678e refactor: organize patches 2025-05-17 15:55:53 +08:00
Helvetica Volubi
e79afe47dd fix: creative item fix
it fix Leaves#489[https://github.com/LeavesMC/Leaves/issues/489]
2025-05-17 15:55:53 +08:00
xiaoxijun
05795e53d7 neaten ci 2025-05-17 15:55:53 +08:00
Bacteriawa
730bc2ea62 Fix maven repo 2025-05-17 15:55:53 +08:00
Helvetica Volubi
8d4d923310 refactor: fix an error in speed-fix 2025-05-17 15:55:53 +08:00
Helvetica Volubi
9b42664025 refactor: use skip tick and compensate tick to fix some bugs 2025-05-17 15:55:53 +08:00
Helvetica Volubi
3d5fe06a3c [ci skip]note: fix up one note error 2025-05-17 15:55:53 +08:00
MrHua269
982e82de9e Tidy patches 2025-05-17 15:55:53 +08:00
Helvetica Volubi
53e4333bfc fix: rebuild Entity portal-teleport speed fix 2025-05-17 15:55:53 +08:00
Helvetica Volubi
e042d98762 ci: always use ncipollo/release-action@v1-latest to release 2025-05-17 15:55:53 +08:00
MrHua269
521c2b9cbd Run generateDevelopmentBundle 2025-05-17 15:55:53 +08:00
MrHua269
978e8a10ca Fix syntax error 2025-05-17 15:55:53 +08:00
MrHua269
7b2885fd8d Fix npe while running tasks without private mvn repo variables 2025-05-17 15:55:53 +08:00
MrHua269
3e0571fc52 Added private maven repo for some testing 2025-05-17 15:55:53 +08:00
MrHua269
9713a09905 Fix incorrectly synced data after player teleportation
Fixes:https://github.com/PaperMC/Folia/issues/357
2025-05-17 15:55:53 +08:00
Helvetica Volubi
9d2d3aff72 Add config to enable tick command (#94)
* feat: tick command support

* feat: use exp-config to enable tick command
2025-05-17 15:55:53 +08:00
MrHua269
80e438bf96 Tidy patches 2025-05-17 15:55:52 +08:00
Helvetica Volubi
45ce5b56bd MC-274911 Full revert & Cross Region Damage trace (#92)
* fix: Cross Region Damage trace

* fix: fix patch - revert raid

* refactor: pull code to rebuild patch

* note: rewrite raid-revert note

* feat: revert spawn position logic

[revert spawn position logic] reverted MC-274911, so old [MC-274911 revert] is removed, and config extended old revert_274911

* refactor: simplify code

* refactor: rewritten in thread-safe way

* fix: fix error print out

* refactor: rebuild patch

* refactor: remove import & fixup LOGGER print out

* refactor: move rebuild effect affect to Cross Region

* feat: use config to set if [Cross Region Damage Trace] is enabled
2025-05-17 15:55:52 +08:00
MrHua269
cf129162ef Tidy patches 2025-05-17 15:55:52 +08:00
Helvetica Volubi
a3b9c347f7 refactor: better log print 2025-05-17 15:55:52 +08:00
Helvetica Volubi
f9d700eca4 feat: origin print complete 2025-05-17 15:55:52 +08:00
Helvetica Volubi
760da7d7be bugfix: fix crash when execute setblock with an illegal nbt 2025-05-17 15:55:52 +08:00
MrHua269
af796c4b03 Tidy patches 2025-05-17 15:55:52 +08:00
Helvetica Volubi
1c27c1ce38 EndGateway Portal Passengers Fix (#90)
* feat: EndGateway Portal Passengers Fix

* refactor: delete some debug information

* refactor: merge patches to [Portal behavior modifiers]

* refactor: rebuild patch
2025-05-17 15:55:52 +08:00
MrHua269
7f297a4d20 Fix off tickregion sync teleport & tidy patches
Fixes: https://github.com/PaperMC/Folia/issues/329
2025-05-17 15:55:52 +08:00
Helvetica Volubi
923233be6f patch: fixup a patch's name 2025-05-17 15:55:52 +08:00
Helvetica Volubi
5d90f68192 note: fixup note 2025-05-17 15:55:52 +08:00
Helvetica Volubi
f835ecf227 feat: add flag to process async failed 2025-05-17 15:55:52 +08:00
Helvetica Volubi
9cb931e691 fix: Entity portal-teleport speed fix 2025-05-17 15:55:52 +08:00
Helvetica Volubi
e7b3a713b1 fixup note 2025-05-17 15:55:52 +08:00
Helvetica Volubi
ae32e89dbb ci: update build_1.21.4.yml
fix an error in a file name
2025-05-17 15:55:52 +08:00
Helvetica Volubi
5af12cd66f feat: add afterPortalLogic to process some logics 2025-05-17 15:55:52 +08:00
Helvetica Volubi
8611086dfc fix: TNT Nether Portal break portal fix 2025-05-17 15:55:52 +08:00
Helvetica Volubi
da39a79d17 remove: move 0044 to todo list 2025-05-17 15:55:52 +08:00
Helvetica Volubi
acd1ce5ded Leaves Fix SculkCatalyst exp skip (Leaves#471) 2025-05-17 15:55:52 +08:00
Helvetica Volubi
efb26e7554 note: use Correct player respawn place as tag 2025-05-17 15:55:52 +08:00
Helvetica Volubi
519f46ab01 fix: Player respawn in correct place 2025-05-17 15:55:52 +08:00
Bacteriawa
1f86bd0656 Add Lithium: fast util & Lithium: Skip unnecessary calculations if player is not flying or swing 2025-05-17 15:55:52 +08:00
Helvetica Volubi
97c2703fb4 remove: remove 0024 2025-05-17 15:55:52 +08:00
Helvetica Volubi
bbb0933042 Prefer Leaves#455 to luminol (#77)
* feat: prefer Leaves#452 to luminol

* feat: rename Files

* rename: fixup a file name
2025-05-17 15:55:52 +08:00
Bacteriawa
177bb8eed2 Updated Upstream (Folia) 2025-05-17 15:55:52 +08:00
Helvetica Volubi
cce7e23ae1 feat: rewrite MC-274911 revert (tick-mode) 2025-05-17 15:55:52 +08:00
Helvetica Volubi
ac008463d3 feat: try revert MC-274911 2025-05-17 15:55:52 +08:00
Helvetica Volubi
0b48acc022 tip: add a tip in new feat 2025-05-17 15:55:52 +08:00
Helvetica Volubi
fa59901792 feat: disable raid self check config
--Function from leaves
2025-05-17 15:55:52 +08:00
Helvetica Volubi
ec7f6d1e23 description: fix up description 2025-05-17 15:55:52 +08:00
Helvetica Volubi
db56fca556 feat: prefer #75 to hardfork-ver 2025-05-17 15:55:52 +08:00
MrHua269
0a1e7a509f Fully removed player teleport event and entity teleport event call & Rebase patches 2025-05-17 15:55:51 +08:00
MrHua269
6e7d7f9aad Add: Leaf Smart sort entities in NearestLivingEntitySensor 2025-05-17 15:55:51 +08:00
Helvetica Volubi
ef810b9f95 fix: fix up number 2025-05-17 15:55:51 +08:00
Helvetica Volubi
7c1818ed78 del: delete patch 0022(MrHua269) 2025-05-17 15:55:51 +08:00
Helvetica Volubi
692d40a89c feat: selected raid update 2025-05-17 15:55:51 +08:00
Bacteriawa
c0d4f434ce Updated Upstream (Folia) 2025-05-17 15:55:51 +08:00
ShintoKosei
c4d87f3d90 [ci skip] Enable dependabot 2025-05-17 15:55:51 +08:00
Dreeam
54fbeb2e5e [ci skip] Only release paperclip jar 2025-05-17 15:55:51 +08:00
MrHua269
a81e970785 Revert RegionizedTaskQueue referent counter changes 2025-05-17 15:55:51 +08:00
Kercute
1a8c988db1 Add force the data command to be enabled config 2025-05-17 15:55:51 +08:00
Creeam
6673fb02fd [ci skip] Update CONTRIBUTING_EN.md 2025-05-17 15:55:51 +08:00
Creeam
7bfb5ac414 [ci skip] Update EN contributing guide 2025-05-17 15:55:51 +08:00
Helvetica Volubi
b4acb43e85 [ci skip] Update CONTRIBUTING guide (#57)
* misc: fixup count of patch

* ci: update ncipollo/release-action to 1.16.0

* docs: update CONTRIBUTING.md

* docs: update CONTRIBUTING files

* docs: update CONTRIBUTING files

* Update CONTRIBUTING.md

* docs: sync zh_cn's update to en

* docs: correct grammar errors

* docs: fixup jdk version to 21

---------

Co-authored-by: xiaoxijun <A3167717663@hotmail.com>
2025-05-17 15:55:51 +08:00
Suisuroru
65516ac3c3 feat(config): optimize configuration description of raid config 2025-05-17 15:55:51 +08:00
Suisuroru
12b5752c2d feat: Merge Revert-raid-changes of Leaves to Luminol 2025-05-17 15:55:51 +08:00
HaHaWTH
cbf59b889c Updated Upstream (Folia) 2025-05-17 15:55:51 +08:00
MrHua269
58e9f3fd5f Do not search the block out of current region & Ported some micro optimizations from Leaf
Probably fixes(Do not search the block out of current region): https://github.com/PaperMC/Folia/issues/343
2025-05-17 15:55:50 +08:00
Kercute
d0d4292649 0019-Skip-collision-check-if-the-block-is-not-belong-to-c.patch 2025-05-17 15:55:29 +08:00
Kercute
3d6cc305cd Updated Upstream (Folia) 2025-05-17 15:55:29 +08:00
MrHua269
e5005425f7 [ci skip] Use --global flag to configure git 2025-05-17 15:55:29 +08:00
MrHua269
35cd2efa8e Add experiment config for entity to clean memory value which is not belong to current tickregion & Fix a series issue around entity memory typed GlobalPos
Probably fixes: https://github.com/PaperMC/Folia/issues/203
2025-05-17 15:55:28 +08:00
108 changed files with 2311 additions and 1029 deletions

12
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
# Enable version updates for github actions
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

View File

@@ -1,10 +1,10 @@
name: Luminol CI - dev/per-virtual-thread-tickregion
name: Luminol CI - dev/1.21.4-hardfork
on:
push:
branches: [ "dev/per-virtual-thread-tickregion" ]
branches: [ "dev/1.21.4-hardfork" ]
pull_request:
branches: [ "dev/per-virtual-thread-tickregion" ]
branches: [ "dev/1.21.4-hardfork" ]
permissions: write-all
@@ -15,48 +15,54 @@ jobs:
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '22'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Configure Git User Details
run: git config --global user.email "ci@luminolmc.com" && git config --global user.name "LuminolMC CI"
- name: Apply Patches
run: ./gradlew applyAllPatches
- name: CreateJar
run: ./gradlew createMojmapPaperclipJar
- name: Publish to repo
if: github.event_name != 'pull_request'
continue-on-error: true
run: |
export MAVEN_REPO_USER=${{ secrets.MAVEN_REPO_USER }}
export MAVEN_REPO_PASSWORD=${{ secrets.MAVEN_REPO_PASSWORD }}
./gradlew publish -PpublishDevBundle=true
./gradlew generateDevelopmentBundle publish -PpublishDevBundle=true
env:
PRIVATE_MAVEN_REPO_PASSWORD: ${{ secrets.PRIVATE_MAVEN_REPO_PASSWORD }}
PRIVATE_MAVEN_REPO_USERNAME: ${{ secrets.PRIVATE_MAVEN_REPO_USERNAME }}
- name: Upload Artifact
uses: "actions/upload-artifact@v4"
uses: actions/upload-artifact@v4
with:
name: "${{ env.project_id_b }} CI Artifacts"
path: "luminol-server/build/libs/*-paperclip-*-mojmap.jar"
- name: SetENV
if: github.event_name != 'pull_request'
run: sh scripts/SetENV.sh
- name: Create Release
if: github.event_name != 'pull_request'
uses: ncipollo/release-action@v1.16.0
uses: ncipollo/release-action@v1
with:
tag: ${{ env.tag }}
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}
body: |
> [!CAUTION]
> 🚨You are trying to download experimental builds!
> **<u>DO NOT</u>** use these builds in production, as there may be many bugs and corruption issues.
> Please report any and all issues you encounter!
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [![download](https://img.shields.io/github/downloads/LuminolMC/${{ env.project_id }}/${{ env.tag }}/total?color=red&style=flat-square)](https://github.com/LuminolMC/${{ env.project_id }}/download/${{ env.tag }}/${{ env.jar }})
This release is automatically compiled by GitHub Actions
### Commit Message

View File

@@ -33,7 +33,7 @@
```kotlin
repositories {
maven {
url = "https://maven.moliatopia.icu/repository/maven-snapshots/"
url = "https://repo.menthamc.com/repository/maven-public/"
}
}
@@ -47,8 +47,8 @@ dependencies {
```xml
<repositories>
<repository>
<id>moliatopia</id>
<url>https://maven.moliatopia.icu/repository/maven-snapshots/</url>
<id>menthamc</id>
<url>https://repo.menthamc.com/repository/maven-public/</url>
</repository>
</repositories>
@@ -71,7 +71,7 @@ dependencies {
当您遇到任何问题时,请向我们提问,我们将尽力解决,但请记得清楚地描述您的问题并提供足够的日志等信息。
## 贡献代码
[查看 Contributing](./docs/CONTRIBUTING.md)
可查看 [Contributing](./docs/CONTRIBUTING.md)
## BStats
![bStats](https://bstats.org/signatures/server-implementation/Luminol.svg "bStats")

View File

@@ -34,7 +34,7 @@ For gradle:
```kotlin
repositories {
maven {
url = "https://maven.moliatopia.icu/repository/maven-snapshots/"
url = "https://repo.menthamc.com/repository/maven-public/"
}
}
@@ -48,8 +48,8 @@ For maven
```xml
<repositories>
<repository>
<id>moliatopia</id>
<url>https://maven.moliatopia.icu/repository/maven-snapshots/</url>
<id>menthamc</id>
<url>https://repo.menthamc.com/repository/maven-public/</url>
</repository>
</repositories>

View File

@@ -81,12 +81,22 @@ subprojects {
extensions.configure<PublishingExtension> {
repositories {
/*
maven("https://repo.papermc.io/repository/maven-snapshots/") {
name = "paperSnapshots"
credentials(PasswordCredentials::class)
maven("https://repo.menthamc.com/repository/maven-snapshots/") {
name = "MenthaMC"
credentials(PasswordCredentials::class) {
username = System.getenv("PRIVATE_MAVEN_REPO_USERNAME")
password = System.getenv("PRIVATE_MAVEN_REPO_PASSWORD")
}
}
}
}
tasks.withType<Javadoc> {
options {
(this as StandardJavadocDocletOptions).apply {
addStringOption("-add-modules", "jdk.incubator.vector")
addStringOption("Xdoclint:none", "-quiet")
}
*/
}
}
}

View File

@@ -27,7 +27,7 @@
Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的修改分成了两个目录:
- `luminol-api` - 对 `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit` 进行的修改。
- `luminol-api` - 对 `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit-API` 进行的修改。
- `luminol-server` - 对 Minecraft 标准服务器原有逻辑进行的修改。
补丁系统是基于 git 的,你可以在这里了解 git 的基本内容: <https://git-scm.com/docs/gittutorial>
@@ -36,9 +36,21 @@ Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的
1. 将你的仓库 clone 到本地;
2. 在你的 IDE 或 终端 内执行 Gradle 的 `applyAllPatches` 任务,如果是在终端内,你可以执行 `./gradlew applyAllPatches`
3. 进入 仓库根目录下的 `luminol-api``luminol-server` 文件夹进行修改。
3. 在执行操作后,仓库根目录下应该存在以下目录对: `luminol-api``luminol-server` `folia-api``folia-server` 以及 `paper-api``paper-server`(下文称作 `*-api``*-server`
4. 进入 仓库根目录下的 `*-api``*-server` 文件夹进行修改。
顺便一提,仓库根目录下的 `luminol-api``luminol-server` 并不是正常的 git 仓库
以下为对上述各个文件夹的简单描述,详细描述可以参考[这里](https://github.com/Toffikk/paperweight-examples/blob/18241979c88068d5b061d95ad69c98ecb201c246/README.md)
1. API部分
- `luminol-api` :暂无有效文件
- `folia-api` 对folia-API的修改应当在此文件夹下进行
- `paper-api` 对paper-API/spigot-API/bukkit-API的修改应该在此文件夹下进行
2. Server部分
- `luminol-server` 对Minecraft原版服务器的修改应当在此文件夹下进行
- `folia-server` :暂无有效文件
- `paper-server` :对于非原版的对服务器逻辑的修改应当在此文件夹下进行
顺便一提,仓库根目录下的 `*-api``*-server` 并不是正常的 git 仓库:
- 在应用补丁前,基点将会指向未被更改的源码
- 在基点后的每一个提交都是一个补丁
@@ -48,11 +60,11 @@ Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的
按照以下步骤增加一个补丁是非常简单的:
1.`luminol-api``luminol-server` 进行修改;
1.`*-api``*-server` 进行修改;
2. 使用 git 添加你的修改,比如 `git add .`(不要提交新建的文件的修改);
3. 使用 `git commit -m <提交信息>` 进行提交;
4. 运行 Gradle 任务 `rebuildAllServerPatches` 将你的提交转化为一个补丁
5. 运行 Gradle 任务 `fixupPaperApiFilePatches` 生成新建文件的补丁文件(注意不要提交)
4. 运行 Gradle 任务 `fixupPaperApiFilePatches` 生成新建文件的补丁文件(注意不要提交)
5. 运行 Gradle 任务 `rebuildAllServerPatches` 将你的提交转化为一个补丁
6. 将你生成的补丁文件进行推送。
这样做以后,你就可以将你的补丁文件进行 PR 提交。
@@ -65,6 +77,6 @@ Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的
2. 使用 `git commit -a --fixup <hash>` 来进行一个更正提交不要提交对在luminol新建文件的修改
- 如果你想要更改提交信息,你也可以用 `--squash` 来代替 `--fixup`
3. 使用 `git rebase -i --autosquash base` 来进行自动变基,你只需要输入 `:q` 来关闭确认页面即可;
4. 运行 Gradle 任务 `rebuildAllServerPatches` 来修改已被修改的补丁
5. 运行 Gradle 任务 `fixupPaperApiFilePatches` 来修改已被修改的在luminol新建文件的补丁注意不要提交
4. 运行 Gradle 任务 `fixupPaperApiFilePatches` 来修改已被修改的在luminol新建文件的补丁注意不要提交
5. 运行 Gradle 任务 `rebuildAllServerPatches` 来修改已被修改的补丁
6. 将修改后的补丁 PR 发回储存库。

View File

@@ -30,8 +30,8 @@ Before coding, you need these pieces of software / tools as Dev Environment.
Luminol uses as the same patching system as Paper,
and has been divided into two directories for the purpose of modifying different parts of it:
- `luminol-api` - Modifications to `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit`.
- `luminol-server` - Modifications to Minecraft Official Server's source logic.
- `luminol-api` - Modifications to `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit-API`.
- `luminol-server` - Modifications to Minecraft Vanilla Server's source logic.
The patching system is based on git, and you can learn about it at here: <https://git-scm.com/docs/gittutorial>
@@ -39,9 +39,22 @@ If you have forked the main repository, then you should follow the steps below:
1. Clone your repository to local
2. Run Gradle's `applyAllPatches` task in your IDE or terminal (You can run `./gradlew applyAllPatches` directly in terminal.)
3. Enter `luminol-api` and `luminol-server` directory to carry out modifications.
3. After performing the operation, the following directory pairs should exist in the root directory of the warehouse: `luminol-api` and `luminol-server` , `folia-api` and `folia-server` , `paper-api` and `paper-server` (Referred to `*-api` and `*-server` as below)
4. Enter `*-api` and `*-server` directory to carry out modifications.
BTW, `luminol-api` and `luminol-server` and are not normal git repositories.
The following is the simple description of the aforementioned folders, detailed description can be referred to [here](https://github.com/Toffikk/paperweight-examples/blob/18241979c88068d5b061d95ad69c98ecb201c246/README.md):
1. API part
- `luminol-api` : There is no valid file
- `folia-api` : Modifications to Folia API should be carried out in this folder
- `paper-api` : Modifications to Paper API/Spigot API/Bukkit API should be carried out in this folder
2. Server part
- `luminol-server` : Modifications to Minecraft Vanilla Server's source logic should be carried out in this folder
- `folia-server` : There is no valid file
- `paper-server` : Modifications to non-vanilla server logic should be carried out in this folder
BTW, `*-api` and `*-server` and are not normal git repositories.
- Before applying patches, the base will point to unmodified source code.
- Every commit after the base is a patch.
@@ -51,11 +64,11 @@ BTW, `luminol-api` and `luminol-server` and are not normal git repositories.
It's very easy to add patches by following the steps below:
1. Modify the code of `luminol-api` and `luminol-server`
1. Modify the code of `*-api` and `*-server`
2. Add these changes to the local git repository (For example, `git add .`)
3. Commit these changes using `git commit -m <Commit Message>` (PS: do not commit new-created files)
4. Run Gradle's task `rebuildAllServerPatches` to convert your commits to a new patch
5. Run Gradle's task `fixupPaperApiFilePatches` to generate newly created files to new patches (PS: do not commit again before you run this task)
4. Run Gradle's task `fixupPaperApiFilePatches` to generate newly created files to new patches (PS: do not commit again before you run this task)
5. Run Gradle's task `rebuildAllServerPatches` to convert your commits to a new patch
6. Push your patches to your repository
After pushing, you can open a PR to submit your patches.
@@ -66,8 +79,8 @@ You can modify an existing patch by following the steps below:
1. Modify code at HEAD
2. Run `git commit -a --fixup <hash>` in your terminal to make a fix-up commit (PS: do not commit changes of luminol-created files)
- If you want to edit the commit message, replace `--fixup` with `--squash`.
- If you want to edit the commit message, replace `--fixup` with `--squash`
3. Run `git rebase -i --autosquash base` to rebase automatically, then just type `:q` to close the confirm page
4. Run Gradle's task `rebuildAllServerPatches` to modify existing patches
5. Run Gradle's task `fixupPaperApiFilePatches` to regenerate luminol-created files to patches (PS: do not commit again before you run this task)
4. Run Gradle's task `fixupPaperApiFilePatches` to regenerate luminol-created files to patches (PS: do not commit again before you run this task)
5. Run Gradle's task `rebuildAllServerPatches` to modify existing patches
6. Push and PR again

View File

@@ -2,7 +2,7 @@ group = me.earthme.luminol
version=1.21.4-R0.1-SNAPSHOT
mcVersion=1.21.4
foliaRef=80ab57dcbe5fa96cc2f7fe34ecba94162d8dd5e9
foliaRef=cd49d650b27aa329358593a84ef77444538ef014
org.gradle.configuration-cache=true
org.gradle.caching=true

View File

@@ -5,15 +5,19 @@ Subject: [PATCH] Rebrand to Luminol
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
index 652ff54e7c50412503725d628bfe72ed03059790..ee163b9fa8f441aa4b3e2309f33e8f932dfc02d7 100644
index 652ff54e7c50412503725d628bfe72ed03059790..db5e2f10278c20286779362cfdfadb2f42c724e0 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
@@ -19,6 +19,13 @@ public interface ServerBuildInfo {
@@ -19,6 +19,17 @@ public interface ServerBuildInfo {
*/
Key BRAND_PAPER_ID = Key.key("papermc", "paper");
+ // Luminol start
+ /**
+ * The brand id for folia
+ */
+ Key BRAND_FOLIA_ID = Key.key("papermc", "folia");
+ /**
+ * The brand id for Luminol.
+ */
+ Key BRAND_LUMINOL_ID = Key.key("luminolmc", "luminol");

View File

@@ -37,10 +37,10 @@ index 0000000000000000000000000000000000000000..96147cace1550d14c682258dab039758
+}
diff --git a/src/main/java/me/earthme/luminol/api/ThreadedRegion.java b/src/main/java/me/earthme/luminol/api/ThreadedRegion.java
new file mode 100644
index 0000000000000000000000000000000000000000..38972ac3d05ccbbb134f751a8d018b9c53ad10b5
index 0000000000000000000000000000000000000000..01dac0602b5f66f80c0adfbb779666fe0325a24f
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/api/ThreadedRegion.java
@@ -0,0 +1,50 @@
@@ -0,0 +1,56 @@
+package me.earthme.luminol.api;
+
+import org.bukkit.Location;
@@ -90,6 +90,12 @@ index 0000000000000000000000000000000000000000..38972ac3d05ccbbb134f751a8d018b9c
+ */
+ @Nullable
+ World getWorld();
+
+ /**
+ * Get the id of the tick region</br>
+ * @return The id of the tick region
+ */
+ long getId();
+}
diff --git a/src/main/java/me/earthme/luminol/api/ThreadedRegionizer.java b/src/main/java/me/earthme/luminol/api/ThreadedRegionizer.java
new file mode 100644
@@ -186,10 +192,10 @@ index 0000000000000000000000000000000000000000..ecde4462b08d701b8bff9f26902f1775
+ RegionStats getRegionStats();
+}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 015d852d5a0c01042a2153a6916d408660356c59..c7b6f3f6c42746297816c0650571990f565d5e68 100644
index bff01411f4b2d3ecd9e6d807c3f450d72c108323..1d74f4814d5c87d6cd1320634e5610cac16d32c5 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4432,4 +4432,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4437,4 +4437,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
}
}
}

View File

@@ -0,0 +1,59 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:47 +0800
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c10408e6e 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -25,17 +25,25 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
private float deathSoundVolume;
private float deathSoundPitch;
// Paper end
+ private int rewardExp; // Leaves - exp fix
public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops) {
this(entity, damageSource, drops, 0);
}
public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp) {
+ // Leaves start - exp fix
+ this(what, damageSource, drops, droppedExp, droppedExp);
+ }
+
+ public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int rewardExp) {
super(what);
this.damageSource = damageSource;
this.drops = drops;
this.dropExp = droppedExp;
+ this.rewardExp = rewardExp;
}
+ // Leaves end - exp fix
@NotNull
@Override
@@ -75,6 +83,7 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
*/
public void setDroppedExp(int exp) {
this.dropExp = exp;
+ this.rewardExp = exp; // Leaves - exp fix
}
/**
@@ -226,4 +235,14 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
this.deathSoundPitch = pitch;
}
// Paper end
+
+ // Leaves start - exp fix
+ public int getRewardExp() {
+ return rewardExp;
+ }
+
+ public void setRewardExp(int rewardExp) {
+ this.rewardExp = rewardExp;
+ }
+ // Leaves end - exp fix
}

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:47 +0800
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.patch)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index ab7584873e46020148bceecbd42a43055684e6a0..f33ab20313310a113d6c88e0fc1fe1666218061e 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -18,6 +18,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private boolean keepLevel = false;
private boolean keepInventory = false;
private boolean doExpDrop; // Paper - shouldDropExperience API
+ private boolean useApiExpDropStatus = false; // Leaves - exp fix
// Paper start - adventure
@org.jetbrains.annotations.ApiStatus.Internal
public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
@@ -122,9 +123,16 @@ public class PlayerDeathEvent extends EntityDeathEvent {
*/
public void setShouldDropExperience(boolean doExpDrop) {
this.doExpDrop = doExpDrop;
+ this.useApiExpDropStatus = true; // Leaves - exp fix
}
// Paper end - shouldDropExperience API
+ // Leaves start - exp fix
+ public boolean forceUseEventDropStatus() {
+ return this.useApiExpDropStatus;
+ }
+ // Leaves end - exp fix
+
@NotNull
@Override
public Player getEntity() {

View File

@@ -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 be82a6b43b1f0c644c53d08a6e16bc2876c8c1e0..9261d83f28af5e057d060741ab900f8cde8f992b 100644
index faf72dd6dff74296c73cb058aaabd1f9f475a072..46375fa81b36b89b79c22f0a7ac6d610ab1183d4 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1968,7 +1968,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1967,7 +1967,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {

View File

@@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 22 Mar 2025 17:36:17 +0800
Subject: [PATCH] Luminol config base
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 9aa664537cc37e44db46d5a2a64ae3116938c681..8d6a6534a134e99e5ee2652d7b0c858d538e69bd 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -108,6 +108,7 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
+ me.earthme.luminol.config.LuminolConfig.preLoadConfig(); // Luminol - Luminol config
io.papermc.paper.plugin.PluginInitializerManager.load(optionSet); // Paper
Bootstrap.bootStrap();
Bootstrap.validate();
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index e3b7184e20bda4983ee1fc5463d91ca0cdd8ec1f..375f4a59333ee1d75fb1acb8c2cbada7866bd48e 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -212,6 +212,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration
+ me.earthme.luminol.config.LuminolConfig.finalizeLoadConfig(); //Luminol - load config file
+ me.earthme.luminol.config.LuminolConfig.setupLatch(); //Luminol - load config file
this.server.spark.enableEarlyIfRequested(); // Paper - spark
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
if (this.convertOldUsers()) {

View File

@@ -17,10 +17,10 @@ index 8d67b4629c69d3039b199aaad45533d1acde114e..f7bfeca4b11b9860241d5eb80b6df420
((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickServerLevel)(ServerLevel)chunk.getLevel()).moonrise$removeChunkForPlayerTicking(chunk); // Moonrise - chunk tick iteration
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 9261d83f28af5e057d060741ab900f8cde8f992b..fc088edaa36e7e68ddd23c57e351ef3b31ed5ad8 100644
index 46375fa81b36b89b79c22f0a7ac6d610ab1183d4..f2124edb487b1d5f6bdc7fa086814f870724363a 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1666,7 +1666,44 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1665,7 +1665,44 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia end - region threading
//this.tickCount++; // Folia - region threading
//this.tickRateManager.tick(); // Folia - region threading
@@ -118,7 +118,7 @@ index f2d2ddfd964bff914e41c0b4150fe1aad7866ebf..7defcd15c44601bfd2f7f55046038693
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index dbf9231b1f01576906b90a3ddf0bf2cbbeb4590a..b17ace9118c94a756fa2901621c6b2b9bd9e5764 100644
index 42987d278bf4abbad9d63485a1050f4abc3e7367..3bc0fc1d411d3c5e206695510ec9288ffbf8c277 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -400,7 +400,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable entity tick catchers
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 78f4dd7032d18b8e020a4576e4ac012c1d472e67..120e25ca0544980d1bfc1498e1386f965dae7044 100644
index dafd90502937019b616ac0a79465e1dbc578cf66..96daa716aa06de31b2867f09833ac8e77b6314c4 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -1547,6 +1547,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Sun, 12 Jan 2025 10:36:31 +0800
Subject: [PATCH] Add experiment config for command block command execution
Subject: [PATCH] Add config for command block command execution
diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Sun, 12 Jan 2025 10:39:35 +0800
Subject: [PATCH] Add fix for off region adult following ai behavior
diff --git a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..751f3dde8e6bc2c0365e8672f5079af0379a69de 100644
--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
@@ -25,6 +25,14 @@ public class BabyFollowAdult {
return false;
} else {
LivingEntity ageableMob = instance.get(nearestVisibleAdult); // CraftBukkit - type
+
+ // Luminol start - Fix off world entity following which caused async issue
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ageableMob)) {
+ nearestVisibleAdult.erase();
+ return true;
+ }
+ // Luminol end
+
if (mob.closerThan(ageableMob, followRange.getMaxValue() + 1) && !mob.closerThan(ageableMob, followRange.getMinValue())) {
// CraftBukkit start
org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(mob, ageableMob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER);

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Mon, 24 Feb 2025 06:00:00 -0800
Subject: [PATCH] Add config for tripwire dupe
diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java
index 9aace993c6c18f1a50610e4766225485984b8167..07ffe289b9556b45a9ef7db5357d85b14fe23feb 100644
--- a/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -215,7 +215,7 @@ public class TripWireHookBlock extends Block {
BlockState blockState2 = blockStates[i2];
if (blockState2 != null) {
BlockState blockState3 = level.getBlockState(blockPos1);
- if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) {
+ if (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled || blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) {
if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating
}
}

View File

@@ -55,7 +55,7 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..c7d4d944eb198ac53a3eeae717a25c7d
+ public void moonrise$write(final abomination.IRegionFile regionFile) throws IOException; // Luminol - Configurable region file format
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index fc088edaa36e7e68ddd23c57e351ef3b31ed5ad8..5d709b3b47702e7607dafa4a38380c801b228e2d 100644
index f2124edb487b1d5f6bdc7fa086814f870724363a..ed00a29daccfee1d631bef27c0a3a4ae83140018 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -986,10 +986,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@@ -1,12 +1,13 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 8 Mar 2025 09:56:15 +0800
Subject: [PATCH] Add experiment config for entity to clean memory value which
is not belong to current tickregion
Subject: [PATCH] Add config for entity to clean memory value which is not
belong to current tickregion
Folia does not fully get the entity AI patched correctly, like some memories in entity's brain is still exists when switched dimension or teleported to the new tickregion, which entity is still accessing in the next tick then it will trigger the async catcher, which lead the entity go disappear and throw an exception in the console.In this patch, if this function is turned on, the server will clean the memory that doesn't belong to the entity's tickregion before ticking any behaviors, which can simply fix that.
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..d61fba01feecce3610cd390f490d3097c5db19c4 100644
index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..52b08be8b37117edc38dddf6d1919178b1f86271 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -399,7 +399,7 @@ public class Brain<E extends LivingEntity> {
@@ -32,7 +33,7 @@ index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..d61fba01feecce3610cd390f490d3097
+ final net.minecraft.world.level.Level ownerLevel = owner.level();
+
+ // type: entity
+ if (me.earthme.luminol.config.modules.experiment.ForceCleanupEntityBrainMemoryConfig.enabledForEntity && value instanceof LivingEntity entity) {
+ if (me.earthme.luminol.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enabledForEntity && value instanceof LivingEntity entity) {
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
+ this.eraseMemory(entry.getKey());
+ continue;
@@ -40,7 +41,7 @@ index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..d61fba01feecce3610cd390f490d3097
+ }
+
+ // type: block_pos
+ if (me.earthme.luminol.config.modules.experiment.ForceCleanupEntityBrainMemoryConfig.enabledForBlockPos && value instanceof net.minecraft.core.BlockPos blockPos) {
+ if (me.earthme.luminol.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enabledForBlockPos && value instanceof net.minecraft.core.BlockPos blockPos) {
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ownerLevel, blockPos)) {
+ this.eraseMemory(entry.getKey());
+ continue;

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kercute <A3167717663@hotmail.com>
Date: Sun, 16 Mar 2025 23:31:41 +0800
Subject: [PATCH] Add experiment config for force enabling data command
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

View File

@@ -0,0 +1,79 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Mon, 24 Feb 2025 06:00:00 -0800
Subject: [PATCH] Add config for tripwire dupe
diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java
index 9aace993c6c18f1a50610e4766225485984b8167..07ffe289b9556b45a9ef7db5357d85b14fe23feb 100644
--- a/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -215,7 +215,7 @@ public class TripWireHookBlock extends Block {
BlockState blockState2 = blockStates[i2];
if (blockState2 != null) {
BlockState blockState3 = level.getBlockState(blockPos1);
- if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) {
+ if (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled || blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) {
if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating
}
}
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
index f96fc1391167dea48cac1caa464b9026657df89a..c7a46407f4f0915161f26e87241a806bd38145b1 100644
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
@@ -27,6 +27,9 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
// CraftBukkit end
BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
+ // Luminol start - prevent tripwire dupe in end platform generate
+ java.util.List<BlockPos> blockList1 = new java.util.ArrayList<>();
+ java.util.List<BlockPos> blockList2 = new java.util.ArrayList<>();
for (int i = -2; i <= 2; i++) {
for (int i1 = -2; i1 <= 2; i1++) {
for (int i2 = -1; i2 < 3; i2++) {
@@ -34,7 +37,23 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
Block block = i2 == -1 ? Blocks.OBSIDIAN : Blocks.AIR;
// CraftBukkit start
if (!blockList.getBlockState(blockPos).is(block)) {
- if (dropBlocks) {
+ boolean flag = false;
+ if (dropBlocks && me.earthme.luminol.config.modules.misc.AllowTripwireDupe.preventPlatformBreakString) {
+ net.minecraft.world.level.block.state.BlockState state = level.getBlockState(blockPos);
+ if (state.is(Blocks.TRIPWIRE)) {
+ if (state.getValue(net.minecraft.world.level.block.TripWireBlock.DISARMED)) {
+ flag = true;
+ blockList2.add(blockPos.immutable());
+ }
+ if (!flag) {
+ flag = checkString(blockList2, blockPos);
+ }
+ }
+ }
+ if (flag) {
+ blockList1.add(blockPos.immutable());
+ } else if (dropBlocks) {
+ // Luminol end - prevent tripwire dupe in end platform generate
blockList.destroyBlock(blockPos, true, null);
}
@@ -56,9 +75,19 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
// SPIGOT-7856: End platform not dropping items after replacing blocks
if (dropBlocks) {
- blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null));
+ blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null)); // Luminol - prevent tripwire dupe in end platform generate
}
blockList.updateList();
// CraftBukkit end
}
+
+ // Luminol start - prevent tripwire dupe in end platform generate
+ private static boolean checkString(java.util.List<BlockPos> blockList, BlockPos blockPos) {
+ for (BlockPos pos : blockList) {
+ if (pos.getY() != blockPos.getY()) continue;
+ if (pos.getX() == blockPos.getX() || pos.getZ() == blockPos.getZ()) return true;
+ }
+ return false;
+ }
+ // Luminol end - prevent tripwire dupe in end platform generate
}

View File

@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sun, 13 Apr 2025 11:07:04 +0800
Subject: [PATCH] Add config to disable heightmap warning
diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java
index 3b27bcfbbe0529d1526adc30760c846b4011645f..95747ae41cea0d4b577c58ef44959a18e0a46672 100644
--- a/net/minecraft/world/level/levelgen/Heightmap.java
+++ b/net/minecraft/world/level/levelgen/Heightmap.java
@@ -123,7 +123,8 @@ public class Heightmap {
if (raw.length == data.length) {
System.arraycopy(data, 0, raw, 0, data.length);
} else {
- LOGGER.warn("Ignoring heightmap data for chunk " + chunk.getPos() + ", size does not match; expected: " + raw.length + ", got: " + data.length);
+ if (!me.earthme.luminol.config.modules.misc.DisableHeightmapWarnConfig.enabled)
+ LOGGER.warn("Ignoring heightmap data for chunk " + chunk.getPos() + ", size does not match; expected: " + raw.length + ", got: " + data.length);
primeHeightmaps(chunk, EnumSet.of(type));
}
}

View File

@@ -1,512 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sun, 6 Apr 2025 12:51:11 +0800
Subject: [PATCH] Add feature: per virtual thread per tickregion
diff --git a/io/papermc/paper/threadedregions/PerThreadSchedulerPool.java b/io/papermc/paper/threadedregions/PerThreadSchedulerPool.java
new file mode 100644
index 0000000000000000000000000000000000000000..b49b4b02c3d38174a0bb8d171e1f1e65320bdeca
--- /dev/null
+++ b/io/papermc/paper/threadedregions/PerThreadSchedulerPool.java
@@ -0,0 +1,183 @@
+package io.papermc.paper.threadedregions;
+
+import it.unimi.dsi.fastutil.objects.Reference2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMaps;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.LockSupport;
+
+public class PerThreadSchedulerPool {
+ private final ThreadFactory factory;
+ private final COWArrayList<Worker> workers = new COWArrayList<>(Worker.class);
+ private final Reference2ObjectMap<ScheduledTaskThreadPool.SchedulableTick, Worker> task2Workers = Reference2ObjectMaps.synchronize(new Reference2ObjectLinkedOpenHashMap<>());
+
+ public PerThreadSchedulerPool(ThreadFactory factory) {
+ this.factory = factory;
+ }
+
+ public void schedule(ScheduledTaskThreadPool.SchedulableTick task) {
+ final Worker cretedWorker = new Worker(this.factory, task);
+
+ this.task2Workers.put(task, cretedWorker);
+ this.workers.add(cretedWorker);
+
+ cretedWorker.active();
+ }
+
+ public void notifyTasks(ScheduledTaskThreadPool.SchedulableTick task) {
+ final Worker target = this.task2Workers.get(task);
+
+ if (target == null) {
+ return;
+ }
+
+ target.notifyToTask();
+ }
+
+ public void halt() {
+ final Worker[] workers = this.workers.getArray();
+
+ for (Worker worker : workers) {
+ worker.shutdown();
+ }
+ }
+
+ public int getTotalThreadCount() {
+ return this.workers.getArray().length;
+ }
+
+ public Thread[] getAllAliveThreads() {
+ return Arrays.stream(this.workers.getArray()).map(Worker::getOwner).toArray(Thread[]::new);
+ }
+
+ public boolean join(long timeoutNanos) {
+ long deadline = System.nanoTime() + timeoutNanos;
+
+ for (;;) {
+ final Worker[] workers = this.workers.getArray();
+
+ if (workers.length == 0) {
+ return true;
+ }
+
+ Thread.yield();
+ LockSupport.parkNanos(1);
+
+ if (System.nanoTime() > deadline) {
+ return false;
+ }
+ }
+ }
+
+ public final class Worker implements Runnable {
+ private final Thread thread;
+ private final ScheduledTaskThreadPool.SchedulableTick task;
+
+ private final AtomicBoolean shutdown = new AtomicBoolean(false);
+ private final AtomicBoolean running = new AtomicBoolean(true);
+
+ public Worker(@NotNull ThreadFactory threadFactory, ScheduledTaskThreadPool.SchedulableTick task) {
+ this.thread = threadFactory.newThread(this);
+ this.task = task;
+
+ if (!this.task.setScheduled()) {
+ throw new IllegalArgumentException("Task is already scheduled");
+ }
+ }
+
+ @Override
+ public void run() {
+ TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.set(new TickThreadRunnerDataCarrier());
+
+ master_loop:
+ for (;;) {
+ if (!this.task.isScheduled() || this.shutdown.get()) {
+ break;
+ }
+
+ final long deadline = this.task.getScheduledStart();
+
+ for (;; ) {
+ final long currTime = System.nanoTime();
+
+ if (currTime >= deadline) {
+ // we will use it in setting to ticking state
+ // containing cas operations so we need to process the fallback
+ if (this.task.upgradeToScheduledTasks()) {
+ break;
+ }
+ }
+
+ final boolean hasTasks = this.task.hasTasks(); // check for tasks
+
+ if (hasTasks) {
+ // containing cas operations so we need to process the fallback
+ if (!this.task.upgradeToScheduledTasks()) {
+ continue;
+ }
+
+ // task sate and run tasks
+ final boolean taskProcessed = this.task.tasks(() -> System.nanoTime() >= deadline);
+
+ // containing cas operations so we need to process the fallback
+ // also might be cancelled
+ if (!taskProcessed) {
+ // check for cancelled
+ continue master_loop;
+ }else {
+ continue;
+ }
+ }
+
+ Thread.yield();
+ LockSupport.parkNanos(1_000L);
+ }
+
+ boolean ticked = this.task.tick();
+
+ if (!ticked) {
+ break;
+ }
+ }
+
+ TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.remove();
+ PerThreadSchedulerPool.this.task2Workers.remove(this.task);
+ PerThreadSchedulerPool.this.workers.remove(this);
+ this.running.set(false);
+ }
+
+ public void active() {
+ this.thread.start();
+ }
+
+ public Thread getOwner() {
+ return this.thread;
+ }
+
+ public void notifyToTask() {
+ LockSupport.unpark(this.thread);
+ }
+
+ public boolean running() {
+ return this.running.get();
+ }
+
+ public void shutdown() {
+ this.shutdown.set(true);
+ LockSupport.unpark(this.thread);
+ }
+ }
+
+ public static class TickThreadRunnerDataCarrier {
+ ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> currentTickingRegion;
+ RegionizedWorldData currentTickingWorldRegionizedData;
+ ScheduledTaskThreadPool.SchedulableTick currentTickingTask;
+ ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE;
+
+ public static final ThreadLocal<TickThreadRunnerDataCarrier> CARRIER_THREAD_LOCAL = new ThreadLocal<>();
+ }
+}
diff --git a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
index 5c591b0d6eac45d6094ce44bf62ad976bf995e66..2f61f72087ea07e8d29bf6d5c264e217b20eb377 100644
--- a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
+++ b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
@@ -402,7 +402,7 @@ public final class ScheduledTaskThreadPool {
private volatile ScheduledTickTask task;
- private int getStateVolatile() {
+ public int getStateVolatile() { // Luminol - Per thread for tickregion
return (int)STATE_HANDLE.getVolatile(this);
}
@@ -414,23 +414,23 @@ public final class ScheduledTaskThreadPool {
return (int)STATE_HANDLE.compareAndExchange(this, expect, update);
}
- private boolean isScheduled() {
+ public boolean isScheduled() { // Luminol - Per thread for tickregion
return this.getStateVolatile() == STATE_SCHEDULED;
}
- private boolean upgradeToScheduledTasks() {
+ public boolean upgradeToScheduledTasks() { // Luminol - Per thread for tickregion
return STATE_SCHEDULED == this.compareAndExchangeStateVolatile(STATE_SCHEDULED, STATE_SCHEDULED_TASKS);
}
- private boolean setScheduled() {
+ public boolean setScheduled() { // Luminol - Per thread for tickregion
return STATE_UNSCHEDULED == this.compareAndExchangeStateVolatile(STATE_UNSCHEDULED, STATE_SCHEDULED);
}
- private boolean setScheduledTasks() {
+ public boolean setScheduledTasks() { // Luminol - Per thread for tickregion
return STATE_UNSCHEDULED == this.compareAndExchangeStateVolatile(STATE_UNSCHEDULED, STATE_SCHEDULED_TASKS);
}
- private boolean cancel() {
+ public boolean cancel() { // Luminol - Per thread for tickregion
for (int currState = this.getStateVolatile();;) {
switch (currState) {
case STATE_UNSCHEDULED: {
@@ -544,14 +544,14 @@ public final class ScheduledTaskThreadPool {
}
}
- protected final long getScheduledStart() {
+ public final long getScheduledStart() { // Luminol - Per thread for tickregion
return this.scheduledStart;
}
/**
* If this task is scheduled, then this may only be invoked during {@link #runTick()}
*/
- protected final void setScheduledStart(final long value) {
+ public final void setScheduledStart(final long value) { // Luminol - Per thread for tickregion
this.scheduledStart = value;
}
@@ -565,7 +565,7 @@ public final class ScheduledTaskThreadPool {
*/
public abstract boolean runTick();
- private boolean tick() {
+ public boolean tick() { // Luminol - Per thread for tickregion
if (!this.markTicking()) {
return false;
}
@@ -610,7 +610,7 @@ public final class ScheduledTaskThreadPool {
*/
public abstract boolean runTasks(final BooleanSupplier canContinue);
- private boolean tasks(final BooleanSupplier canContinue) {
+ public boolean tasks(final BooleanSupplier canContinue) { // Luminol - Per thread for tickregion
if (!this.markTasks()) {
return false;
}
@@ -692,12 +692,12 @@ public final class ScheduledTaskThreadPool {
private Thread thread;
// no scheduled ticks
- private static final int STATE_IDLE = 1 << 0;
- private static final int STATE_WAITING = 1 << 1;
- private static final int STATE_TASKS = 1 << 2;
- private static final int STATE_INTERRUPT = 1 << 3;
- private static final int STATE_TICKING = 1 << 4;
- private static final int STATE_HALTED = 1 << 5;
+ public static final int STATE_IDLE = 1 << 0; // Luminol - Per thread for tickregion
+ public static final int STATE_WAITING = 1 << 1; // Luminol - Per thread for tickregion
+ public static final int STATE_TASKS = 1 << 2; // Luminol - Per thread for tickregion
+ public static final int STATE_INTERRUPT = 1 << 3; // Luminol - Per thread for tickregion
+ public static final int STATE_TICKING = 1 << 4; // Luminol - Per thread for tickregion
+ public static final int STATE_HALTED = 1 << 5; // Luminol - Per thread for tickregion
private volatile int state = STATE_INTERRUPT; // set to INTERRUPT initially so that tasks may be stolen on start
private static final VarHandle STATE_HANDLE = ConcurrentUtil.getVarHandle(TickThreadRunner.class, "state", int.class);
@@ -720,7 +720,7 @@ public final class ScheduledTaskThreadPool {
STATE_HANDLE.setVolatile(this, value);
}
- private int compareAndExchangeStateVolatile(final int expect, final int update) {
+ public int compareAndExchangeStateVolatile(final int expect, final int update) { // Luminol - Per thread for tickregion
return (int)STATE_HANDLE.compareAndExchange(this, expect, update);
}
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
index a8608e8bed64a4da4ed340ab3837b082d6715437..fc14f5780effce99a9768a1ffbb338e61228b252 100644
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
@@ -40,65 +40,92 @@ public final class TickRegionScheduler {
}
// Folia end - watchdog
- private final ScheduledTaskThreadPool scheduler;
+ private final PerThreadSchedulerPool scheduler; // Luminol - Per thread for tickregion
public TickRegionScheduler() {
- this.scheduler = new ScheduledTaskThreadPool(new ThreadFactory() {
+ this.scheduler = new PerThreadSchedulerPool(new ThreadFactory() { // Luminol - Per thread for tickregion
private final AtomicInteger idGenerator = new AtomicInteger();
@Override
public Thread newThread(final Runnable run) {
- final Thread ret = new TickThreadRunner(run, "Region Scheduler Thread #" + this.idGenerator.getAndIncrement());
- ret.setUncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException);
+ //final Thread ret = new TickThreadRunner(run, "Region Scheduler Thread #" + this.idGenerator.getAndIncrement()); // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ final Thread ret = Thread.ofVirtual()
+ .name("Region Scheduler Thread #" + this.idGenerator.getAndIncrement())
+ .uncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException)
+ .factory()
+ .newThread(() -> {
+ try {
+ run.run();
+ }finally {
+ TickThread.VIRTUAL_TICK_THREAD_GROUP.remove(Thread.currentThread());
+ }
+ });
+ TickThread.VIRTUAL_TICK_THREAD_GROUP.add(ret);
+ // Luminol end
return ret;
}
- }, TimeUnit.MILLISECONDS.toNanos(3L), TimeUnit.MILLISECONDS.toNanos(2L));
+ }); // Luminol - Per thread for tickregion
}
public void setThreads(final int threads) {
- this.scheduler.setCoreThreads(threads);
+ //this.scheduler.setCoreThreads(threads); // Luminol - Per thread for tickregion
}
public int getTotalThreadCount() {
- return this.scheduler.getAliveThreads().length;
+ return this.scheduler.getTotalThreadCount(); // Luminol - Per thread for tickregion
}
private static void setTickingRegion(final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> region) {
- final Thread currThread = Thread.currentThread();
+ /*final Thread currThread = Thread.currentThread();
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
throw new IllegalStateException("Must be tick thread runner");
+ }*/
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get(); // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ if (carrier == null) {
+ throw new IllegalStateException("Must be tick thread runner");
}
- if (region != null && tickThreadRunner.currentTickingRegion != null) {
+ // Luminol end
+ var currentTickingRegion = carrier.currentTickingRegion; // Luminol - Per thread for tickregion
+ if (region != null && currentTickingRegion != null) { // Luminol - Per thread for tickregion
throw new IllegalStateException("Trying to double set ticking region!");
}
- if (region == null && tickThreadRunner.currentTickingRegion == null) {
+ if (region == null && currentTickingRegion == null) { // Luminol - Per thread for tickregion
throw new IllegalStateException("Trying to double unset ticking region!");
}
- tickThreadRunner.currentTickingRegion = region;
+ carrier.currentTickingRegion = region; // Luminol - Per thread for tickregion
if (region != null) {
- tickThreadRunner.currentTickingWorldRegionizedData = region.regioniser.world.worldRegionData.get();
+ carrier.currentTickingWorldRegionizedData = region.regioniser.world.worldRegionData.get(); // Luminol - Per thread for tickregion
// Folia start - profiler
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = region.getData().profiler;
- tickThreadRunner.profiler = profiler == null ? ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE : profiler;
+ carrier.profiler = profiler == null ? ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE : profiler; // Luminol - Per thread for tickregion
// Folia end - profiler
} else {
- tickThreadRunner.currentTickingWorldRegionizedData = null;
- tickThreadRunner.profiler = ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE; // Folia - profiler
+ carrier.currentTickingWorldRegionizedData = null;// Luminol - Per thread for tickregion
+ carrier.profiler = ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE; // Folia - profiler // Luminol - Per thread for tickregion
}
}
private static void setTickTask(final ScheduledTaskThreadPool.SchedulableTick task) {
- final Thread currThread = Thread.currentThread();
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
throw new IllegalStateException("Must be tick thread runner");
+ }*/ // Luminol - Per thread for tickregion
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get(); // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ if (carrier == null) {
+ throw new IllegalStateException("Must be tick thread runner");
}
- if (task != null && tickThreadRunner.currentTickingTask != null) {
+ // Luminol end
+ final ScheduledTaskThreadPool.SchedulableTick last = carrier.currentTickingTask; // Luminol - Per thread for tickregion
+ if (task != null && last != null) { // Luminol - Per thread for tickregion
throw new IllegalStateException("Trying to double set ticking task!");
}
- if (task == null && tickThreadRunner.currentTickingTask == null) {
+ if (task == null && last == null) { // Luminol - Per thread for tickregion
throw new IllegalStateException("Trying to double unset ticking task!");
}
- tickThreadRunner.currentTickingTask = task;
+ carrier.currentTickingTask = task;
}
/**
@@ -106,11 +133,17 @@ public final class TickRegionScheduler {
* If this thread is not a TickThread, then returns {@code null}.
*/
public static ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> getCurrentRegion() {
- final Thread currThread = Thread.currentThread();
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
return RegionShutdownThread.getRegion();
+ }*/ // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
+ if (carrier == null) {
+ return RegionShutdownThread.getRegion();
}
- return tickThreadRunner.currentTickingRegion;
+ // Luminol end
+ return carrier.currentTickingRegion; // Luminol - Per thread for tickregion
}
/**
@@ -119,11 +152,17 @@ public final class TickRegionScheduler {
* If this thread is not a TickThread, then returns {@code null}.
*/
public static RegionizedWorldData getCurrentRegionizedWorldData() {
- final Thread currThread = Thread.currentThread();
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
return RegionShutdownThread.getWorldData();
+ }*/ // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
+ if (carrier == null) {
+ return RegionShutdownThread.getWorldData();
}
- return tickThreadRunner.currentTickingWorldRegionizedData;
+ // Luminol end
+ return carrier.currentTickingWorldRegionizedData; // Luminol - Per thread for tickregion
}
/**
@@ -131,20 +170,32 @@ public final class TickRegionScheduler {
* If this thread is not a TickThread, then returns {@code null}.
*/
public static ScheduledTaskThreadPool.SchedulableTick getCurrentTickingTask() {
- final Thread currThread = Thread.currentThread();
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
return null;
+ }*/ // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
+ if (carrier == null) {
+ return null;
}
- return tickThreadRunner.currentTickingTask;
+ // Luminol end
+ return carrier.currentTickingTask;
}
// Folia start - profiler
public static ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle getProfiler() {
- final Thread currThread = Thread.currentThread();
- if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
+ if (!(currThread instanceof TickThreadRunner)) { // Luminol - Per thread for tickregion
+ return ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE;
+ }*/ // Luminol - Per thread for tickregion
+ // Luminol start - Per thread for tickregion
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
+ if (carrier == null) {
return ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE;
}
- return tickThreadRunner.profiler;
+ // Luminol end
+ return carrier.profiler; // Luminol - Per thread for tickregion
}
// Folia end - profiler
@@ -171,14 +222,14 @@ public final class TickRegionScheduler {
public boolean halt(final boolean sync, final long maxWaitNS) {
this.scheduler.halt();
if (!sync) {
- return this.scheduler.getAliveThreads().length == 0;
+ return this.scheduler.getTotalThreadCount() == 0; // Luminol - Per thread for tickregion
}
- return this.scheduler.join(maxWaitNS == 0L ? 0L : Math.max(1L, TimeUnit.NANOSECONDS.toMillis(maxWaitNS)));
+ return this.scheduler.join(maxWaitNS == 0L ? 0L : Math.max(1L, maxWaitNS)); // Luminol - Per thread for tickregion
}
void dumpAliveThreadTraces(final String reason) {
- for (final Thread thread : this.scheduler.getAliveThreads()) {
+ for (final Thread thread : this.scheduler.getAllAliveThreads()) { // Luminol - Per thread for tickregion
if (thread.isAlive()) {
TraceUtil.dumpTraceForThread(thread, reason);
}

View File

@@ -0,0 +1,197 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Fri, 11 Apr 2025 16:53:57 +0800
Subject: [PATCH] Add config to revert raid changes
diff --git a/net/minecraft/world/effect/BadOmenMobEffect.java b/net/minecraft/world/effect/BadOmenMobEffect.java
index 80f17f33f670018240c854df589cf90cdeab6e70..8672757a4d5fb5c247599782fece6b8d7d6ec921 100644
--- a/net/minecraft/world/effect/BadOmenMobEffect.java
+++ b/net/minecraft/world/effect/BadOmenMobEffect.java
@@ -22,6 +22,11 @@ class BadOmenMobEffect extends MobEffect {
&& !serverPlayer.isSpectator()
&& level.getDifficulty() != Difficulty.PEACEFUL
&& level.isVillage(serverPlayer.blockPosition())) {
+ // Leaves start - Revert raid changes
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.trigger) {
+ return level.getRaids().createOrExtendRaid(serverPlayer, serverPlayer.blockPosition()) == null;
+ }
+ // Leaves end - Revert raid changes
Raid raidAt = level.getRaidAt(serverPlayer.blockPosition());
if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) {
serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier));
diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618996cc5bc 100644
--- a/net/minecraft/world/entity/raid/Raid.java
+++ b/net/minecraft/world/entity/raid/Raid.java
@@ -325,7 +325,20 @@ public class Raid {
}
if (flag1) {
- this.waveSpawnPos = this.getValidSpawnPos();
+ // Luminol Start - Raid revert
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) {
+ this.waveSpawnPos = this.getValidSpawnPos();
+ } else {
+ int n4 = 0;
+ if (this.raidCooldownTicks < 100) {
+ n4 = 1;
+ }
+ if (this.raidCooldownTicks < 40) {
+ n4 = 2;
+ }
+ this.waveSpawnPos = this.getValidSpawnPos(n4);
+ }
+ // Luminol End - Raid revert
}
if (this.raidCooldownTicks == 300 || this.raidCooldownTicks % 20 == 0) {
@@ -360,7 +373,14 @@ public class Raid {
int i = 0;
while (this.shouldSpawnGroup()) {
- BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ // Luminol Start - Raid revert
+ BlockPos blockPos;
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) {
+ blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ } else {
+ blockPos = this.waveSpawnPos.isPresent() ? this.waveSpawnPos.get() : this.findRandomSpawnPos(i, 20);
+ }
+ // Luminol End - Raid revert
if (blockPos != null) {
this.started = true;
this.spawnGroup(blockPos);
@@ -372,7 +392,7 @@ public class Raid {
i++;
}
- if (i > 5) {
+ if (i > (me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert ? 3 : 5)) { // Luminol - Raid revert
org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit
this.stop();
break;
@@ -449,6 +469,17 @@ public class Raid {
return blockPos != null ? Optional.of(blockPos) : Optional.empty();
}
+ // Luminol Start - Raid revert
+ private Optional<BlockPos> getValidSpawnPos(int n) {
+ for (int i = 0; i < 3; ++i) {
+ BlockPos blockPos = this.findRandomSpawnPos(n, 1);
+ if (blockPos == null) continue;
+ return Optional.of(blockPos);
+ }
+ return Optional.empty();
+ }
+ // Luminol End - Raid revert
+
private boolean hasMoreWaves() {
return this.hasBonusWave() ? !this.hasSpawnedBonusWave() : !this.isFinalWave();
}
@@ -674,7 +705,7 @@ public class Raid {
int i2 = this.center.getX() + Mth.floor(Mth.cos(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3);
- if (Mth.abs(height - this.center.getY()) <= 96) {
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.height_check || Mth.abs(height - this.center.getY()) <= 96) { // Leaves - Disable height check
mutableBlockPos.set(i2, height, i3);
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
int i4 = 10;
@@ -694,6 +725,26 @@ public class Raid {
return null;
}
+ // Luminol Start - Raid revert
+ @Nullable
+ private BlockPos findRandomSpawnPos(int n, int n2) {
+ int n3 = 2 - n;
+ BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ SpawnPlacementType spawnPlacementType = SpawnPlacements.getPlacementType(EntityType.RAVAGER);
+ for (int i = 0; i < n2; ++i) {
+ float f = this.level.random.nextFloat() * ((float)Math.PI * 2);
+ int n4 = this.center.getX() + Mth.floor(Mth.cos(f) * 32.0f * (float)n3) + this.level.random.nextInt(5);
+ int n5 = this.center.getZ() + Mth.floor(Mth.sin(f) * 32.0f * (float)n3) + this.level.random.nextInt(5);
+ int n6 = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, n4, n5);
+ mutableBlockPos.set(n4, n6, n5);
+ if (this.level.isVillage(mutableBlockPos) && n < 2) continue;
+ if (!this.level.hasChunksAt(mutableBlockPos.getX() - 10, mutableBlockPos.getZ() - 10, mutableBlockPos.getX() + 10, mutableBlockPos.getZ() + 10) || !this.level.isPositionEntityTicking(mutableBlockPos) || !spawnPlacementType.isSpawnPositionOk(this.level, mutableBlockPos, EntityType.RAVAGER) && (!this.level.getBlockState((BlockPos)mutableBlockPos.below()).is(Blocks.SNOW) || !this.level.getBlockState(mutableBlockPos).isAir())) continue;
+ return mutableBlockPos;
+ }
+ return null;
+ }
+ // Luminol End - Raid revert
+
private boolean addWaveMob(int wave, Raider raider) {
return this.addWaveMob(wave, raider, true);
}
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7eab2a25c 100644
--- a/net/minecraft/world/entity/raid/Raider.java
+++ b/net/minecraft/world/entity/raid/Raider.java
@@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster {
currentRaid.removeFromRaid(this, false);
}
+
+ // Leaves start - Revert raid changes
+ if (this.level() instanceof ServerLevel serverLevel) {
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.effect && !this.hasRaid()) {
+ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
+ net.minecraft.world.entity.player.Player entityhuman = null;
+ if (entity instanceof net.minecraft.world.entity.player.Player player) {
+ entityhuman = player;
+ } else if (entity instanceof net.minecraft.world.entity.animal.Wolf wolf) {
+ LivingEntity entityliving = wolf.getOwner();
+ if (wolf.isTame() && entityliving instanceof net.minecraft.world.entity.player.Player player) {
+ entityhuman = player;
+ }
+ }
+
+ if (entityhuman != null && !itemstack.isEmpty() && this.isCaptain()) {
+ net.minecraft.world.effect.MobEffectInstance mobeffect = entityhuman.getEffect(net.minecraft.world.effect.MobEffects.BAD_OMEN);
+ int i = 1;
+
+ if (mobeffect != null) {
+ i += mobeffect.getAmplifier();
+ entityhuman.removeEffectNoUpdate(net.minecraft.world.effect.MobEffects.BAD_OMEN);
+ } else {
+ --i;
+ }
+
+ i = net.minecraft.util.Mth.clamp(i, 0, 4);
+ net.minecraft.world.effect.MobEffectInstance mobeffect1 = new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, i, false, false, true);
+
+ if (!serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_DISABLE_RAIDS)) {
+ entityhuman.addEffect(mobeffect1, entityhuman, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN, true, true); // CraftBukkit // Luminol - Raid revert adapt Cross Region Damage trace
+ }
+ this.setPatrolLeader(false);
+ }
+ }
+ }
+ // Leaves end - Revert raid changes
}
super.die(cause);
@@ -153,7 +190,7 @@ public abstract class Raider extends PatrollingMonster {
}
public boolean hasRaid() {
- return this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null);
+ return !me.earthme.luminol.config.modules.misc.RaidChangesConfig.self_check && (this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null)); // Leaves - Disable raid self check
}
public boolean hasActiveRaid() {
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
index 318f24d67be4daf6993ba547da0540be9c221a75..5607d2f21131510563f8fdc9079d1145483b11df 100644
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
+++ b/net/minecraft/world/item/component/OminousBottleAmplifier.java
@@ -40,7 +40,7 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T
@Override
public void addToTooltip(Item.TooltipContext context, Consumer<Component> tooltipAdder, TooltipFlag tooltipFlag) {
- List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true));
+ List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true)); // Luminol - Raid effect infinite
PotionContents.addPotionTooltip(list, tooltipAdder, 1.0F, context.tickRate());
}
}

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Fri, 4 Apr 2025 08:17:32 +0800
Subject: [PATCH] Correct isWatched method in ScheduledTaskThreadPool
diff --git a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
index 2f61f72087ea07e8d29bf6d5c264e217b20eb377..3694b01f0dc04f6de2df1d926a9208f5711a3a8b 100644
--- a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
+++ b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
@@ -1229,7 +1229,7 @@ public final class ScheduledTaskThreadPool {
}
public boolean isWatched() {
- return (boolean)TAKEN_HANDLE.getVolatile(this);
+ return (boolean)WATCHED_HANDLE.getVolatile(this); // Luminol - Try fixing scheduling call issue
}
public long getLastTaskNotify() {

View File

@@ -0,0 +1,167 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Thu, 1 May 2025 22:43:08 +0800
Subject: [PATCH] Add config to enable tick command
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
index 1382c695c4991488b113401e231875ddc74f6b01..68280b07a71dcdb42eaee6f62fbda074813a22e4 100644
--- a/io/papermc/paper/threadedregions/RegionizedServer.java
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java
@@ -286,6 +286,11 @@ public final class RegionizedServer {
this.randomWalk();
*/
++this.tickCount;
+ // Luminol start - Add a config to enable tick command
+ if (me.earthme.luminol.config.modules.experiment.CommandTickConfig.enabled) {
+ MinecraftServer.tickRateManager.tick();
+ }
+ // Luminol end - Add a config to enable tick command
// expire invalid click command callbacks
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue((int)this.tickCount);
@@ -308,6 +313,13 @@ public final class RegionizedServer {
this.globalTick(world, tickCount);
}
+ // Luminol start - Add a config to enable tick command
+ if (me.earthme.luminol.config.modules.experiment.CommandTickConfig.enabled) {
+ MinecraftServer.tickRateManager.reduceSprintTicks();
+ MinecraftServer.tickRateManager.endTickWork();
+ }
+ // Luminol end - Add a config to enable tick command
+
// tick connections
this.tickConnections();
@@ -441,7 +453,7 @@ public final class RegionizedServer {
}
private void tickTime(final ServerLevel world, final int tickCount) {
- if (world.tickTime) {
+ if ((!me.earthme.luminol.config.modules.experiment.CommandTickConfig.enabled || world.tickRateManager().runsNormally()) && world.tickTime) { // Luminol - Add a config to enable tick command
if (world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
world.setDayTime(world.levelData.getDayTime() + (long)tickCount);
}
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
index 7123b3eb2f2e52946b8ef9de993a6828eb0bb6f7..82948984404a183711588932a4a026dc4c241feb 100644
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
@@ -31,8 +31,8 @@ public final class TickRegionScheduler {
}
}
- public static final int TICK_RATE = 20;
- public static final long TIME_BETWEEN_TICKS = 1_000_000_000L / TICK_RATE; // ns
+ public static float TICK_RATE = 20; // Luminol - Add tick command support
+ public static long TIME_BETWEEN_TICKS = (long) (1_000_000_000L / TICK_RATE); // ns // Luminol - Add tick command support
// Folia start - watchdog
public static final FoliaWatchdogThread WATCHDOG_THREAD = new FoliaWatchdogThread();
@@ -375,8 +375,23 @@ public final class TickRegionScheduler {
final long cpuStart = MEASURE_CPU_TIME ? THREAD_MX_BEAN.getCurrentThreadCpuTime() : 0L;
final long tickStart = System.nanoTime();
- // use max(), don't assume that tickStart >= scheduledStart
- final int tickCount = Math.max(1, this.tickSchedule.getPeriodsAhead(TIME_BETWEEN_TICKS, tickStart));
+ // Luminol start - Add a config to enable tick command
+ final int tickCount;
+ if (me.earthme.luminol.config.modules.experiment.CommandTickConfig.enabled) {
+ if (MinecraftServer.tickRateManager.isSprinting() && MinecraftServer.tickRateManager.checkShouldSprintThisTick()) {
+ TICK_RATE = net.minecraft.server.commands.TickCommand.MAX_TICKRATE;
+ TIME_BETWEEN_TICKS = (long) (1_000_000_000L / TICK_RATE);
+ tickCount = 1;
+ } else {
+ TICK_RATE = MinecraftServer.tickRateManager.tickrate();
+ TIME_BETWEEN_TICKS = (long) (1_000_000_000L / TICK_RATE);
+ tickCount = Math.max(1, this.tickSchedule.getPeriodsAhead(TIME_BETWEEN_TICKS, tickStart));
+ }
+ } else {
+ // use max(), don't assume that tickStart >= scheduledStart
+ tickCount = Math.max(1, this.tickSchedule.getPeriodsAhead(TIME_BETWEEN_TICKS, tickStart));
+ }
+ // Luminol end - Add tick command support
if (!this.tryMarkTicking()) {
if (!this.cancelled.get()) {
@@ -416,6 +431,11 @@ public final class TickRegionScheduler {
try {
// next start isn't updated until the end of this tick
this.tickRegion(tickCount, tickStart, scheduledEnd);
+ // Luminol start - Add a config to enable tick command
+ if (me.earthme.luminol.config.modules.experiment.CommandTickConfig.enabled) {
+ MinecraftServer.tickRateManager.endTickWork();
+ }
+ // Luminol end - Add a config to enable tick command
} catch (final Throwable thr) {
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 cfb37f2e428605965a37dc1eb83f302fe1bd6299..8f7b28e5688252207ad8ce9f3fb6f9c3b65d1adc 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -213,7 +213,11 @@ public class Commands {
//TeamMsgCommand.register(this.dispatcher); // Folia - region threading - TODO later
TeleportCommand.register(this.dispatcher);
TellRawCommand.register(this.dispatcher, context);
- //TickCommand.register(this.dispatcher); // Folia - region threading - TODO later
+ // Luminol start - Add a config to enable tick command
+ if (me.earthme.luminol.config.modules.experiment.CommandTickConfig.enabled) {
+ TickCommand.register(this.dispatcher); // Folia - region threading - TODO later
+ }
+ // Luminol end - Add a config to enable tick command
TimeCommand.register(this.dispatcher);
TitleCommand.register(this.dispatcher, context);
//TriggerCommand.register(this.dispatcher); // Folia - region threading - TODO later
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index ed00a29daccfee1d631bef27c0a3a4ae83140018..56f5568848d0f20b4d706c07dc8114594e0b5337 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -267,7 +267,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private String serverId;
public MinecraftServer.ReloadableResources resources;
private final StructureTemplateManager structureTemplateManager;
- private final ServerTickRateManager tickRateManager;
+ public static ServerTickRateManager tickRateManager; // Luminol - Add tick command support
protected WorldData worldData;
public PotionBrewing potionBrewing;
private FuelValues fuelValues;
diff --git a/net/minecraft/server/ServerTickRateManager.java b/net/minecraft/server/ServerTickRateManager.java
index 40338efd1c0e56d869d03f1d0687e7ff0fcbf11a..d0d90a25a10bbecfffceee1992af88c60d14fd87 100644
--- a/net/minecraft/server/ServerTickRateManager.java
+++ b/net/minecraft/server/ServerTickRateManager.java
@@ -105,7 +105,7 @@ public class ServerTickRateManager extends TickRateManager {
return false;
} else if (this.remainingSprintTicks > 0L) {
this.sprintTickStartTime = System.nanoTime();
- this.remainingSprintTicks--;
+ // this.remainingSprintTicks--; // Luminol - Add tick command support
return true;
} else {
this.finishTickSprint();
@@ -113,6 +113,12 @@ public class ServerTickRateManager extends TickRateManager {
}
}
+ // Luminol start - Add tick command support
+ public void reduceSprintTicks() {
+ this.remainingSprintTicks--;
+ }
+ // Luminol end - Add tick command support
+
public void endTickWork() {
this.sprintTimeSpend = this.sprintTimeSpend + (System.nanoTime() - this.sprintTickStartTime);
}
diff --git a/net/minecraft/server/commands/TickCommand.java b/net/minecraft/server/commands/TickCommand.java
index 6b6c8ce49eda6806c8288d70848dd143ba2c4703..5d09d2c8bb45cc10b2a13100793249adc7b5a7e9 100644
--- a/net/minecraft/server/commands/TickCommand.java
+++ b/net/minecraft/server/commands/TickCommand.java
@@ -14,7 +14,7 @@ import net.minecraft.server.ServerTickRateManager;
import net.minecraft.util.TimeUtil;
public class TickCommand {
- private static final float MAX_TICKRATE = 10000.0F;
+ public static final float MAX_TICKRATE = 10000.0F; // Luminol - Add tick command support
private static final String DEFAULT_TICKRATE = String.valueOf(20);
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {

View File

@@ -3,6 +3,7 @@ From: MrHua269 <wangxyper@163.com>
Date: Sun, 12 Jan 2025 10:53:41 +0800
Subject: [PATCH] Teleport async if entity was moving to another region at once
On folia, entity usually cannot move out of the tickregion, but sometimes it actually does(like some end pearl gun that can shoot an end pearl to the block faraway than 10000 blocks even more). To fix this, we added a temporary fix which teleport these entities to the destination instead running its move logics so that we could ensure anything is under control.But one thing need to consider is that teleportAsync is actually calling halfway of the entity tick and there is still something running when teleportAsync called, which is actually modified the entity in another thread, so there is still need an improvement
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index cc8efa162fbe7ce6a91629239bf18d7b6b096a8a..4026d465687604965f105ded21a8206fd52bd375 100644

View File

@@ -3,6 +3,7 @@ From: MrHua269 <wangxyper@163.com>
Date: Sun, 12 Jan 2025 10:56:59 +0800
Subject: [PATCH] Try fixing folia off region POI accessing issue
Folia's POIManager sometimes is trying getting the POI record that doesn't belong to current tickregion which is causing some off-main-thread exceptions thrown, so we need to replace the logic with corrected one
diff --git a/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index c10810bf00d75f459c3c6a9415c1e09f0519d50e..3adafa43367cd6648ecbccb92ba5bd509740d5a4 100644

View File

@@ -3,6 +3,9 @@ From: MrHua269 <mrhua269@gmail.com>
Date: Sun, 9 Mar 2025 11:39:01 +0800
Subject: [PATCH] Do not search the block out of current region
Skip getting the blocks don't belong to current tickregion.
notice: this bug is actually caused by another bug of the teleportAsync implementation.
diff --git a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 61887e6b052bca715c90dff5d9cd657e0b3f6a78..95e2dff6782bf7767ecb1a23e618862919ea71aa 100644

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sat, 26 Apr 2025 21:47:45 +0800
Subject: [PATCH] Correct player respawn place
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..b6df8df78105e08ca7be82524685d8b9422abf21 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -472,8 +472,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
double amountX = selectMaxX - selectMinX;
double amountZ = selectMaxZ - selectMinZ;
- int selectX = amountX < 1.0 ? Mth.floor(worldBorder.getCenterX()) : (int)Mth.floor((amountX + 1.0) * random.nextDouble() + selectMinX);
- int selectZ = amountZ < 1.0 ? Mth.floor(worldBorder.getCenterZ()) : (int)Mth.floor((amountZ + 1.0) * random.nextDouble() + selectMinZ);
+ // Luminol start - Correct player respawn place
+ int selectX = amountX < 0.0 ? Mth.floor(worldBorder.getCenterX()) : (int)Mth.floor(amountX * random.nextDouble() + selectMinX);
+ int selectZ = amountZ < 0.0 ? Mth.floor(worldBorder.getCenterZ()) : (int)Mth.floor(amountZ * random.nextDouble() + selectMinZ);
+ // Luminol end - Correct player respawn place
return new BlockPos(selectX, 0, selectZ);
}
@@ -484,10 +486,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
private static BlockPos findSpawnAround(ServerLevel world, ServerPlayer player, BlockPos selected) {
+ // Luminol start - Correct player respawn place
+ BlockPos inChunk;
+ inChunk = PlayerRespawnLogic.getOverworldRespawnPos(world, selected.getX(), selected.getZ());
+ if (inChunk != null) {
+ AABB checkVolume = player.getBoundingBoxAt((double)inChunk.getX() + 0.5, (double)inChunk.getY(), (double)inChunk.getZ() + 0.5);
+ if (player.noCollisionNoLiquid(world, checkVolume)) {
+ return inChunk;
+ }
+ }
+ // Luminol end - Correct player respawn place
// try hard to find, so that we don't attempt another chunk load
for (int dz = -SPAWN_RADIUS_SELECTION_SEARCH; dz <= SPAWN_RADIUS_SELECTION_SEARCH; ++dz) {
for (int dx = -SPAWN_RADIUS_SELECTION_SEARCH; dx <= SPAWN_RADIUS_SELECTION_SEARCH; ++dx) {
- BlockPos inChunk = PlayerRespawnLogic.getOverworldRespawnPos(world, selected.getX() + dx, selected.getZ() + dz);
+ inChunk = PlayerRespawnLogic.getOverworldRespawnPos(world, selected.getX() + dx, selected.getZ() + dz); // Luminol - Correct player respawn place
if (inChunk == null) {
continue;
}

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Thu, 24 Apr 2025 20:59:52 +0800
Subject: [PATCH] Command IllegalArgumentException crash fix
diff --git a/net/minecraft/server/commands/FillCommand.java b/net/minecraft/server/commands/FillCommand.java
index 89154adfc659afa188cd771e70087e3b1a9c98b9..e622f96e6e116bf491bbea39da099e02ceaee502 100644
--- a/net/minecraft/server/commands/FillCommand.java
+++ b/net/minecraft/server/commands/FillCommand.java
@@ -210,6 +210,10 @@ public class FillCommand {
// Folia start - region threading
} catch (CommandSyntaxException ex) {
sendMessage(source, ex);
+ // Luminol Start - Server crash fix
+ } catch (IllegalArgumentException ex) {
+ net.minecraft.server.commands.SetBlockCommand.processIAE(source, ex);
+ // Luminol End - Server crash fix
}
}); return 0; // Folia end - region threading
}
diff --git a/net/minecraft/server/commands/SetBlockCommand.java b/net/minecraft/server/commands/SetBlockCommand.java
index 05b824409546ba8bacf7efdaeac106af89ff0715..55911d49c7650b344b46b2cfa9c4ae840ae433c8 100644
--- a/net/minecraft/server/commands/SetBlockCommand.java
+++ b/net/minecraft/server/commands/SetBlockCommand.java
@@ -86,6 +86,15 @@ public class SetBlockCommand {
}
// Folia end - region threading
+ // Luminol Start - Server crash fix
+ public static void processIAE(CommandSourceStack src, IllegalArgumentException ex) {
+ Component hoverText = Component.translatable("command.failed")
+ .withStyle(style -> style.withHoverEvent(new net.minecraft.network.chat.HoverEvent(net.minecraft.network.chat.HoverEvent.Action.SHOW_TEXT, Component.literal(ex.getMessage()))));
+ src.sendFailure(hoverText);
+ com.mojang.logging.LogUtils.getLogger().error(ex.getMessage(), ex);
+ }
+ // Luminol end - Server crash fix
+
private static int setBlock(
CommandSourceStack source, BlockPos pos, BlockInput state, SetBlockCommand.Mode mode, @Nullable Predicate<BlockInWorld> predicate
) throws CommandSyntaxException {
@@ -119,6 +128,10 @@ public class SetBlockCommand {
// Folia start - region threading
} catch (CommandSyntaxException ex) {
sendMessage(source, ex);
+ // Luminol Start - Server crash fix
+ } catch (IllegalArgumentException ex) {
+ processIAE(source, ex);
+ // Luminol End - Server crash fix
}
});
return 1;

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sat, 10 May 2025 19:46:16 +0800
Subject: [PATCH] Fix creative item picking
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
index 7587130e021d494ae5013f7992b8f3c96590cbd7..f6d537ce0549b3359462f238c39952fe855dfbc1 100644
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -435,7 +435,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
Item item1 = item.getItem();
int count = item.getCount();
// CraftBukkit start - fire PlayerPickupItemEvent
- int canHold = entity.getInventory().canHold(item);
+ int canHold;// = entity.getInventory().canHold(item); // Luminol - Fix creative item picking
+ // Luminol start - Fix creative item picking
+ if (entity instanceof net.minecraft.server.level.ServerPlayer
+ && ((net.minecraft.server.level.ServerPlayer) entity).gameMode.getGameModeForPlayer().equals(net.minecraft.world.level.GameType.CREATIVE)) {
+ canHold = count;
+ } else {
+ canHold = entity.getInventory().canHold(item);
+ }
+ // Luminol end
int remaining = count - canHold;
boolean flyAtPlayer = false; // Paper

View File

@@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 22 Mar 2025 20:48:24 +0800
Subject: [PATCH] Use the correct list length while generating tick report
diff --git a/io/papermc/paper/threadedregions/TickData.java b/io/papermc/paper/threadedregions/TickData.java
index 0383e4dcd611a7568597f46308060f3d7288a564..f53c37d047856f1569b6f637c54ebad03c42006e 100644
--- a/io/papermc/paper/threadedregions/TickData.java
+++ b/io/papermc/paper/threadedregions/TickData.java
@@ -178,7 +178,8 @@ public final class TickData {
} else {
long totalTickTime = 0L;
long totalCpuTime = 0L;
- for (int k = 0, len2 = collapsedData.size(); k < len2; ++k) {
+ //for (int k = 0, len2 = collapsedData.size(); k < len2; ++k) {
+ for (int k = 0, len2 = toCollapse.size(); k < len2; ++k) { // Luminol - Use the correct list length
final TickRegionScheduler.TickTime time = toCollapse.get(k);
totalTickTime += time.tickLength();
totalCpuTime += time.supportCPUTime() ? time.tickCpuTime() : 0L;

View File

@@ -1,11 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 22 Mar 2025 17:36:44 +0800
From: MrHua269 <wangxyper@163.com>
Date: Sun, 12 Jan 2025 11:00:49 +0800
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 5d709b3b47702e7607dafa4a38380c801b228e2d..c2027b8d4a5f9fccacb93ba108e34c36285aec7b 100644
index 56f5568848d0f20b4d706c07dc8114594e0b5337..e62e8b9af7ad3e4454702ac86ad2b27973eba66f 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -783,8 +783,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -65,7 +66,7 @@ index 5d709b3b47702e7607dafa4a38380c801b228e2d..c2027b8d4a5f9fccacb93ba108e34c36
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) {
@@ -1744,7 +1745,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1743,7 +1744,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

View File

@@ -1,124 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sun, 23 Mar 2025 15:51:35 +0800
Subject: [PATCH] Try rewriting update queue polling
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
index 310a8f80debadd64c2d962ebf83b7d0505ce6e42..59d77f04fd0f1c7b7af0314e533b72e1858a7e21 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
@@ -151,6 +151,15 @@ public abstract class ThreadedTicketLevelPropagator {
private boolean performUpdate(final Section section, final UpdateQueue.UpdateQueueNode node, final Propagator propagator,
final ReentrantAreaLock ticketLock, final ReentrantAreaLock schedulingLock,
final List<ChunkProgressionTask> scheduledTasks, final List<NewChunkHolder> changedFullStatus) {
+ // Luminol - Try rewriting update queue polling
+ if (section == null) {
+ if (node != null) {
+ this.updateQueue.remove(node);
+ }
+ return false;
+ }
+ // Luminol end
+
final int sectionX = section.sectionX;
final int sectionZ = section.sectionZ;
@@ -334,6 +343,7 @@ public abstract class ThreadedTicketLevelPropagator {
// finished
if (node != null) {
+ node.releaseUpdating(); // Luminol - Try rewriting update queue polling
this.updateQueue.remove(node);
}
@@ -468,7 +478,8 @@ public abstract class ThreadedTicketLevelPropagator {
}
}
- public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
+ // Luminol start - Try rewriting update queue polling
+ /*public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
final List<UpdateQueueNode> blocking = new ArrayList<>();
node_search:
@@ -502,8 +513,63 @@ public abstract class ThreadedTicketLevelPropagator {
await(blocking.get(0));
}
+ return null;
+ }*/
+
+ public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
+ UpdateQueueNode firstConflict = null;
+ UpdateQueueNode prevProcessed = null;
+
+ for (UpdateQueueNode curr = this.getHeadAcquire(); curr != null && curr.order <= maxOrder; curr = curr.getNextVolatile()) {
+ if (curr.getSectionVolatile() == null) {
+ continue;
+ }
+
+ if (!curr.tryAcquireUpdating()) {
+ continue;
+ }
+
+ if (curr.getSectionVolatile() == null) {
+ curr.releaseUpdating();
+ continue;
+ }
+
+ boolean hasConflict = false;
+ for (UpdateQueueNode checked = prevProcessed; checked != null; checked = checked.getNextVolatile()) {
+ if (checked != curr && curr.intersects(checked)) {
+ hasConflict = true;
+ break;
+ }
+ }
+
+ if (hasConflict) {
+ if (firstConflict == null) {
+ firstConflict = curr;
+ }
+ curr.releaseUpdating();
+ continue;
+ }
+
+ if (firstConflict != null) {
+ this.append(firstConflict);
+ }
+
+ if (prevProcessed == null) {
+ prevProcessed = curr;
+ } else {
+ prevProcessed.setNextPlain(curr);
+ }
+
+ return curr;
+ }
+
+ if (firstConflict != null) {
+ this.append(firstConflict);
+ }
+
return null;
}
+ // Luminol end
public UpdateQueueNode peek() {
for (UpdateQueueNode head = this.getHeadOpaque(), curr = head;;) {
@@ -689,6 +755,15 @@ public abstract class ThreadedTicketLevelPropagator {
private final boolean getAndSetUpdatingVolatile(final boolean value) {
return (boolean)UPDATING_HANDLE.getAndSet(this, value);
}
+ // Luminol - Try rewriting update queue polling
+ public final boolean tryAcquireUpdating() {
+ return (boolean) UPDATING_HANDLE.compareAndSet(this, false, true);
+ }
+
+ public final void releaseUpdating() {
+ UPDATING_HANDLE.setVolatile(this, false);
+ }
+ // Luminol end
}
}

View File

@@ -3,6 +3,7 @@ From: MrHua269 <wangxyper@163.com>
Date: Tue, 11 Feb 2025 13:34:47 +0800
Subject: [PATCH] Fix uncorrected death check of folia
In the new mc version, mojang changed some checks in A.C.M(AbstractContainerMenu) and there is a new death check of player which will be executed when player dead.But on folia, player entity cannot be discarded unless they disconnected from the server, so there is an obvious bug that when player dead, the logic depend on that dead check will not be executed correctly because the check logic is still asserting the player is alive by checking if the player is discarded, which caused some exploits can save items in the crafting slots(with InventoryTweaks turned on in meteor client) when keepInventory is set to false
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
index acca8c51d2030c675c157b10d0bbc6af631afe61..d0b688e69979c5e7b8267ac96bd71bcd33444c41 100644

View File

@@ -4,26 +4,8 @@ Date: Sat, 8 Mar 2025 09:55:40 +0800
Subject: [PATCH] Fix a series issue around entity memory typed GlobalPos and
WalkTarget
Fixes the issue remained by the memory cleaning fix due to that there is a little complex relationship in these memories, and we need to manual patch them
diff --git a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..751f3dde8e6bc2c0365e8672f5079af0379a69de 100644
--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
@@ -25,6 +25,14 @@ public class BabyFollowAdult {
return false;
} else {
LivingEntity ageableMob = instance.get(nearestVisibleAdult); // CraftBukkit - type
+
+ // Luminol start - Fix off world entity following which caused async issue
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ageableMob)) {
+ nearestVisibleAdult.erase();
+ return true;
+ }
+ // Luminol end
+
if (mob.closerThan(ageableMob, followRange.getMaxValue() + 1) && !mob.closerThan(ageableMob, followRange.getMinValue())) {
// CraftBukkit start
org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(mob, ageableMob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER);
diff --git a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
index 2664d72c3b6906d0505df2e63c0e5075eba9461b..f03c3c512ea48c2a89eebae62484922d28e4f831 100644
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Fri, 2 May 2025 12:03:14 +0800
Subject: [PATCH] Fix incorrectly synced data after player teleportation
Use vanilla's flag and logics to run some status sync after post teleportation, folia forgets send some packets after teleportation and which caused some desync between client and server
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index b6df8df78105e08ca7be82524685d8b9422abf21..10e3a54f3e7aa02a5c9986d3694c02bef07a66bf 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1812,14 +1812,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.connection.send(new ClientboundChangeDifficultyPacket(
worlddata.getDifficulty(), worlddata.isDifficultyLocked()
));
- this.connection.send(new ClientboundSetExperiencePacket(
+ /*this.connection.send(new ClientboundSetExperiencePacket( // Luminol start - teleportAsync tweaks, will send in next tick, see the changes below
this.experienceProgress, this.totalExperience, this.experienceLevel
- ));
+ ));*/ // Luminol end
playerlist.sendActivePlayerEffects(this);
playerlist.sendLevelInfo(this, destination);
playerlist.sendPlayerPermissionLevel(this);
+ // Luminol start - teleportAsync tweaks
+ this.lastSentExp = -1;
+ this.lastSentHealth = -1.0F;
+ this.lastSentFood = -1;
+ // Luminol end
+
// regular world add logic
this.unsetRemoved();
destination.addDuringTeleport(this);

View File

@@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Thu, 24 Apr 2025 23:11:13 +0800
Subject: [PATCH] Fix off tickregion sync teleport
Folis's teleportAsync implementation has some checks missing during the sync teleportation checks, if we are teleport to the edge of the tickregion, it is still asserting that we are in the same tickregion and moved us directly, but there is actually some logics is already touching the stuff out of current tickregion.So we added some new edge checks to the sync teleportation checks which will check the tickregion belonging in a shape of cycle which is in min(entity's bounding box + simulate distance, 6) of radius to fix that issue
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 4026d465687604965f105ded21a8206fd52bd375..771744d4540fcd163efcde43c27111680b25c928 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4060,6 +4060,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.resetStoredPositions();
}
+ // Luminol start - Fix sync teleport issue
+ private boolean checkNearbyTickRegions(int destX, int destZ) {
+ // Dumb end gateway search the chunks in radius of 5 chunks, so we need keep 6(5+1) by default check radius
+ int sizeBx = Math.min(6, (int) (this.bb.maxX - this.bb.minX) + this.level.getCraftServer().getSimulationDistance());
+ int sizeBz = Math.min(6, (int) (this.bb.maxZ - this.bb.minZ) + this.level.getCraftServer().getSimulationDistance());
+
+ // check tick thread around these area
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level,
+ (destX >> 4) - sizeBx,
+ (destZ >> 4) - sizeBz,
+ (destX >> 4) + sizeBx,
+ (destZ >> 4) + sizeBz);
+ }
+ // Luminol end
+
protected final void transform(TeleportTransition telpeort) {
PositionMoveRotation move = PositionMoveRotation.calculateAbsolute(
PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives()
@@ -4157,7 +4172,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// check for same region
if (destination == this.level()) {
Vec3 currPos = this.position();
- if (
+ // Luminol - Prevent entity sync teleported to the edge of tickregion
+ if (this.checkNearbyTickRegions((int) pos.x, (int) pos.z) && // Luminol - Fix sync teleport issue
destination.regioniser.getRegionAtUnsynchronised(
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(currPos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(currPos)
) == destination.regioniser.getRegionAtUnsynchronised(

View File

@@ -0,0 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Mon, 27 Jan 2025 13:01:55 +0800
Subject: [PATCH] Tick regions api
diff --git a/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
index 604385af903845d966382ad0a4168798e4ed4a0e..45aa5484b1cdb317ed55f1b001dbfe13a720b2a7 100644
--- a/io/papermc/paper/threadedregions/ThreadedRegionizer.java
+++ b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
@@ -43,6 +43,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
private final RegionCallbacks<R, S> callbacks;
private final StampedLock regionLock = new StampedLock();
private Thread writeLockOwner;
+ public final me.earthme.luminol.api.ThreadedRegionizer threadedRegionizerAPI; // Luminol - Tick region API
/*
static final record Operation(String type, int chunkX, int chunkZ) {}
@@ -72,6 +73,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
this.world = world;
this.callbacks = callbacks;
//this.loadTestData();
+ this.threadedRegionizerAPI = new me.earthme.luminol.api.impl.ThreadedRegionizerImpl(this.world); // Luminol - Tick region API
}
/*
@@ -693,6 +695,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
private final ReferenceOpenHashSet<ThreadedRegion<R, S>> mergeIntoLater = new ReferenceOpenHashSet<>();
private final ReferenceOpenHashSet<ThreadedRegion<R, S>> expectingMergeFrom = new ReferenceOpenHashSet<>();
+ public final me.earthme.luminol.api.ThreadedRegion threadedRegionAPI = new me.earthme.luminol.api.impl.ThreadedRegionImpl((ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData>) this); // Luminol - Tickregion API
public ThreadedRegion(final ThreadedRegionizer<R, S> regioniser) {
this.regioniser = regioniser;
@@ -819,7 +822,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
return this.deadSections.size() == this.sectionByKey.size();
}
- private final double getDeadSectionPercent() {
+ public final double getDeadSectionPercent() { // Luminol - Threaded regions api
return (double)this.deadSections.size() / (double)this.sectionByKey.size();
}
diff --git a/io/papermc/paper/threadedregions/TickRegions.java b/io/papermc/paper/threadedregions/TickRegions.java
index 988fe74578065c9464f5639e5cc6af79619edef5..bfb39cbf1ba58d02da7e35300eb95872747506e8 100644
--- a/io/papermc/paper/threadedregions/TickRegions.java
+++ b/io/papermc/paper/threadedregions/TickRegions.java
@@ -134,6 +134,7 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
private final AtomicInteger entityCount = new AtomicInteger();
private final AtomicInteger playerCount = new AtomicInteger();
private final AtomicInteger chunkCount = new AtomicInteger();
+ public final me.earthme.luminol.api.RegionStats regionStatsAPI = new me.earthme.luminol.api.impl.RegionStatsImpl(this); // Luminol - Tickregion API
public int getEntityCount() {
return this.entityCount.get();
@@ -183,6 +184,7 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
private final RegionStats regionStats;
public volatile ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler; // Folia - profiler
+ public final me.earthme.luminol.api.TickRegionData tickRegionDataAPI = new me.earthme.luminol.api.impl.TickRegionDataImpl(this); // Luminol - Tickregion API
private TickRegionData(final ThreadedRegionizer.ThreadedRegion<TickRegionData, TickRegionSectionData> region) {
this.region = region;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Kaiiju Vanilla end portal teleportation
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 4026d465687604965f105ded21a8206fd52bd375..8ec2b94add58d64d9b83d632427923720ec74990 100644
index 771744d4540fcd163efcde43c27111680b25c928..2efc715857d49f69a8289bcf50f422960c00c8bd 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4275,14 +4275,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4291,14 +4291,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
targetPos, 16, // load 16 blocks to be safe from block physics
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
(chunks) -> {
@@ -31,7 +31,7 @@ index 4026d465687604965f105ded21a8206fd52bd375..8ec2b94add58d64d9b83d63242792372
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
)
@@ -4297,11 +4301,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4313,11 +4317,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
(chunks) -> {
BlockPos adjustedSpawn = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawnPos);
@@ -49,7 +49,7 @@ index 4026d465687604965f105ded21a8206fd52bd375..8ec2b94add58d64d9b83d63242792372
Relative.union(Relative.DELTA, Relative.ROTATION),
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
@@ -4479,6 +4487,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4495,6 +4503,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.canPortalAsync(destination, takePassengers)) {
return false;
}
@@ -60,7 +60,7 @@ index 4026d465687604965f105ded21a8206fd52bd375..8ec2b94add58d64d9b83d63242792372
Vec3 initialPosition = this.position();
ChunkPos initialPositionChunk = new ChunkPos(
@@ -4543,9 +4555,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4559,9 +4571,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Kaiiju Entity tick and removal limiter
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
index b8f1f042342d3fed5fa26df0de07e8e2b0937130..4d9837f11da4dc59fdb945fdb4849c4d1519f5dc 100644
index c6e487a4c14e6b82533881d01f32349b9ae28728..2c747cb8a724cd25c9d724908f92b320741600de 100644
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
@@ -358,6 +358,7 @@ public final class RegionizedWorldData {
@@ -354,6 +354,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

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Purpur Use alternative keep alive
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index f7f89695f40e4aff39d324e6a7948a8a3a8c04b3..bceef2e8cd9a84ca32f17085839dff0232f2ee31 100644
index 79fe336adf35f4f007461ed050e6301764fe7fc3..a5b805b98cf138eabfb06f4ff202462be60c2995 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -41,6 +41,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -16,7 +16,7 @@ index f7f89695f40e4aff39d324e6a7948a8a3a8c04b3..bceef2e8cd9a84ca32f17085839dff02
private int latency;
private volatile boolean suspendFlushingOnServerThread = false;
// CraftBukkit start
@@ -131,6 +132,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -130,6 +131,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@@ -33,7 +33,7 @@ index f7f89695f40e4aff39d324e6a7948a8a3a8c04b3..bceef2e8cd9a84ca32f17085839dff02
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int)(Util.getMillis() - this.keepAliveTime);
this.latency = (this.latency * 3 + i) / 4;
@@ -255,7 +266,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -254,7 +265,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
final long elapsedTime = millis - this.keepAliveTime;
@@ -57,7 +57,7 @@ index f7f89695f40e4aff39d324e6a7948a8a3a8c04b3..bceef2e8cd9a84ca32f17085839dff02
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
@@ -268,6 +294,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -267,6 +293,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
}
}

View File

@@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suisuroru <qwertyuiop14077@qq.com>
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Thu, 20 Feb 2025 01:00:28 +0800
Subject: [PATCH] Purpur-Barrels-and-enderchests-6-rows

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Gale Skip entity move if movement is zero
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 8ec2b94add58d64d9b83d632427923720ec74990..3ad00cc095588574218ca6d729ead119403202e0 100644
index 2efc715857d49f69a8289bcf50f422960c00c8bd..18e6e9fe39a559ae043fdafcf4e4db467144e309 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1104,7 +1104,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -23,7 +23,7 @@ index 8ec2b94add58d64d9b83d632427923720ec74990..3ad00cc095588574218ca6d729ead119
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
// Paper start - detailed watchdog information
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -5045,6 +5052,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5061,6 +5068,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB bb) {

View File

@@ -0,0 +1,216 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Wed, 30 Nov 2022 21:51:16 +0100
Subject: [PATCH] Gale Faster chunk serialization
diff --git a/net/minecraft/util/BitStorage.java b/net/minecraft/util/BitStorage.java
index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..322a1ba06d6aed44ec67dc3f1831ac6b05c82fe0 100644
--- a/net/minecraft/util/BitStorage.java
+++ b/net/minecraft/util/BitStorage.java
@@ -21,6 +21,8 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti
BitStorage copy();
+ <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out); // Gale - Lithium - faster chunk serialization
+
// Paper start - block counting
// provide default impl in case mods implement this...
@Override
diff --git a/net/minecraft/util/SimpleBitStorage.java b/net/minecraft/util/SimpleBitStorage.java
index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..2a3d34733b61c73729daa4da61f33e2c2e7b6c72 100644
--- a/net/minecraft/util/SimpleBitStorage.java
+++ b/net/minecraft/util/SimpleBitStorage.java
@@ -465,4 +465,36 @@ public class SimpleBitStorage implements BitStorage {
super(message);
}
}
+
+ // Gale start - Lithium - faster chunk serialization
+ @Override
+ public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {
+ if (this.size >= Short.MAX_VALUE) throw new IllegalStateException("Array too large");
+ if (this.size != out.length) throw new IllegalStateException("Array size mismatch");
+
+ short[] mappings = new short[(int) (this.mask + 1)];
+
+ int idx = 0;
+
+ for (long word : this.data) {
+ long bits = word;
+
+ for (int elementIdx = 0; elementIdx < this.valuesPerLong; ++elementIdx) {
+ int value = (int) (bits & this.mask);
+ int remappedId = mappings[value];
+
+ if (remappedId == 0) {
+ remappedId = dstPalette.idFor(srcPalette.valueFor(value)) + 1;
+ mappings[value] = (short) remappedId;
+ }
+
+ out[idx] = (short) (remappedId - 1);
+ bits >>= this.bits;
+
+ ++idx;
+
+ if (idx >= this.size) return;
+ }
+ }
+ } // Gale end - Lithium - faster chunk serialization
}
diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java
index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..90a85a00c6208d2db65cafb164cd95e6128b6dc4 100644
--- a/net/minecraft/util/ZeroBitStorage.java
+++ b/net/minecraft/util/ZeroBitStorage.java
@@ -19,6 +19,8 @@ public class ZeroBitStorage implements BitStorage {
return 0;
}
+ @Override public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {} // Gale - Lithium - faster chunk serialization
+
@Override
public final void set(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
//Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
diff --git a/net/minecraft/world/level/chunk/PaletteResize.java b/net/minecraft/world/level/chunk/PaletteResize.java
index c723606fa0be811e580ba47de8c9c575583cc930..60d3176477c201643e1657751fcffad511b2994f 100644
--- a/net/minecraft/world/level/chunk/PaletteResize.java
+++ b/net/minecraft/world/level/chunk/PaletteResize.java
@@ -1,5 +1,5 @@
package net.minecraft.world.level.chunk;
-interface PaletteResize<T> {
+public interface PaletteResize<T> { // Gale - Lithium - faster chunk serialization - package -> public
int onResize(int bits, T objectAdded);
}
diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java
index f5da433050fd3060e0335d4002d520ebe8cd691f..5a6e699df0a177ea6a919cad609a508678bff823 100644
--- a/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -25,6 +25,21 @@ import net.minecraft.util.ThreadingDetector;
import net.minecraft.util.ZeroBitStorage;
public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainerRO<T> {
+ // Gale start - Lithium - faster chunk serialization
+ private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]);
+ private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]);
+ private Optional<LongStream> asOptional(long[] data) {
+ return Optional.of(Arrays.stream(data));
+ }
+ private short[] getOrCreate(int size) {
+ return switch (size) {
+ case 64 -> CACHED_ARRAY_64.get();
+ case 4096 -> CACHED_ARRAY_4096.get();
+ default -> new short[size];
+ };
+ }
+ // Gale end - Lithium - faster chunk serialization
+
private static final int MIN_PALETTE_BITS = 0;
private final PaletteResize<T> dummyPaletteResize = (bits, objectAdded) -> 0;
public final IdMap<T> registry;
@@ -344,28 +359,53 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> registry, PalettedContainer.Strategy strategy) { // Paper - synchronize
this.acquire();
- PalettedContainerRO.PackedData var12;
+ // Gale start - Lithium - faster chunk serialization
+ Optional<LongStream> data = Optional.empty();
+ List<T> elements = null;
try {
- HashMapPalette<T> hashMapPalette = new HashMapPalette<>(registry, this.data.storage.getBits(), this.dummyPaletteResize);
- int size = strategy.size();
- int[] ints = new int[size];
- this.data.storage.unpack(ints);
- swapPalette(ints, id -> hashMapPalette.idFor(this.data.palette.valueFor(id)));
- int i = strategy.calculateBitsForSerialization(registry, hashMapPalette.getSize());
- Optional<LongStream> optional;
- if (i != 0) {
- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(i, size, ints);
- optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw()));
- } else {
- optional = Optional.empty();
+ // The palette that will be serialized
+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> hashPalette = null;
+
+ final Palette<T> palette = this.data.palette();
+ final BitStorage storage = this.data.storage();
+ if (storage instanceof ZeroBitStorage || palette.getSize() == 1) {
+ // If the palette only contains one entry, don't attempt to repack it.
+ elements = List.of(palette.valueFor(0));
+ } else if (palette instanceof net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
+ hashPalette = lithiumHashPalette;
}
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
+ if (elements == null) {
+ var compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize);
+ short[] array = this.getOrCreate(strategy.size());
+
+ storage.compact(this.data.palette(), compactedPalette, array);
+
+ // If the palette didn't change during compaction, do a simple copy of the data array
+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.calculateBitsForSerialization(registry, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279
+ data = this.asOptional(storage.getRaw().clone());
+ elements = hashPalette.getElements();
+ } else {
+ int bits = strategy.calculateBitsForSerialization(registry, compactedPalette.getSize());
+ if (bits != 0) {
+ // Re-pack the integer array as the palette has changed size
+ SimpleBitStorage copy = new SimpleBitStorage(bits, array.length);
+ for (int i = 0; i < array.length; ++i)
+ copy.set(i, array[i]);
+
+ // We don't need to clone the data array as we are the sole owner of it
+ data = this.asOptional(copy.getRaw());
+ }
+
+ elements = compactedPalette.getElements();
+ }
+ }
} finally {
this.release();
}
- return var12;
+ return new PalettedContainerRO.PackedData<>(elements, data);
+ // Gale end - Lithium - faster chunk serialization
}
private static <T> void swapPalette(int[] bits, IntUnaryOperator operator) {
@@ -405,13 +445,30 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@Override
public void count(PalettedContainer.CountConsumer<T> countConsumer) {
- if (this.data.palette.getSize() == 1) {
- countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
- } else {
- Int2IntOpenHashMap map = new Int2IntOpenHashMap();
- this.data.storage.getAll(id -> map.addTo(id, 1));
- map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue()));
+ // Gale start - Lithium - faster chunk serialization
+ int len = this.data.palette().getSize();
+
+ // Do not allocate huge arrays if we're using a large palette
+ if (len > 4096) {
+ // VanillaCopy
+ if (this.data.palette.getSize() == 1) {
+ countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
+ } else {
+ Int2IntOpenHashMap map = new Int2IntOpenHashMap();
+ this.data.storage.getAll(id -> map.addTo(id, 1));
+ map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue()));
+ }
+ }
+ short[] counts = new short[len];
+ this.data.storage().getAll(i -> counts[i]++);
+
+ for (int i = 0; i < counts.length; i++) {
+ T obj = this.data.palette().valueFor(i);
+
+ if (obj != null)
+ countConsumer.accept(obj, counts[i]);
}
+ // Gale end - Lithium - faster chunk serialization
}
record Configuration<T>(Palette.Factory factory, int bits) {

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Mon, 27 Jan 2025 13:01:55 +0800
Subject: [PATCH] Tick regions api
diff --git a/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
index 604385af903845d966382ad0a4168798e4ed4a0e..7ac803ba9706b65a0125b6e00983fe6a7947991a 100644
--- a/io/papermc/paper/threadedregions/ThreadedRegionizer.java
+++ b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
@@ -819,7 +819,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
return this.deadSections.size() == this.sectionByKey.size();
}
- private final double getDeadSectionPercent() {
+ public final double getDeadSectionPercent() { // Luminol - Threaded regions api
return (double)this.deadSections.size() / (double)this.sectionByKey.size();
}

View File

@@ -3,6 +3,9 @@ From: MrHua269 <wangxyper@163.com>
Date: Tue, 28 Jan 2025 18:56:53 +0800
Subject: [PATCH] Leaf Secure seed and matter seed command
Co-authored by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0049-Matter-Secure-Seed.patch and https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0050-Matter-Secure-Seed-command.patch)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/server/commands/SeedCommand.java b/net/minecraft/server/commands/SeedCommand.java
index a65affc41a4fc299bc2281f0f53f2e075633899d..f071e469468b768bd9c063d78c222b1b3e3b13bd 100644

View File

@@ -4,6 +4,9 @@ Date: Sat, 8 Mar 2025 21:14:53 +0800
Subject: [PATCH] Leaf Remove useless creating stats json bases on player name
logic
Co-authored by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0043-Remove-useless-creating-stats-json-bases-on-player-n.patch)
Licensed under: MIT
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index e5e946462da9e56344428139768075b7bd228ec0..9777a5b7ba9916e426ba87d6ee7cd56f0e43c195 100644

View File

@@ -3,9 +3,12 @@ From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 8 Mar 2025 21:20:11 +0800
Subject: [PATCH] Leaf Replace brain maps with optimized collection
Co-authored by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0070-Replace-brain-maps-with-optimized-collection.patch)
Licensed under: MIT
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index d61fba01feecce3610cd390f490d3097c5db19c4..67b71145e4feb4835a79a6007b04511a2c3b938a 100644
index 52b08be8b37117edc38dddf6d1919178b1f86271..d98eae5ee8a69a89e37751594dfff636831c8016 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -45,14 +45,14 @@ public class Brain<E extends LivingEntity> {

View File

@@ -3,6 +3,9 @@ From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 8 Mar 2025 21:21:11 +0800
Subject: [PATCH] Leaf Paper PR: Prevent zombie reinforcements loading chunks
Co-authored by: Newwind <support@newwindserver.com>
As part of: Leaf (https://github.com/Winds-Studio/Leaf/blob/ver/1.21.4/leaf-server/minecraft-patches/features/0081-Paper-PR-Prevent-zombie-reinforcements-loading-chunk.patch)
Original license: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
index cf231380febd6d316eb902d43c636135ee0d7fa4..731473610e068a613d67efaee08ded810fe86cf0 100644

View File

@@ -1,105 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Fri, 11 Apr 2025 16:53:57 +0800
Subject: [PATCH] Leaves-Revert-raid-changes
diff --git a/net/minecraft/world/effect/BadOmenMobEffect.java b/net/minecraft/world/effect/BadOmenMobEffect.java
index 80f17f33f670018240c854df589cf90cdeab6e70..8672757a4d5fb5c247599782fece6b8d7d6ec921 100644
--- a/net/minecraft/world/effect/BadOmenMobEffect.java
+++ b/net/minecraft/world/effect/BadOmenMobEffect.java
@@ -22,6 +22,11 @@ class BadOmenMobEffect extends MobEffect {
&& !serverPlayer.isSpectator()
&& level.getDifficulty() != Difficulty.PEACEFUL
&& level.isVillage(serverPlayer.blockPosition())) {
+ // Leaves start - Revert raid changes
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.trigger) {
+ return level.getRaids().createOrExtendRaid(serverPlayer, serverPlayer.blockPosition()) == null;
+ }
+ // Leaves end - Revert raid changes
Raid raidAt = level.getRaidAt(serverPlayer.blockPosition());
if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) {
serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier));
diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..84c6eb2c27510938f590f6c6baa5a94c4c08c4ad 100644
--- a/net/minecraft/world/entity/raid/Raid.java
+++ b/net/minecraft/world/entity/raid/Raid.java
@@ -674,7 +674,7 @@ public class Raid {
int i2 = this.center.getX() + Mth.floor(Mth.cos(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3);
- if (Mth.abs(height - this.center.getY()) <= 96) {
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.height_check || Mth.abs(height - this.center.getY()) <= 96) { // Disable height check
mutableBlockPos.set(i2, height, i3);
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
int i4 = 10;
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
index 7c385baae81b9a987c0e1e4deb017884600331bc..a0d86c3cc86da734a3cd10d554aaecb5c0b82e59 100644
--- a/net/minecraft/world/entity/raid/Raider.java
+++ b/net/minecraft/world/entity/raid/Raider.java
@@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster {
currentRaid.removeFromRaid(this, false);
}
+
+ // Leaves start - Revert raid changes
+ if (this.level() instanceof ServerLevel serverLevel) {
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.effect && !this.hasRaid()) {
+ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
+ net.minecraft.world.entity.player.Player entityhuman = null;
+ if (entity instanceof net.minecraft.world.entity.player.Player player) {
+ entityhuman = player;
+ } else if (entity instanceof net.minecraft.world.entity.animal.Wolf wolf) {
+ LivingEntity entityliving = wolf.getOwner();
+ if (wolf.isTame() && entityliving instanceof net.minecraft.world.entity.player.Player player) {
+ entityhuman = player;
+ }
+ }
+
+ if (entityhuman != null && !itemstack.isEmpty() && this.isCaptain()) {
+ net.minecraft.world.effect.MobEffectInstance mobeffect = entityhuman.getEffect(net.minecraft.world.effect.MobEffects.BAD_OMEN);
+ int i = 1;
+
+ if (mobeffect != null) {
+ i += mobeffect.getAmplifier();
+ entityhuman.removeEffectNoUpdate(net.minecraft.world.effect.MobEffects.BAD_OMEN);
+ } else {
+ --i;
+ }
+
+ i = net.minecraft.util.Mth.clamp(i, 0, 4);
+ net.minecraft.world.effect.MobEffectInstance mobeffect1 = new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, i, false, false, true);
+
+ if (!serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_DISABLE_RAIDS)) {
+ entityhuman.addEffect(mobeffect1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN); // CraftBukkit
+ }
+ this.setPatrolLeader(false);
+ }
+ }
+ }
+ // Leaves end - Revert raid changes
}
super.die(cause);
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
index 318f24d67be4daf6993ba547da0540be9c221a75..9a6820fce3977419fd81d802720c318ac15d07c4 100644
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
+++ b/net/minecraft/world/item/component/OminousBottleAmplifier.java
@@ -28,7 +28,7 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T
@Override
public void onConsume(Level level, LivingEntity entity, ItemStack stack, Consumable consumable) {
- entity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below
+ entity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below
}
// Paper start - properly resend entities - collect packets for bundle
@@ -40,7 +40,7 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T
@Override
public void addToTooltip(Item.TooltipContext context, Consumer<Component> tooltipAdder, TooltipFlag tooltipFlag) {
- List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true));
+ List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true));
PotionContents.addPotionTooltip(list, tooltipAdder, 1.0F, context.tickRate());
}
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add missing teleportation apis for folia
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index b17ace9118c94a756fa2901621c6b2b9bd9e5764..8a728a3af515da522cd5fab1e731bbc0607f0596 100644
index 10e3a54f3e7aa02a5c9986d3694c02bef07a66bf..ca67950e35c7f420846337e885d95b8eabca3f37 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1660,6 +1660,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1673,6 +1673,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
if (respawnComplete != null) {
respawnComplete.accept(ServerPlayer.this);
}
@@ -19,10 +19,10 @@ index b17ace9118c94a756fa2901621c6b2b9bd9e5764..8a728a3af515da522cd5fab1e731bbc0
);
});
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 3ad00cc095588574218ca6d729ead119403202e0..ccf1914b4f48ecc0f4fe980510f42d5415ec1daa 100644
index 18e6e9fe39a559ae043fdafcf4e4db467144e309..2ea6160492cb23e96271dfbfd3bd35fe03109d6a 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4160,6 +4160,31 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4175,6 +4175,31 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
// TODO any events that can modify go HERE
@@ -54,7 +54,7 @@ index 3ad00cc095588574218ca6d729ead119403202e0..ccf1914b4f48ecc0f4fe980510f42d54
// check for same region
if (destination == this.level()) {
@@ -4276,7 +4301,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4292,7 +4317,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// we just select the spawn position
case END: {
if (destination.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.END) {
@@ -74,7 +74,7 @@ index 3ad00cc095588574218ca6d729ead119403202e0..ccf1914b4f48ecc0f4fe980510f42d54
// need to load chunks so we can create the platform
destination.moonrise$loadChunksAsync(
targetPos, 16, // load 16 blocks to be safe from block physics
@@ -4301,7 +4337,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4317,7 +4353,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
);
} else {
@@ -94,7 +94,7 @@ index 3ad00cc095588574218ca6d729ead119403202e0..ccf1914b4f48ecc0f4fe980510f42d54
// need to load chunk for heightmap
destination.moonrise$loadChunksAsync(
spawnPos, 0,
@@ -4356,8 +4403,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4372,8 +4419,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
WorldBorder destinationBorder = destination.getWorldBorder();
double dimensionScale = net.minecraft.world.level.dimension.DimensionType.getTeleportationScale(origin.dimensionType(), destination.dimensionType());
@@ -114,7 +114,7 @@ index 3ad00cc095588574218ca6d729ead119403202e0..ccf1914b4f48ecc0f4fe980510f42d54
ca.spottedleaf.concurrentutil.completable.CallbackCompletable<BlockUtil.FoundRectangle> portalFound
= new ca.spottedleaf.concurrentutil.completable.CallbackCompletable<>();
@@ -4494,9 +4551,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4510,9 +4567,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.canPortalAsync(destination, takePassengers)) {
return false;
}
@@ -134,7 +134,7 @@ index 3ad00cc095588574218ca6d729ead119403202e0..ccf1914b4f48ecc0f4fe980510f42d54
// Kaiiju end
Vec3 initialPosition = this.position();
@@ -4570,6 +4636,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4586,6 +4652,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
tpComplete.accept(teleported);
}
// Kaiiju end

View File

@@ -0,0 +1,142 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sun, 27 Apr 2025 14:26:01 +0800
Subject: [PATCH] Portal Behavior Modifiers
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index d8e1febfa14be1c0f4869ae647bd17113660432b..9b8325a55889155766e034ff8847751ac551b2d2 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -1353,7 +1353,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (levelChunk != null) levelChunk.getChunkHot().startTicking(); try { // KioCG
try {
// Folia end - profiler
+ // Luminol start - Entity portal-teleport speed fix
if (isActive) { // Paper - EAR 2
+ if (!(entity instanceof Player) && entity.flag_portal && entity.flag_compensate_ticks) { // Luminol - after portal compensate tick
+ entity.tick();
+ entity.tick();
+ entity.flag_compensate_ticks = false;
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
+ return;
+ }
+ if (entity.handlePortal()) {
+ return;
+ }
+ } else if (!(entity instanceof Player) && entity.flag_portal) { // Luminol - portal teleport only
+ 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)) {
@@ -1364,6 +1383,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// portalled
return;
}
+ }
+ // Luminol end - Entity portal-teleport speed fix
// Folia end - region threading
} else {entity.inactiveTick();} // Paper - EAR 2
profilerFiller.pop();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 2ea6160492cb23e96271dfbfd3bd35fe03109d6a..97879ba5080db09dde7cd76fe7b0ba502d8df572 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -343,6 +343,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive;
public long activatedImmunityTick = Integer.MIN_VALUE;
+ // Luminol start - Entity portal-teleport speed fix
+ public boolean flag_portal = false;
+ public boolean flag_compensate_ticks = false;
+ // Luminol end - Entity portal-teleport speed fix
public void inactiveTick() {
}
@@ -3305,6 +3309,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else {
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
this.portalProcess = new PortalProcessor(portal, pos.immutable());
+ this.flag_portal = true; // Luminol - Entity portal-teleport speed fix
} else if (!this.portalProcess.isInsidePortalThisTick()) {
this.portalProcess.updateEntryPosition(pos.immutable());
this.portalProcess.setAsInsidePortalThisTick(true);
@@ -3829,20 +3834,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
EntityTreeNode curr;
while ((curr = queue.pollFirst()) != null) {
- EntityTreeNode[] passengers = curr.passengers;
+ restore(curr); // Luminol - EndGateway Portal Passengers Fix
+ }
+ }
+
+ // Luminol Start - EndGateway Portal Passengers Fix
+ private EntityTreeNode[] restore(EntityTreeNode entity) {
+ EntityTreeNode[] passengers = entity.passengers;
if (passengers == null) {
- continue;
+ return null;
}
List<Entity> newPassengers = new java.util.ArrayList<>();
for (EntityTreeNode passenger : passengers) {
+ passenger.passengers = restore(passenger);
newPassengers.add(passenger.root);
- passenger.root.vehicle = curr.root;
+ passenger.root.vehicle = entity.root;
}
-
- curr.root.passengers = ImmutableList.copyOf(newPassengers);
- }
+ entity.root.passengers = ImmutableList.copyOf(newPassengers);
+ return passengers;
}
+ // Luminol End - EndGateway Portal Passengers Fix
public void addTracker() {
for (final EntityTreeNode node : this.getFullTree()) {
@@ -4561,6 +4573,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
+ // Luminol start - Add afterPortalLogic
+ protected void afterPortalLogic() {
+ this.flag_compensate_ticks = true; // Luminol - Entity portal-teleport speed fix
+ this.flag_portal = false; // Luminol - Entity portal-teleport speed fix
+ }
+ // Luminol end - Add afterPortalLogic
+
protected boolean portalToAsync(ServerLevel destination, BlockPos portalPos, boolean takePassengers,
PortalType type, java.util.function.Consumer<Entity> teleportComplete) {
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
@@ -4644,6 +4663,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}
+ teleported.afterPortalLogic(); // Luminol - Add afterPortalLogic
+
// Kaiiju start - vanilla end teleportation
/*if (teleportComplete != null) {
teleportComplete.accept(teleported);
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 88570bb4aa02896545805d7721c45cf9599befea..f2d9ef4429b56785fd9d95abb9d734901d589828 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -251,4 +251,11 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
}
// Paper end - Option to prevent TNT from moving in water
+
+ // Luminol start - Add afterPortalLogic
+ protected void afterPortalLogic() {
+ this.setUsedPortal(true);
+ super.afterPortalLogic();
+ }
+ // Luminol end - Add afterPortalLogic
}

View File

@@ -3,6 +3,9 @@ From: adabugra <57899270+adabugra@users.noreply.github.com>
Date: Fri, 31 Jan 2025 19:17:01 +0300
Subject: [PATCH] Leaves Disable moved wrongly threshold
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/patches/removed/server/0099-Disable-moved-wrongly-threshold.patch)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a107d9ee24d0e39ce3e3e09bf27af1ea4ae35b96..225045400f152a9a8f030d6fe367764b00d99b24 100644

View File

@@ -3,6 +3,9 @@ From: MrHua269 <wangxyper@163.com>
Date: Sat, 8 Feb 2025 14:25:16 +0800
Subject: [PATCH] Leaves Fix Incorrect Collision Behavior for Block Shape
Co-authored by: Fortern <blueten.ki@gmail.com>
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-server/minecraft-patches/features/0110-Fix-Incorrect-Collision-Behavior-for-Block-Shape.patch)
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 471b6d49d77e03665ffc269d17ab46f225e3ce1c..c574f9a23868a35ef694e432ba581d2f00e39da7 100644

View File

@@ -0,0 +1,81 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:45 +0800
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-server/paper-patches/features/0016-Fix-SculkCatalyst-exp-skip.patch)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index ca67950e35c7f420846337e885d95b8eabca3f37..d9ea3db817878ff56a2772ce983ff95431e1326c 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1358,7 +1358,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
// SPIGOT-5478 must be called manually now
- if (event.shouldDropExperience()) this.dropExperience(this.serverLevel(), cause.getEntity()); // Paper - tie to event
+ if (shouldDropExperience(event.shouldDropExperience(), event.forceUseEventDropStatus())) this.dropExperience(this.serverLevel(), cause.getEntity()); // Paper - tie to event // Leaves - exp fix
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) {
// Paper start - PlayerDeathEvent#getItemsToKeep
@@ -1392,6 +1392,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setClientLoaded(false);
}
+ // Leaves start - exp fix
+ private boolean shouldDropExperience(boolean eventResult, boolean forceUseEvent) {
+ if (forceUseEvent) {
+ return eventResult;
+ }
+ return wasExperienceConsumed() ? false : eventResult;
+ }
+ // Leaves end - exp fix
+
private void tellNeutralMobsThatIDied() {
AABB aabb = new AABB(this.blockPosition()).inflate(32.0, 10.0, 32.0);
this.level()
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..658aa09aecf8d64145feedb82dc9be2a55201450 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -293,6 +293,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected float appliedScale = 1.0F;
// CraftBukkit start
public int expToDrop;
+ public int expToReward; // Leaves - exp fix
public ArrayList<DefaultDrop> drops = new ArrayList<>(); // Paper - Restore vanilla drops behavior
public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
public boolean collides = true;
@@ -1761,6 +1762,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
entity.killedEntity((ServerLevel) this.level(), this);
}
this.gameEvent(GameEvent.ENTITY_DIE);
+ if (!this.wasExperienceConsumed()) this.dropExperience((ServerLevel) this.level(), damageSource.getEntity()); // Leaves - exp fix
} else {
this.dead = false;
this.setHealth((float) deathEvent.getReviveHealth());
@@ -1835,7 +1837,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.drops = new ArrayList<>();
// this.dropEquipment(level); // CraftBukkit - moved up
// CraftBukkit end
- this.dropExperience(level, damageSource.getEntity());
+ // this.dropExperience(level, damageSource.getEntity()); // Leaves - exp fix
return deathEvent; // Paper
}
diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
index bd6693af6412fb08a28ca9a71d5c70d54f72c6e6..8c2e35d087150fb0fc67c7457a4af9298f4b41e1 100644
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
@@ -96,8 +96,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
public boolean handleGameEvent(ServerLevel level, Holder<GameEvent> gameEvent, GameEvent.Context context, Vec3 pos) {
if (gameEvent.is(GameEvent.ENTITY_DIE) && context.sourceEntity() instanceof LivingEntity livingEntity) {
if (!livingEntity.wasExperienceConsumed()) {
- DamageSource lastDamageSource = livingEntity.getLastDamageSource();
- int experienceReward = livingEntity.getExperienceReward(level, Optionull.map(lastDamageSource, DamageSource::getEntity));
+ int experienceReward = livingEntity.expToReward; // Leaves - exp fix
if (livingEntity.shouldDropExperience() && experienceReward > 0) {
this.sculkSpreader.addCursors(BlockPos.containing(pos.relative(Direction.UP, 0.5)), experienceReward);
this.tryAwardItSpreadsAdvancement(level, livingEntity);

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Wed, 5 Feb 2025 15:22:19 +0800
Subject: [PATCH] Raytracing tracker experiment
Subject: [PATCH] Add config to enable Raytracing tracker
Based on the framework of EntityCulling(((((((
@@ -19,7 +19,7 @@ index 7eff847790394aecd058e7a61905da86163b4c6e..9099457f55a2829297ac1db8a69a98ff
double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
if (rangeY != -1) {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..ceca76a5791e319dd7cc4048c9860b1df065b95a 100644
index 97879ba5080db09dde7cd76fe7b0ba502d8df572..002466add86b36529bff6787332b575d1f12305b 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -135,7 +135,7 @@ import net.minecraft.world.scores.ScoreHolder;
@@ -31,7 +31,7 @@ index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..ceca76a5791e319dd7cc4048c9860b1d
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@@ -6049,4 +6049,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -6086,4 +6086,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Paper end - Expose entity id counter
public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG

View File

@@ -0,0 +1,148 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 29 Apr 2025 23:03:56 +0800
Subject: [PATCH] Add config to enable Cross Region Damage trace
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index d9ea3db817878ff56a2772ce983ff95431e1326c..fd4e37719baced819100f7ad2d1cf0350950cb60 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1378,6 +1378,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.awardStat(Stats.ENTITY_KILLED_BY.get(killCredit.getType()));
killCredit.awardKillScore(this, cause);
this.createWitherRose(killCredit);
+ // Luminol Start - Cross Region Damage trace
+ } else if (me.earthme.luminol.config.modules.experiment.EntityDamageSourceTraceConfig.enabled) {
+ final LivingEntity entitylivingnew = this.getKillCreditOrigin();
+ if (entitylivingnew != null) {
+ this.damageTransferToAsync(entitylivingnew, cause);
+ }
+ // Luminol End - Cross Region Damage trace
}
this.level().broadcastEntityEvent(this, (byte)3);
@@ -1392,6 +1399,24 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setClientLoaded(false);
}
+ // Luminol Start - Cross Region Damage trace
+ private void damageTransferToAsync(LivingEntity entity, DamageSource cause) {
+ // Operations running on current entity
+ this.awardStat(Stats.ENTITY_KILLED_BY.get(entity.getType()));
+ this.createWitherRose(entity);
+
+ // the entity might be in another tickregion sometimes, so we need to schedule the task onto the entity
+ // to ensure thread safe
+ entity.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
+ try {
+ nmsEntity.awardKillScore(this, cause);
+ } catch (Throwable ex) {
+ LOGGER.error(ex.getMessage(), ex);
+ }
+ }, null, 1L );
+ }
+ // Luminol End - Cross Region Damage trace
+
// Leaves start - exp fix
private boolean shouldDropExperience(boolean eventResult, boolean forceUseEvent) {
if (forceUseEvent) {
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 658aa09aecf8d64145feedb82dc9be2a55201450..ccb1541e5ea0acf7ec34084a041652e2139ee724 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1181,6 +1181,29 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+ // Luminol Start - raid revert adapt Cross Region Damage trace
+ public boolean addEffect(MobEffectInstance effectInstance, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause, boolean fireEvent, boolean async) {
+ if (ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
+ return addEffect(effectInstance, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN, true);
+ } else if (me.earthme.luminol.config.modules.experiment.EntityDamageSourceTraceConfig.enabled) {
+ postToEntityThreadAddEffect(effectInstance, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN, true);
+ return true;
+ }
+ return false;
+ }
+
+ private void postToEntityThreadAddEffect(MobEffectInstance effectInstance, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause, boolean fireEvent) {
+ if (entity != null)
+ entity.getBukkitEntity().taskScheduler.schedule((Entity nmsEntity) -> {
+ try {
+ addEffect(effectInstance, nmsEntity, cause, fireEvent);
+ } catch (Throwable ex) {
+ LOGGER.error(ex.getMessage(), ex);
+ }
+ }, null, 1L );
+ }
+ // Luminol End - raid revert adapt Cross Region Damage trace
+
public boolean canBeAffected(MobEffectInstance effectInstance) {
if (this.getType().is(EntityTypeTags.IMMUNE_TO_INFESTED)) {
return !effectInstance.is(MobEffects.INFESTED);
@@ -1831,6 +1854,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
final LivingEntity entityliving = this.getKillCredit();
if (entityliving != null) {
entityliving.awardKillScore(this, damageSource);
+ // Luminol Start - Cross Region Damage trace
+ } else if (me.earthme.luminol.config.modules.experiment.EntityDamageSourceTraceConfig.enabled) {
+ final LivingEntity entitylivingnew = this.getKillCreditOrigin();
+ if (entitylivingnew != null) {
+ this.damageTransferToAsync(entitylivingnew, damageSource);
+ }
+ // Luminol End - Cross Region Damage trace
}
}); // Paper end
this.postDeathDropItems(deathEvent); // Paper
@@ -1841,6 +1871,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
return deathEvent; // Paper
}
+ // Luminol Start - Cross Region Damage trace
+ private void damageTransferToAsync(LivingEntity entity, DamageSource damageSource) {
+ entity.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
+ try {
+ nmsEntity.awardKillScore(this, damageSource);
+ } catch (Throwable ex) {
+ LOGGER.error(ex.getMessage(), ex);
+ }
+ }, null, 1L );
+ }
+ // Luminol End - Cross Region Damage trace
+
protected void dropEquipment(ServerLevel level) {
}
protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {} // Paper - method for post death logic that cannot be ran before the event is potentially cancelled
@@ -2474,6 +2516,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+ // Luminol Start - Cross Region Damage trace
+ @Nullable
+ public LivingEntity getKillCreditOrigin() {
+ if (this.lastHurtByPlayer != null) {
+ return this.lastHurtByPlayer;
+ } else if (this.lastHurtByMob != null) {
+ return this.lastHurtByMob;
+ }
+ return null;
+ }
+ // Luminol End - Cross Region Damage trace
+
public final float getMaxHealth() {
return (float)this.getAttributeValue(Attributes.MAX_HEALTH);
}
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
index 5607d2f21131510563f8fdc9079d1145483b11df..f709880a8c1064298aa133617055e7aa5cc2be5e 100644
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
+++ b/net/minecraft/world/item/component/OminousBottleAmplifier.java
@@ -28,7 +28,7 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T
@Override
public void onConsume(Level level, LivingEntity entity, ItemStack stack, Consumable consumable) {
- entity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below
+ entity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below // Luminol - Raid effect infinite
}
// Paper start - properly resend entities - collect packets for bundle

View File

@@ -0,0 +1,90 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Thu, 7 Nov 2024 21:50:47 +0100
Subject: [PATCH] Lithium: Fast util
This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java"
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/AABBMixin.java"
By: 2No2Name <2No2Name@web.de>
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java
index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..3a76b1ec8570e4c9f328e9d362b41057b092be45 100644
--- a/net/minecraft/core/Direction.java
+++ b/net/minecraft/core/Direction.java
@@ -217,7 +217,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
}
public Direction getOpposite() {
- return this.opposite; // Paper - optimise collisions
+ return VALUES[this.oppositeIndex]; // Leaf - Lithium - fast util
}
public Direction getClockWise(Direction.Axis axis) {
@@ -350,7 +350,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
}
public static Direction getRandom(RandomSource random) {
- return Util.getRandom(VALUES, random);
+ return VALUES[random.nextInt(VALUES.length)]; // Leaf - Lithium - fast util
}
public static Direction getApproximateNearest(double x, double y, double z) {
diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java
index 85148858db1fd5e9da8bbdde4b0d84110d80e373..82fb85089336f874349fa87e7cb9c14ab087ad8b 100644
--- a/net/minecraft/world/phys/AABB.java
+++ b/net/minecraft/world/phys/AABB.java
@@ -18,6 +18,15 @@ public class AABB {
public final double maxY;
public final double maxZ;
+ // Leaf start - Lithium - fast util
+ static {
+ assert Direction.Axis.X.ordinal() == 0;
+ assert Direction.Axis.Y.ordinal() == 1;
+ assert Direction.Axis.Z.ordinal() == 2;
+ assert Direction.Axis.values().length == 3;
+ }
+ // Leaf end - Lithium - fast util
+
public AABB(double x1, double y1, double z1, double x2, double y2, double z2) {
this.minX = Math.min(x1, x2);
this.minY = Math.min(y1, y2);
@@ -79,11 +88,33 @@ public class AABB {
}
public double min(Direction.Axis axis) {
- return axis.choose(this.minX, this.minY, this.minZ);
+ // Leaf start - Lithium - fast util
+ switch (axis.ordinal()) {
+ case 0: //X
+ return this.minX;
+ case 1: //Y
+ return this.minY;
+ case 2: //Z
+ return this.minZ;
+ }
+
+ throw new IllegalArgumentException();
+ // Leaf end - Lithium - fast util
}
public double max(Direction.Axis axis) {
- return axis.choose(this.maxX, this.maxY, this.maxZ);
+ // Leaf start - Lithium - fast util
+ switch (axis.ordinal()) {
+ case 0: //X
+ return this.maxX;
+ case 1: //Y
+ return this.maxY;
+ case 2: //Z
+ return this.maxZ;
+ }
+
+ throw new IllegalArgumentException();
+ // Leaf end - Lithium - fast util
}
@Override

View File

@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Fri, 8 Nov 2024 00:22:44 +0800
Subject: [PATCH] Lithium: Skip unnecessary calculations if player is not
flying or swing
This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/entity/fast_elytra_check/LivingEntityMixin.java"
* "net/caffeinemc/mods/lithium/mixin/entity/fast_hand_swing/LivingEntityMixin.java"
By: 2No2Name <2No2Name@web.de>
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index ccb1541e5ea0acf7ec34084a041652e2139ee724..4eddc407d04428516dc3607e4726d3ff58588c62 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2698,6 +2698,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void updateSwingTime() {
+ if (!this.swinging && this.swingTime == 0) return; // Leaf - Lithium - entity.fast_hand_swing
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -3623,6 +3624,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected void updateFallFlying() {
this.checkSlowFallDistance();
if (!this.level().isClientSide) {
+ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // Leaf - Lithium - entity.fast_elytra_check
if (!this.canGlide()) {
if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
this.setSharedFlag(7, false);

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 19 Apr 2025 20:38:20 +0800
Subject: [PATCH] Fully removed player teleport event and entity teleport event
call
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a107d9ee24d0e39ce3e3e09bf27af1ea4ae35b96..e786177f9e36c1dfb0cdcfc641ab2e36d42f2451 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1764,7 +1764,7 @@ public class ServerGamePacketListenerImpl
final io.papermc.paper.entity.TeleportFlag.Relative flag = org.bukkit.craftbukkit.entity.CraftPlayer.deltaRelativeToAPI(relativeArgument);
if (flag != null) relativeFlags.add(flag);
}
- PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags));
+ /*PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags)); // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
// Paper end - Teleport API
this.cserver.getPluginManager().callEvent(event);
@@ -1773,9 +1773,10 @@ public class ServerGamePacketListenerImpl
to = event.isCancelled() ? event.getFrom() : event.getTo();
posMoveRotation = new PositionMoveRotation(CraftLocation.toVec3D(to), Vec3.ZERO, to.getYaw(), to.getPitch());
}
+ */ // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
this.internalTeleport(posMoveRotation, relatives);
- return !event.isCancelled(); // CraftBukkit - Return event status
+ return true; //!event.isCancelled(); // CraftBukkit - Return event status // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
}
public void teleport(Location dest) {
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 6258b008ad3e00d41e9f3014572d6f7a06b1847c..1981f8e9e158ba7874dd3c9bde127654d56170ce 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -4226,7 +4226,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.setPos(x1, y1, z1);
if (flag) {
- if (!(this instanceof ServerPlayer)) {
+ if (!(this instanceof ServerPlayer) && false) { // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), x1, y1, z1), new Location(this.level().getWorld(), x, d, z));
this.level().getCraftServer().getPluginManager().callEvent(teleport);
if (!teleport.isCancelled() && teleport.getTo() != null) { // Paper

View File

@@ -0,0 +1,125 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Fri, 18 Apr 2025 22:04:20 +0800
Subject: [PATCH] Leaf Smart sort entities in NearestLivingEntitySensor
diff --git a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
index b0c5e41fefc7c9adf1a61bd5b52861736657d37e..b91c4aa042f6ac10e402bcf16a03d24d6dafec86 100644
--- a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
+++ b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
@@ -13,18 +13,107 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
import net.minecraft.world.phys.AABB;
public class NearestLivingEntitySensor<T extends LivingEntity> extends Sensor<T> {
+
+ // Leaf start - Optimized entity sorting with buffer reuse
+ private static final int SMALL_ARRAY_THRESHOLD = 2;
+ private final ThreadLocal<LivingEntity[]> entityBuffer = ThreadLocal.withInitial(() -> new LivingEntity[0]);
+ private final ThreadLocal<long[]> bitsBuffer = ThreadLocal.withInitial(() -> new long[0]);
+
@Override
protected void doTick(ServerLevel level, T entity) {
- double attributeValue = entity.getAttributeValue(Attributes.FOLLOW_RANGE);
- AABB aabb = entity.getBoundingBox().inflate(attributeValue, attributeValue, attributeValue);
- List<LivingEntity> entitiesOfClass = level.getEntitiesOfClass(
- LivingEntity.class, aabb, matchableEntity -> matchableEntity != entity && matchableEntity.isAlive()
+ double range = entity.getAttributeValue(Attributes.FOLLOW_RANGE);
+ double rangeSqr = range * range;
+ AABB aabb = entity.getBoundingBox().inflate(range, range, range);
+
+ List<LivingEntity> entities = level.getEntitiesOfClass(
+ LivingEntity.class, aabb, e -> e != entity && e.isAlive() && entity.distanceToSqr(e) <= rangeSqr
);
- entitiesOfClass.sort(Comparator.comparingDouble(entity::distanceToSqr));
+
+ LivingEntity[] sorted = smartSort(entities, entity);
+ List<LivingEntity> sortedList = java.util.Arrays.asList(sorted);
+
Brain<?> brain = entity.getBrain();
- brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, entitiesOfClass);
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(level, entity, entitiesOfClass));
+ brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, sortedList);
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
+ new NearestVisibleLivingEntities(level, entity, sortedList));
+ }
+
+ private LivingEntity[] smartSort(List<LivingEntity> entities, T reference) {
+ int size = entities.size();
+ if (size <= 1) return entities.toArray(new LivingEntity[0]);
+
+ LivingEntity[] entityBufferArray = this.entityBuffer.get();
+ long[] bitsBufferArray = this.bitsBuffer.get();
+ if (entityBufferArray.length < size) {
+ entityBufferArray = new LivingEntity[size];
+ entityBuffer.set(entityBufferArray);
+
+ bitsBufferArray = new long[size];
+ bitsBuffer.set(bitsBufferArray);
+ }
+
+ for (int i = 0; i < size; i++) {
+ LivingEntity e = entities.get(i);
+ entityBufferArray[i] = e;
+ bitsBufferArray[i] = Double.doubleToRawLongBits(reference.distanceToSqr(e));
+ }
+
+ fastRadixSort(entityBufferArray, bitsBufferArray, 0, size - 1, 62);
+
+ return java.util.Arrays.copyOf(entityBufferArray, size);
+ }
+
+ private void fastRadixSort(LivingEntity[] ents, long[] bits, int low, int high, int bit) {
+ if (bit < 0 || low >= high) return;
+
+ if (high - low <= SMALL_ARRAY_THRESHOLD) {
+ insertionSort(ents, bits, low, high);
+ return;
+ }
+
+ int i = low, j = high;
+ final long mask = 1L << bit;
+
+ while (i <= j) {
+ while (i <= j && (bits[i] & mask) == 0) i++;
+ while (i <= j && (bits[j] & mask) != 0) j--;
+
+ if (i < j) {
+ swap(ents, bits, i++, j--);
+ }
+ }
+
+ if (low < j) fastRadixSort(ents, bits, low, j, bit - 1);
+ if (i < high) fastRadixSort(ents, bits, i, high, bit - 1);
+ }
+
+ private void insertionSort(LivingEntity[] ents, long[] bits, int low, int high) {
+ for (int i = low + 1; i <= high; i++) {
+ int j = i;
+ LivingEntity e = ents[j];
+ long b = bits[j];
+
+ while (j > low && bits[j - 1] > b) {
+ ents[j] = ents[j - 1];
+ bits[j] = bits[j - 1];
+ j--;
+ }
+
+ ents[j] = e;
+ bits[j] = b;
+ }
+ }
+
+ private void swap(LivingEntity[] ents, long[] bits, int a, int b) {
+ LivingEntity te = ents[a];
+ ents[a] = ents[b];
+ ents[b] = te;
+
+ long tb = bits[a];
+ bits[a] = bits[b];
+ bits[b] = tb;
}
+ // Leaf end - Optimized entity sorting with buffer reuse
@Override
public Set<MemoryModuleType<?>> requires() {

View File

@@ -0,0 +1,10 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -108,6 +_,7 @@
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
+ me.earthme.luminol.config.LuminolConfig.preLoadConfig(); // Luminol - Luminol config
io.papermc.paper.plugin.PluginInitializerManager.load(optionSet); // Paper
Bootstrap.bootStrap();
Bootstrap.validate();

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -212,6 +_,8 @@
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration
+ me.earthme.luminol.config.LuminolConfig.finalizeLoadConfig(); //Luminol - load config file
+ me.earthme.luminol.config.LuminolConfig.setupLatch(); //Luminol - load config file
this.server.spark.enableEarlyIfRequested(); // Paper - spark
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
if (this.convertOldUsers()) {

View File

@@ -63,7 +63,7 @@ index 29bd788ae8bc61c1e62a4f84b9e259931a7041ce..1676ac5e6c8369836bf719f338603fbb
} else {
final Optional<String> gitBranch = build.gitBranch();
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index e741201fdbea0dbbc0e42313ebd33368014c9dc4..673a81734a0903a0790f3007772642d3d9a044cc 100644
index e741201fdbea0dbbc0e42313ebd33368014c9dc4..e3c5f4c31f084294a59830f3e764921433dd80d5 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -31,6 +31,7 @@ public record ServerBuildInfoImpl(
@@ -91,7 +91,7 @@ index e741201fdbea0dbbc0e42313ebd33368014c9dc4..673a81734a0903a0790f3007772642d3
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- return brandId.equals(this.brandId);
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Luminol
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_FOLIA_ID); // Luminol
}
@Override

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 22 Mar 2025 09:24:55 +0800
From: MrHua269 <wangxyper@163.com>
Date: Tue, 11 Feb 2025 11:57:22 +0800
Subject: [PATCH] Add tpsbar with chunkhot membar and region bar
@@ -22,10 +22,10 @@ index de8b9048c8395c05b8688bc9d984b8ad680f15b3..f42692cd4f0154705c3d5b030d281cfc
+ // KioCG end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 512ef437119041b33b62ef4675bdd1b27fd9a403..628211a282ef0553a0229b6cadacd2727d967873 100644
index ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc5e869da3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2442,6 +2442,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2401,6 +2401,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
handle.expToDrop = data.getInt("expToDrop");
handle.keepLevel = data.getBoolean("keepLevel");
}
@@ -41,7 +41,7 @@ index 512ef437119041b33b62ef4675bdd1b27fd9a403..628211a282ef0553a0229b6cadacd272
}
}
@@ -2463,6 +2472,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2422,6 +2431,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName());
@@ -57,7 +57,7 @@ index 512ef437119041b33b62ef4675bdd1b27fd9a403..628211a282ef0553a0229b6cadacd272
// Paper start - persist for use in offline save data
if (!nbttagcompound.contains("Paper")) {
nbttagcompound.put("Paper", new CompoundTag());
@@ -3672,4 +3690,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3631,4 +3649,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSimplifyContainerDesyncCheck(final boolean simplifyContainerDesyncCheck) {
this.simplifyContainerDesyncCheck = simplifyContainerDesyncCheck;
}

View File

@@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sun, 6 Apr 2025 12:51:21 +0800
Subject: [PATCH] Add feature: per virtual thread per tickregion
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
index 4efa1c057ae6cfdea7889c372bd62dc14637daa0..061492a0e172e03a0f78e4bbbec1c7010d51e207 100644
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
@@ -18,6 +18,9 @@ import org.slf4j.LoggerFactory;
import java.util.concurrent.atomic.AtomicInteger;
public class TickThread extends Thread {
+ // Luminol start - Bypass virtual threads
+ public static final java.util.Set<Thread> VIRTUAL_TICK_THREAD_GROUP = java.util.Collections.newSetFromMap(it.unimi.dsi.fastutil.objects.Reference2ObjectMaps.synchronize(new it.unimi.dsi.fastutil.objects.Reference2ObjectLinkedOpenHashMap<>()));
+ // Luminol end
private static final Logger LOGGER = LoggerFactory.getLogger(TickThread.class);
@@ -138,12 +141,13 @@ public class TickThread extends Thread {
this.id = id;
}
+ @Deprecated // Luminol
public static TickThread getCurrentTickThread() {
return (TickThread)Thread.currentThread();
}
public static boolean isTickThread() {
- return Thread.currentThread() instanceof TickThread;
+ return Thread.currentThread() instanceof TickThread || VIRTUAL_TICK_THREAD_GROUP.contains(Thread.currentThread()); // Luminol - Bypass some virtual threads
}
public static boolean isShutdownThread() {

View File

@@ -18,7 +18,7 @@ index a0b84535a9d3833d4df692b85b272f145559dd80..c2ba46408b5ad727d7a17f21d47b2898
return;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1a1d44c2aa89d8c7f9ec431b5b04d4c6e93a9d55..98d7542ead38ce48886c8f8dfe9a89f963d0c3fd 100644
index ae7ee8c67a71b0bc319d8079094b1806fc3e305a..07e59bbfa94103d610ec63e695e51a961cd6eec5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -314,7 +314,7 @@ public final class CraftServer implements Server {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] SparklyPaper Optimize canSee checks
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 628211a282ef0553a0229b6cadacd2727d967873..583c2acc6d620b4411c65c2b285d323d7c9c1b98 100644
index af20bc3b9cfb056beca0a341e209a4cc5e869da3..91dd18a874ea83bed83983ecfa52decce2b163a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -210,7 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -17,7 +17,7 @@ index 628211a282ef0553a0229b6cadacd2727d967873..583c2acc6d620b4411c65c2b285d323d
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
private int hash = 0;
@@ -2306,9 +2306,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2265,9 +2265,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {

View File

@@ -23,7 +23,7 @@ index f42692cd4f0154705c3d5b030d281cfc333803ed..39cc976f65f826a00e2e637c139f9134
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 98d7542ead38ce48886c8f8dfe9a89f963d0c3fd..4cf38c929e6ccce7f25ed842d65e41913d49ccf6 100644
index 07e59bbfa94103d610ec63e695e51a961cd6eec5..9c7a5d0a94417a65788330b7239aa746006407fa 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1423,7 +1423,11 @@ public final class CraftServer implements Server {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Tick regions api
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index cd6e46fa68c009deb8dfebcecb88e058dfede0b0..ac4ab407095d998b1418d740ab54e8157bce6a02 100644
index cd6e46fa68c009deb8dfebcecb88e058dfede0b0..f0c8e76efaf897a81283edbf9a9c2a71bc28c9a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2517,4 +2517,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -16,7 +16,7 @@ index cd6e46fa68c009deb8dfebcecb88e058dfede0b0..ac4ab407095d998b1418d740ab54e815
+ // Luminol start - Tick regions api
+ @Override
+ public me.earthme.luminol.api.ThreadedRegionizer getThreadedRegionizer() {
+ return new me.earthme.luminol.api.impl.ThreadedRegionizerImpl(this.world);
+ return this.world.regioniser.threadedRegionizerAPI;
+ }
+ // Luminol end
}

View File

@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:46 +0800
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index bef7a026676ab59a84fc33c8af50ad2b9447fd8c..0a678458bcee4ced98d2880821dbff302f59b7f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -991,7 +991,7 @@ public class CraftEventFactory {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
CraftWorld world = (CraftWorld) entity.getWorld();
- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior
+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity()), victim.getExperienceReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior // Leaves - exp fix
populateFields(victim, event); // Paper - make cancellable
Bukkit.getServer().getPluginManager().callEvent(event);
@@ -1002,6 +1002,7 @@ public class CraftEventFactory {
playDeathSound(victim, event);
// Paper end
victim.expToDrop = event.getDroppedExp();
+ victim.expToReward = event.getRewardExp(); // Leaves - exp fix
lootCheck.run(); // Paper - advancement triggers before destroying items
// Paper start - Restore vanilla drops behavior
@@ -1037,6 +1038,7 @@ public class CraftEventFactory {
victim.newLevel = event.getNewLevel();
victim.newTotalExp = event.getNewTotalExp();
victim.expToDrop = event.getDroppedExp();
+ victim.expToReward = event.getRewardExp(); // Leaves - exp fix
victim.newExp = event.getNewExp();
// Paper start - Restore vanilla drops behavior

View File

@@ -1,6 +1,6 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/api/impl/ThreadedRegionImpl.java
@@ -1,0 +_,47 @@
@@ -1,0 +_,52 @@
+package me.earthme.luminol.api.impl;
+
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
@@ -39,7 +39,7 @@
+
+ @Override
+ public TickRegionData getTickRegionData() {
+ return new TickRegionDataImpl(this.internal.getData());
+ return this.internal.getData().tickRegionDataAPI;
+ }
+
+ @Nullable
@@ -47,4 +47,9 @@
+ public World getWorld() {
+ return this.internal.regioniser.world.getWorld();
+ }
+
+ @Override
+ public long getId() {
+ return this.internal.id;
+ }
+}

View File

@@ -40,7 +40,7 @@
+ return null;
+ }
+
+ return new ThreadedRegionImpl(got);
+ return got.threadedRegionAPI;
+ }
+
+ @Override
@@ -51,6 +51,6 @@
+ return null;
+ }
+
+ return new ThreadedRegionImpl(got);
+ return got.threadedRegionAPI;
+ }
+}

Some files were not shown because too many files have changed in this diff Show More