Compare commits

..

83 Commits

Author SHA1 Message Date
MrHua269
5b6d1ee061 Tidy patches & rename RemovedConfig to TransferringConfig 2025-05-18 08:38:45 +08:00
M2ke4U
1eba4e1a05 Merge pull request #101 from Suisuroru/ss/RemovedConfig
add RemovedConfig interface for Config-update
2025-05-18 08:15:09 +08:00
Helvetica Volubi
741b00c9be fix: fix an error in platform generate 2025-05-18 05:10:26 +08:00
Helvetica Volubi
3e73f9f9cb feat: new tripwire behavior modifier 2025-05-18 04:42:35 +08:00
Helvetica Volubi
b1e3a300a2 feat: RemovedConfig config tag 2025-05-18 03:20:35 +08:00
Helvetica Volubi
c12bf7b06c fix: fix a bug in patch [prevent tripwire dupe in end platform generate] 2025-05-17 20:56:45 +08:00
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
71 changed files with 1000 additions and 273 deletions

View File

@@ -15,43 +15,50 @@ 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: Setup environment variables
if: github.event_name != 'pull_request'
run: |
export PRIVATE_MAVEN_REPO_LINK=${{ secrets.PRIVATE_MAVEN_REPO_LINK }}
export PRIVATE_MAVEN_REPO_PASSWORD=${{ secrets.PRIVATE_MAVEN_REPO_PASSWORD }}
export PRIVATE_MAVEN_REPO_USERNAME=${{ secrets.PRIVATE_MAVEN_REPO_USERNAME }}
- 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: |
./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 }}

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,21 +81,16 @@ subprojects {
extensions.configure<PublishingExtension> {
repositories {
val privateMvnRepoLink = System.getenv("PRIVATE_MAVEN_REPO_LINK")
val privateMvnRepoUsername = System.getenv("PRIVATE_MAVEN_REPO_USERNAME")
val privateMvnRepoPassword = System.getenv("PRIVATE_MAVEN_REPO_PASSWORD")
if (privateMvnRepoLink != null && privateMvnRepoUsername != null && privateMvnRepoPassword != null) {
maven(privateMvnRepoLink) {
name = "LuminolMC-Private"
credentials {
username = privateMvnRepoUsername
password = privateMvnRepoPassword
}
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 {

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

@@ -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

View File

@@ -1,88 +0,0 @@
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] 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
}
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index ab7584873e46020148bceecbd42a43055684e6a0..7c99b1c6f5fc8e4ce442d111e7598ddb89d6ee05 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

@@ -0,0 +1,38 @@
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

@@ -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

@@ -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,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

@@ -0,0 +1,126 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sun, 18 May 2025 03:48:53 +0800
Subject: [PATCH] Add config to modify tripwire behavior
diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java
index 9aace993c6c18f1a50610e4766225485984b8167..419c1c7e14691a472b70ed548ecb928cb289b939 100644
--- a/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -214,10 +214,18 @@ public class TripWireHookBlock extends Block {
BlockPos blockPos1 = pos.relative(direction, i2);
BlockState blockState2 = blockStates[i2];
if (blockState2 != null) {
- BlockState blockState3 = level.getBlockState(blockPos1);
- if (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
+ // Luminol start - tripwire and tripwireHook dupe
+ if (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
+ level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3);
+ level.getBlockState(blockPos1);
+ } else {
+ BlockState blockState3 = level.getBlockState(blockPos1);
+ if (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
+ }
}
+ // Luminol end - tripwire and tripwireHook dupe
}
}
}
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
index f96fc1391167dea48cac1caa464b9026657df89a..eb869e574cee0d206684d5585c664a5f1d01ab65 100644
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
@@ -27,15 +27,43 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
// CraftBukkit end
BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
+ // Luminol start - tripwire behavior modifier
+ java.util.List<BlockPos> blockList1 = new java.util.ArrayList<>();
+ java.util.List<BlockPos> blockList2 = new java.util.ArrayList<>();
+ boolean flag21 = !java.util.Objects.equals(me.earthme.luminol.config.modules.misc.AllowTripwireDupe.behaviorMode, "VANILLA20")
+ && !java.util.Objects.equals(me.earthme.luminol.config.modules.misc.AllowTripwireDupe.behaviorMode, "MIXED");
for (int i = -2; i <= 2; i++) {
for (int i1 = -2; i1 <= 2; i1++) {
for (int i2 = -1; i2 < 3; i2++) {
BlockPos blockPos = mutableBlockPos.set(pos).move(i1, i2, i);
Block block = i2 == -1 ? Blocks.OBSIDIAN : Blocks.AIR;
- // CraftBukkit start
if (!blockList.getBlockState(blockPos).is(block)) {
if (dropBlocks) {
- blockList.destroyBlock(blockPos, true, null);
+ boolean flag = false;
+ if (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
+ switch (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.behaviorMode) {
+ case "VANILLA20": {
+ flag = true;
+ }
+ case "MIXED": {
+ 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);
+ }
+ }
+ }
+ default: {
+
+ } // Luminol - 1.21 Logic - default empty
+ }
+ }
+ if (flag) blockList1.add(blockPos.immutable());
+ else blockList.destroyBlock(blockPos, true, null);
}
blockList.setBlock(blockPos, block.defaultBlockState(), 3);
@@ -54,11 +82,39 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
if (portalEvent.isCancelled()) return;
}
- // SPIGOT-7856: End platform not dropping items after replacing blocks
- if (dropBlocks) {
- blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null));
+ if (flag21 && !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
+ // Luminol start - When updated replace it with newer code
+ if (dropBlocks) {
+ java.util.function.Consumer<? super org.bukkit.craftbukkit.block.CraftBlockState> beforeRun = state -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null);
+ java.util.function.Predicate<? super org.bukkit.block.BlockState> filter = $ -> true;
+ for (org.bukkit.craftbukkit.block.CraftBlockState state : blockList.getList()) {
+ if (filter.test(state)) {
+ beforeRun.accept(state);
+ if (state.isPlaced()) {
+ state.getWorldHandle().setBlock(state.getPosition(), state.getHandle(), state.getFlag());
+ }
+ }
+ }
+ } else {
+ blockList.updateList();
+ }
+ // Luminol end - When updated replace it with newer code
+ } else {
+ // SPIGOT-7856: End platform not dropping items after replacing blocks
+ if (dropBlocks) {
+ blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null)); // Luminol - prevent tripwire dupe in end platform generate
+ }
+ blockList.updateList();
}
- blockList.updateList();
// CraftBukkit end
}
+
+ 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 - tripwire behavior modifier
}

View File

@@ -114,7 +114,7 @@ index cfb37f2e428605965a37dc1eb83f302fe1bd6299..8f7b28e5688252207ad8ce9f3fb6f9c3
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 330af9f4de1c72387326816065350e71fe546efe..e62e8b9af7ad3e4454702ac86ad2b27973eba66f 100644
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

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,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

@@ -3,9 +3,10 @@ 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 ed00a29daccfee1d631bef27c0a3a4ae83140018..330af9f4de1c72387326816065350e71fe546efe 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

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,6 +4,7 @@ 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/BehaviorUtils.java b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
index 2664d72c3b6906d0505df2e63c0e5075eba9461b..f03c3c512ea48c2a89eebae62484922d28e4f831 100644

View File

@@ -3,6 +3,7 @@ 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

View File

@@ -3,12 +3,13 @@ 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 ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..2ea6160492cb23e96271dfbfd3bd35fe03109d6a 100644
index 4026d465687604965f105ded21a8206fd52bd375..771744d4540fcd163efcde43c27111680b25c928 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4067,6 +4067,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4060,6 +4060,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.resetStoredPositions();
}
@@ -30,7 +31,7 @@ index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..2ea6160492cb23e96271dfbfd3bd35fe
protected final void transform(TeleportTransition telpeort) {
PositionMoveRotation move = PositionMoveRotation.calculateAbsolute(
PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives()
@@ -4189,7 +4204,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4157,7 +4172,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// check for same region
if (destination == this.level()) {
Vec3 currPos = this.position();

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

@@ -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

@@ -19,10 +19,10 @@ index 10e3a54f3e7aa02a5c9986d3694c02bef07a66bf..ca67950e35c7f420846337e885d95b8e
);
});
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

@@ -4,20 +4,70 @@ 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..2871980e53a66bdacf7c00e7045ad01d68a972d3 100644
index 2ea6160492cb23e96271dfbfd3bd35fe03109d6a..97879ba5080db09dde7cd76fe7b0ba502d8df572 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -3304,7 +3304,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPortalCooldown();
@@ -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.portalProcess = new PortalProcessor(portal, pos.immutable(), this.getDeltaMovement()); // Luminol - Entity portal-teleport speed fix
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 +3829,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3829,20 +3834,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
EntityTreeNode curr;
while ((curr = queue.pollFirst()) != null) {
@@ -51,20 +101,21 @@ index 2ea6160492cb23e96271dfbfd3bd35fe03109d6a..2871980e53a66bdacf7c00e7045ad01d
public void addTracker() {
for (final EntityTreeNode node : this.getFullTree()) {
@@ -4561,6 +4568,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -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 +4657,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4644,6 +4663,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}
@@ -73,48 +124,11 @@ index 2ea6160492cb23e96271dfbfd3bd35fe03109d6a..2871980e53a66bdacf7c00e7045ad01d
// Kaiiju start - vanilla end teleportation
/*if (teleportComplete != null) {
teleportComplete.accept(teleported);
diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java
index 46d989aef0eceebd98bfd93999153319de77a8a0..6e9171fa0c636439bd96401ea9e5fe80ffdc8bdd 100644
--- a/net/minecraft/world/entity/PortalProcessor.java
+++ b/net/minecraft/world/entity/PortalProcessor.java
@@ -9,12 +9,14 @@ import net.minecraft.world.level.portal.TeleportTransition;
public class PortalProcessor {
private final Portal portal;
private BlockPos entryPosition;
+ private net.minecraft.world.phys.Vec3 speedVec3; // Luminol - Entity portal-teleport speed fix
private int portalTime;
private boolean insidePortalThisTick;
- public PortalProcessor(Portal portal, BlockPos entryPosition) {
+ public PortalProcessor(Portal portal, BlockPos entryPosition, net.minecraft.world.phys.Vec3 speedVec3) { // Luminol - Entity portal-teleport speed fix
this.portal = portal;
this.entryPosition = entryPosition;
+ this.speedVec3 = speedVec3; // Luminol - Entity portal-teleport speed fix
this.insidePortalThisTick = true;
}
@@ -35,7 +37,15 @@ public class PortalProcessor {
// Folia start - region threading
public boolean portalAsync(ServerLevel sourceWorld, Entity portalTarget) {
- return this.portal.portalAsync(sourceWorld, portalTarget, this.entryPosition);
+ // Luminol start - Entity portal-teleport speed fix
+ net.minecraft.world.phys.Vec3 oldSpeed = portalTarget.getDeltaMovement();
+ portalTarget.setDeltaMovement(this.speedVec3);
+ boolean flag = this.portal.portalAsync(sourceWorld, portalTarget, this.entryPosition);
+ if (!flag) {
+ portalTarget.setDeltaMovement(oldSpeed);
+ }
+ return flag;
+ // Luminol end - Entity portal-teleport speed fix
}
// Folia end - region threading
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 88570bb4aa02896545805d7721c45cf9599befea..bbf9748a36404139356db606dbb3b0cc13c66b50 100644
index 88570bb4aa02896545805d7721c45cf9599befea..f2d9ef4429b56785fd9d95abb9d734901d589828 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -251,4 +251,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -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
@@ -122,6 +136,7 @@ index 88570bb4aa02896545805d7721c45cf9599befea..bbf9748a36404139356db606dbb3b0cc
+ // Luminol start - Add afterPortalLogic
+ protected void afterPortalLogic() {
+ this.setUsedPortal(true);
+ super.afterPortalLogic();
+ }
+ // Luminol start - Add 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

@@ -3,6 +3,9 @@ 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

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 2871980e53a66bdacf7c00e7045ad01d68a972d3..2005f769d21de40621beb913446e816b87a03c3a 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 2871980e53a66bdacf7c00e7045ad01d68a972d3..2005f769d21de40621beb913446e816b
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@@ -6080,4 +6080,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

@@ -1,7 +1,7 @@
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] Cross Region Damage trace
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
@@ -48,7 +48,7 @@ index d9ea3db817878ff56a2772ce983ff95431e1326c..fd4e37719baced819100f7ad2d1cf035
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 1df158d30622ea71fcc937140c682d0e994d54c1..4eddc407d04428516dc3607e4726d3ff58588c62 100644
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 {

View File

@@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kidofcubes <kidofcubes@gmail.com>
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
@@ -12,10 +12,10 @@ 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 658aa09aecf8d64145feedb82dc9be2a55201450..1df158d30622ea71fcc937140c682d0e994d54c1 100644
index ccb1541e5ea0acf7ec34084a041652e2139ee724..4eddc407d04428516dc3607e4726d3ff58588c62 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2644,6 +2644,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2698,6 +2698,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void updateSwingTime() {
@@ -23,7 +23,7 @@ index 658aa09aecf8d64145feedb82dc9be2a55201450..1df158d30622ea71fcc937140c682d0e
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -3569,6 +3570,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3623,6 +3624,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected void updateFallFlying() {
this.checkSlowFallDistance();
if (!this.level().isClientSide) {

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

@@ -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

@@ -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;
+ }
+}

View File

@@ -27,7 +27,7 @@
+
+ @Override
+ public RegionStats getRegionStats() {
+ return new RegionStatsImpl(this.internal.getRegionStats());
+ return this.internal.getRegionStats().regionStatsAPI;
+ }
+
+}

View File

@@ -0,0 +1,10 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/BasicTransferLogic.java
@@ -1,0 +_,7 @@
+package me.earthme.luminol.config;
+
+public class BasicTransferLogic {
+ public Object transform(Object obj) {
+ return obj;
+ }
+}

View File

@@ -1,8 +1,9 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
@@ -1,0 +_,226 @@
@@ -1,0 +_,268 @@
+package me.earthme.luminol.config;
+
+import com.electronwill.nightconfig.core.UnmodifiableConfig;
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
+import io.papermc.paper.threadedregions.RegionizedServer;
+import me.earthme.luminol.commands.LuminolConfigCommand;
@@ -128,6 +129,33 @@
+ final Object currentValue = field.get(null);
+
+ if (!configFileInstance.contains(fullConfigKeyName)){
+ for (TransferringConfig transferringConfig : field.getAnnotationsByType(TransferringConfig.class)) {
+ final String oldConfigKeyName = String.join(".", transferringConfig.category()) + "." + transferringConfig.name();
+ Object oldValue = configFileInstance.get(oldConfigKeyName);
+ if (oldValue != null) {
+ boolean success = true;
+ if (transferringConfig.transfer()) {
+ try {
+ Object oldValueTransferred = ((BasicTransferLogic) transferringConfig.transferLogic().getDeclaredConstructor().newInstance()).transform(oldValue);
+ configFileInstance.add(fullConfigKeyName, oldValueTransferred);
+ } catch (Exception e) {
+ success = false;
+ logger.error("Failed to transfer removed config {}!", transferringConfig.name());
+ }
+ }
+
+ if (success) {
+ removeConfig(oldConfigKeyName, transferringConfig.category());
+ }
+ final String comments = configInfo.comments();
+
+ if (!comments.isBlank()){
+ configFileInstance.setComment(fullConfigKeyName,comments);
+ }
+ if (configFileInstance.get(fullConfigKeyName) != null) break;
+ }
+ }
+ if (configFileInstance.get(fullConfigKeyName) != null) continue;
+ if (currentValue == null){
+ throw new UnsupportedOperationException("Config " + singleConfigModule.getBaseName() + "tried to add an null default value!");
+ }
@@ -148,6 +176,20 @@
+ }
+ }
+
+ public static void removeConfig(String name,String[] keys) {
+ configFileInstance.remove(name);
+ if (configFileInstance.get(String.join(".", keys)) instanceof UnmodifiableConfig) {
+ removeConfig(keys);
+ }
+ }
+
+ public static void removeConfig(String[] keys) {
+ configFileInstance.remove(String.join(".", keys));
+ if (configFileInstance.get(String.join(".", Arrays.copyOfRange(keys, 1, keys.length))) instanceof UnmodifiableConfig) {
+ removeConfig(Arrays.copyOfRange(keys, 1, keys.length));
+ }
+ }
+
+ public static @NotNull Set<Class<?>> getClasses(String pack) {
+ Set<Class<?>> classes = new LinkedHashSet<>();
+ String packageDirName = pack.replace('.', '/');

View File

@@ -0,0 +1,23 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/TransferringConfig.java
@@ -1,0 +_,20 @@
+package me.earthme.luminol.config;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(TransferringConfig.List.class)
+public @interface TransferringConfig {
+ String name() default "";
+
+ String[] category() default "";
+
+ boolean transfer() default true;
+
+ Class<?> transferLogic() default BasicTransferLogic.class;
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface List {
+ TransferringConfig[] value();
+ }
+}

View File

@@ -1,7 +1,7 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/ForceCleanupEntityBrainMemoryConfig.java
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/ForceCleanupEntityBrainMemoryConfig.java
@@ -1,0 +_,22 @@
+package me.earthme.luminol.config.modules.experiment;
+package me.earthme.luminol.config.modules.fixes;
+
+import me.earthme.luminol.config.ConfigInfo;
+import me.earthme.luminol.config.EnumConfigCategory;

View File

@@ -1,6 +1,6 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/AllowTripwireDupe.java
@@ -1,0 +_,20 @@
@@ -1,0 +_,27 @@
+package me.earthme.luminol.config.modules.misc;
+
+import me.earthme.luminol.config.ConfigInfo;
@@ -10,6 +10,13 @@
+public class AllowTripwireDupe implements IConfigModule {
+ @ConfigInfo(baseName = "enabled")
+ public static boolean enabled = false;
+ @ConfigInfo(baseName = "behavior-mode", comments =
+ """
+ Allowed Value:
+ VANILLA20
+ VANILLA21
+ MIXED""")
+ public static String behaviorMode = "VANILLA21";
+
+ @Override
+ public EnumConfigCategory getCategory() {

View File

@@ -0,0 +1,212 @@
--- /dev/null
+++ b/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java
@@ -1,0 +_,209 @@
+// Lithium - faster chunk serialization
+
+package net.caffeinemc.mods.lithium.common.world.chunk;
+
+import it.unimi.dsi.fastutil.HashCommon;
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
+import net.minecraft.CrashReport;
+import net.minecraft.CrashReportCategory;
+import net.minecraft.ReportedException;
+import net.minecraft.core.IdMap;
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.VarInt;
+import net.minecraft.world.level.chunk.MissingPaletteEntryException;
+import net.minecraft.world.level.chunk.Palette;
+import net.minecraft.world.level.chunk.PaletteResize;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Predicate;
+
+import static it.unimi.dsi.fastutil.Hash.FAST_LOAD_FACTOR;
+
+/**
+ * Generally provides better performance over the vanilla {@link net.minecraft.world.level.chunk.HashMapPalette} when calling
+ * {@link LithiumHashPalette#idFor(Object)} through using a faster backing map and reducing pointer chasing.
+ */
+public class LithiumHashPalette<T> implements Palette<T> {
+ private static final int ABSENT_VALUE = -1;
+
+ private final IdMap<T> idList;
+ private final PaletteResize<T> resizeHandler;
+ private final int indexBits;
+
+ private final Reference2IntOpenHashMap<T> table;
+ private T[] entries;
+ private int size = 0;
+
+ private LithiumHashPalette(IdMap<T> idList, PaletteResize<T> resizeHandler, int indexBits, T[] entries, Reference2IntOpenHashMap<T> table, int size) {
+ this.idList = idList;
+ this.resizeHandler = resizeHandler;
+ this.indexBits = indexBits;
+ this.entries = entries;
+ this.table = table;
+ this.size = size;
+ }
+
+ public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler, List<T> list) {
+ this(idList, bits, resizeHandler);
+
+ for (T t : list) {
+ this.addEntry(t);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler) {
+ this.idList = idList;
+ this.indexBits = bits;
+ this.resizeHandler = resizeHandler;
+
+ int capacity = 1 << bits;
+
+ this.entries = (T[]) new Object[capacity];
+ this.table = new Reference2IntOpenHashMap<>(capacity, FAST_LOAD_FACTOR);
+ this.table.defaultReturnValue(ABSENT_VALUE);
+ }
+
+ @Override
+ public int idFor(@NotNull T obj) {
+ int id = this.table.getInt(obj);
+
+ if (id == ABSENT_VALUE) {
+ id = this.computeEntry(obj);
+ }
+
+ return id;
+ }
+
+ @Override
+ public boolean maybeHas(@NotNull Predicate<T> predicate) {
+ for (int i = 0; i < this.size; ++i) {
+ if (predicate.test(this.entries[i])) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private int computeEntry(T obj) {
+ int id = this.addEntry(obj);
+
+ if (id >= 1 << this.indexBits) {
+ if (this.resizeHandler == null) {
+ throw new IllegalStateException("Cannot grow");
+ } else {
+ id = this.resizeHandler.onResize(this.indexBits + 1, obj);
+ }
+ }
+
+ return id;
+ }
+
+ private int addEntry(T obj) {
+ int nextId = this.size;
+
+ if (nextId >= this.entries.length) {
+ this.resize(this.size);
+ }
+
+ this.table.put(obj, nextId);
+ this.entries[nextId] = obj;
+
+ this.size++;
+
+ return nextId;
+ }
+
+ private void resize(int neededCapacity) {
+ this.entries = Arrays.copyOf(this.entries, HashCommon.nextPowerOfTwo(neededCapacity + 1));
+ }
+
+ @Override
+ public @NotNull T valueFor(int id) {
+ T[] entries = this.entries;
+
+ T entry = null;
+ if (id >= 0 && id < entries.length) {
+ entry = entries[id];
+ }
+
+ if (entry != null) {
+ return entry;
+ } else {
+ throw this.missingPaletteEntryCrash(id);
+ }
+ }
+
+ private ReportedException missingPaletteEntryCrash(int id) {
+ try {
+ throw new MissingPaletteEntryException(id);
+ } catch (MissingPaletteEntryException e) {
+ CrashReport crashReport = CrashReport.forThrowable(e, "[Lithium] Getting Palette Entry");
+ CrashReportCategory crashReportCategory = crashReport.addCategory("Chunk section");
+ crashReportCategory.setDetail("IndexBits", this.indexBits);
+ crashReportCategory.setDetail("Entries", this.entries.length + " Elements: " + Arrays.toString(this.entries));
+ crashReportCategory.setDetail("Table", this.table.size() + " Elements: " + this.table);
+ return new ReportedException(crashReport);
+ }
+ }
+
+ @Override
+ public void read(FriendlyByteBuf buf) {
+ this.clear();
+
+ int entryCount = buf.readVarInt();
+
+ for (int i = 0; i < entryCount; ++i) {
+ this.addEntry(this.idList.byIdOrThrow(buf.readVarInt()));
+ }
+ }
+
+ @Override
+ public void write(FriendlyByteBuf buf) {
+ int size = this.size;
+ buf.writeVarInt(size);
+
+ for (int i = 0; i < size; ++i) {
+ buf.writeVarInt(this.idList.getId(this.valueFor(i)));
+ }
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = VarInt.getByteSize(this.size);
+
+ for (int i = 0; i < this.size; ++i) {
+ size += VarInt.getByteSize(this.idList.getId(this.valueFor(i)));
+ }
+
+ return size;
+ }
+
+ @Override
+ public int getSize() {
+ return this.size;
+ }
+
+ @Override
+ public @NotNull Palette<T> copy(@NotNull PaletteResize<T> resizeHandler) {
+ return new LithiumHashPalette<>(this.idList, resizeHandler, this.indexBits, this.entries.clone(), this.table.clone(), this.size);
+ }
+
+ private void clear() {
+ Arrays.fill(this.entries, null);
+ this.table.clear();
+ this.size = 0;
+ }
+
+ public List<T> getElements() {
+ T[] copy = Arrays.copyOf(this.entries, this.size);
+ return Arrays.asList(copy);
+ }
+
+ public static <A> Palette<A> create(int bits, IdMap<A> idList, PaletteResize<A> listener, List<A> list) {
+ return new LithiumHashPalette<>(idList, bits, listener, list);
+ }
+}