Compare commits

..

35 Commits

Author SHA1 Message Date
Bacteriawa
e171f5a4d6 Add Lithium: fast util & Lithium: Skip unnecessary calculations if player is not flying or swing 2025-04-23 00:37:39 +08:00
M2ke4U
f132d2e6c8 Merge pull request #81 from Suisuroru/ss/removemodule-0024
remove: remove patch 0024
2025-04-21 22:51:45 +08:00
Helvetica Volubi
685d7c664d remove: remove 0024 2025-04-21 22:50:31 +08:00
Helvetica Volubi
c65c52ae1f Prefer Leaves#455 to luminol (#77)
* feat: prefer Leaves#452 to luminol

* feat: rename Files

* rename: fixup a file name
2025-04-21 21:13:35 +08:00
Bacteriawa
23628b6d77 Updated Upstream (Folia) 2025-04-21 12:31:49 +08:00
Klop233
5ef91f2a8e Merge pull request #76 from Suisuroru/dev/1.21.4-hardfork-raid-fix-250419
Raid revert | MC-274911
2025-04-20 16:35:40 +08:00
Helvetica Volubi
458fc481f1 feat: rewrite MC-274911 revert (tick-mode) 2025-04-20 15:53:44 +08:00
Helvetica Volubi
0341ddcc54 feat: try revert MC-274911 2025-04-20 12:07:40 +08:00
Helvetica Volubi
16cc1038fe tip: add a tip in new feat 2025-04-20 02:22:34 +08:00
Helvetica Volubi
3508abe5d0 feat: disable raid self check config
--Function from leaves
2025-04-20 01:50:17 +08:00
Helvetica Volubi
aebe5b01c1 description: fix up description 2025-04-19 21:28:11 +08:00
Helvetica Volubi
36852b0ccf feat: prefer #75 to hardfork-ver 2025-04-19 21:20:33 +08:00
MrHua269
141ad69b1a Fully removed player teleport event and entity teleport event call & Rebase patches 2025-04-19 20:43:15 +08:00
MrHua269
936be4c3fd Add: Leaf Smart sort entities in NearestLivingEntitySensor 2025-04-18 22:07:58 +08:00
M2ke4U
2aaa180a4e Merge pull request #71 from Suisuroru/dev/1.21.4-hardfork-raid-fix
feat: fixup raid revert mode and del patch 0022
2025-04-12 23:34:32 +08:00
Helvetica Volubi
c4af5b30dc fix: fix up number 2025-04-12 23:23:54 +08:00
Helvetica Volubi
56990d8dc3 del: delete patch 0022(MrHua269) 2025-04-12 23:18:05 +08:00
Helvetica Volubi
b1f19647e3 feat: selected raid update 2025-04-12 23:16:44 +08:00
Bacteriawa
dcfdff1a0b Updated Upstream (Folia) 2025-04-12 02:49:03 +08:00
ShintoKosei
7b76c3dbaf [ci skip] Enable dependabot 2025-04-11 23:58:19 +08:00
Dreeam
adbdf9c29c [ci skip] Only release paperclip jar 2025-03-24 12:11:07 -04:00
MrHua269
f51216d01d Revert RegionizedTaskQueue referent counter changes 2025-03-20 23:20:39 +08:00
Kercute
3ef35a1b4b Add force the data command to be enabled config 2025-03-17 00:36:49 +08:00
Creeam
c06b8444aa [ci skip] Update CONTRIBUTING_EN.md 2025-03-16 12:59:34 +08:00
Creeam
3e96017ed6 [ci skip] Update EN contributing guide 2025-03-16 12:52:10 +08:00
Helvetica Volubi
85e32d5d03 [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-03-16 12:41:54 +08:00
xiaoxijun
778c82ee0a Merge pull request #54 from Suisuroru/suisuroru/revert-raid-changes
feat: Merge Revert-raid-changes of Leaves to Luminol
2025-03-15 23:08:06 +08:00
HaHaWTH
14146549a8 Updated Upstream (Folia) 2025-03-12 05:24:37 +14:00
MrHua269
064898cddf Do not search the block out of current region & Ported some micro optimizations from Leaf 2025-03-09 11:40:56 +08:00
Kercute
c829110cf3 0019-Skip-collision-check-if-the-block-is-not-belong-to-c.patch 2025-03-09 00:32:54 +08:00
Kercute
08cc27a648 Updated Upstream (Folia) 2025-03-08 23:09:59 +08:00
MrHua269
531d824a55 [ci skip] Use --global flag to configure git 2025-03-08 20:11:22 +08:00
MrHua269
0f6e3ac870 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 2025-03-08 09:58:16 +08:00
Suisuroru
3550274e82 feat(config): optimize configuration description of raid config 2025-02-23 02:13:46 +08:00
Suisuroru
e24d0fffdf feat: Merge Revert-raid-changes of Leaves to Luminol 2025-02-21 00:04:36 +08:00
74 changed files with 216 additions and 1681 deletions

View File

@@ -15,50 +15,39 @@ jobs:
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '22'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Configure Git User Details
run: git config --global user.email "ci@luminolmc.com" && git config --global user.name "LuminolMC CI"
- name: Apply Patches
run: ./gradlew applyAllPatches
- name: CreateJar
run: ./gradlew createMojmapPaperclipJar
- name: Publish to repo
if: github.event_name != 'pull_request'
continue-on-error: true
run: |
./gradlew generateDevelopmentBundle publish -PpublishDevBundle=true
env:
PRIVATE_MAVEN_REPO_PASSWORD: ${{ secrets.PRIVATE_MAVEN_REPO_PASSWORD }}
PRIVATE_MAVEN_REPO_USERNAME: ${{ secrets.PRIVATE_MAVEN_REPO_USERNAME }}
export MAVEN_REPO_USER=${{ secrets.MAVEN_REPO_USER }}
export MAVEN_REPO_PASSWORD=${{ secrets.MAVEN_REPO_PASSWORD }}
./gradlew publish -PpublishDevBundle=true
- 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"
path: "luminol-server/build/libs/*-paperclip.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
uses: ncipollo/release-action@v1.16.0
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://repo.menthamc.com/repository/maven-public/"
url = "https://maven.moliatopia.icu/repository/maven-snapshots/"
}
}
@@ -47,8 +47,8 @@ dependencies {
```xml
<repositories>
<repository>
<id>menthamc</id>
<url>https://repo.menthamc.com/repository/maven-public/</url>
<id>moliatopia</id>
<url>https://maven.moliatopia.icu/repository/maven-snapshots/</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://repo.menthamc.com/repository/maven-public/"
url = "https://maven.moliatopia.icu/repository/maven-snapshots/"
}
}
@@ -48,8 +48,8 @@ For maven
```xml
<repositories>
<repository>
<id>menthamc</id>
<url>https://repo.menthamc.com/repository/maven-public/</url>
<id>moliatopia</id>
<url>https://maven.moliatopia.icu/repository/maven-snapshots/</url>
</repository>
</repositories>

View File

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

View File

@@ -27,7 +27,7 @@
Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的修改分成了两个目录:
- `luminol-api` - 对 `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit-API` 进行的修改。
- `luminol-api` - 对 `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit` 进行的修改。
- `luminol-server` - 对 Minecraft 标准服务器原有逻辑进行的修改。
补丁系统是基于 git 的,你可以在这里了解 git 的基本内容: <https://git-scm.com/docs/gittutorial>
@@ -36,21 +36,9 @@ Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的
1. 将你的仓库 clone 到本地;
2. 在你的 IDE 或 终端 内执行 Gradle 的 `applyAllPatches` 任务,如果是在终端内,你可以执行 `./gradlew applyAllPatches`
3. 在执行操作后,仓库根目录下应该存在以下目录对: `luminol-api``luminol-server` `folia-api``folia-server` 以及 `paper-api``paper-server`(下文称作 `*-api``*-server`
4. 进入 仓库根目录下的 `*-api``*-server` 文件夹进行修改。
3. 进入 仓库根目录下的 `luminol-api``luminol-server` 文件夹进行修改。
以下为对上述各个文件夹的简单描述,详细描述可以参考[这里](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 仓库:
顺便一提,仓库根目录下的 `luminol-api``luminol-server` 并不是正常的 git 仓库
- 在应用补丁前,基点将会指向未被更改的源码
- 在基点后的每一个提交都是一个补丁
@@ -60,11 +48,11 @@ Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的
按照以下步骤增加一个补丁是非常简单的:
1.`*-api``*-server` 进行修改;
1.`luminol-api``luminol-server` 进行修改;
2. 使用 git 添加你的修改,比如 `git add .`(不要提交新建的文件的修改);
3. 使用 `git commit -m <提交信息>` 进行提交;
4. 运行 Gradle 任务 `fixupPaperApiFilePatches` 生成新建文件的补丁文件(注意不要提交)
5. 运行 Gradle 任务 `rebuildAllServerPatches` 将你的提交转化为一个补丁
4. 运行 Gradle 任务 `rebuildAllServerPatches` 将你的提交转化为一个补丁
5. 运行 Gradle 任务 `fixupPaperApiFilePatches` 生成新建文件的补丁文件(注意不要提交)
6. 将你生成的补丁文件进行推送。
这样做以后,你就可以将你的补丁文件进行 PR 提交。
@@ -77,6 +65,6 @@ Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的
2. 使用 `git commit -a --fixup <hash>` 来进行一个更正提交不要提交对在luminol新建文件的修改
- 如果你想要更改提交信息,你也可以用 `--squash` 来代替 `--fixup`
3. 使用 `git rebase -i --autosquash base` 来进行自动变基,你只需要输入 `:q` 来关闭确认页面即可;
4. 运行 Gradle 任务 `fixupPaperApiFilePatches` 来修改已被修改的在luminol新建文件的补丁注意不要提交
5. 运行 Gradle 任务 `rebuildAllServerPatches` 来修改已被修改的补丁
4. 运行 Gradle 任务 `rebuildAllServerPatches` 来修改已被修改的补丁
5. 运行 Gradle 任务 `fixupPaperApiFilePatches` 来修改已被修改的在luminol新建文件的补丁注意不要提交
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-API`.
- `luminol-server` - Modifications to Minecraft Vanilla Server's source logic.
- `luminol-api` - Modifications to `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit`.
- `luminol-server` - Modifications to Minecraft Official 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,22 +39,9 @@ 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. 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.
3. Enter `luminol-api` and `luminol-server` directory to carry out modifications.
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.
BTW, `luminol-api` and `luminol-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.
@@ -64,11 +51,11 @@ BTW, `*-api` and `*-server` and are not normal git repositories.
It's very easy to add patches by following the steps below:
1. Modify the code of `*-api` and `*-server`
1. Modify the code of `luminol-api` and `luminol-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 `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
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)
6. Push your patches to your repository
After pushing, you can open a PR to submit your patches.
@@ -79,8 +66,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 `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
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)
6. Push and PR again

View File

@@ -5,19 +5,15 @@ 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..db5e2f10278c20286779362cfdfadb2f42c724e0 100644
index 652ff54e7c50412503725d628bfe72ed03059790..ee163b9fa8f441aa4b3e2309f33e8f932dfc02d7 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
@@ -19,6 +19,17 @@ public interface ServerBuildInfo {
@@ -19,6 +19,13 @@ 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..01dac0602b5f66f80c0adfbb779666fe0325a24f
index 0000000000000000000000000000000000000000..38972ac3d05ccbbb134f751a8d018b9c53ad10b5
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/api/ThreadedRegion.java
@@ -0,0 +1,56 @@
@@ -0,0 +1,50 @@
+package me.earthme.luminol.api;
+
+import org.bukkit.Location;
@@ -90,12 +90,6 @@ index 0000000000000000000000000000000000000000..01dac0602b5f66f80c0adfbb779666fe
+ */
+ @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,39 +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] 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 config for command block command execution
Subject: [PATCH] Add experiment 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,13 +1,12 @@
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 config for entity to clean memory value which is not
belong to current tickregion
Subject: [PATCH] Add experiment 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..52b08be8b37117edc38dddf6d1919178b1f86271 100644
index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..d61fba01feecce3610cd390f490d3097c5db19c4 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> {
@@ -33,7 +32,7 @@ index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..52b08be8b37117edc38dddf6d1919178
+ final net.minecraft.world.level.Level ownerLevel = owner.level();
+
+ // type: entity
+ if (me.earthme.luminol.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enabledForEntity && value instanceof LivingEntity entity) {
+ if (me.earthme.luminol.config.modules.experiment.ForceCleanupEntityBrainMemoryConfig.enabledForEntity && value instanceof LivingEntity entity) {
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
+ this.eraseMemory(entry.getKey());
+ continue;
@@ -41,7 +40,7 @@ index 65b2b3ece213d901cdd585093e2fafcd2ef4a7cd..52b08be8b37117edc38dddf6d1919178
+ }
+
+ // type: block_pos
+ if (me.earthme.luminol.config.modules.fixes.ForceCleanupEntityBrainMemoryConfig.enabledForBlockPos && value instanceof net.minecraft.core.BlockPos blockPos) {
+ if (me.earthme.luminol.config.modules.experiment.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

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

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

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

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

View File

@@ -3,10 +3,9 @@ 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 56f5568848d0f20b4d706c07dc8114594e0b5337..e62e8b9af7ad3e4454702ac86ad2b27973eba66f 100644
index ed00a29daccfee1d631bef27c0a3a4ae83140018..330af9f4de1c72387326816065350e71fe546efe 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,7 +3,6 @@ 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,7 +4,6 @@ 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,9 +3,6 @@ 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

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

View File

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

View File

@@ -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 771744d4540fcd163efcde43c27111680b25c928..2efc715857d49f69a8289bcf50f422960c00c8bd 100644
index 4026d465687604965f105ded21a8206fd52bd375..8ec2b94add58d64d9b83d632427923720ec74990 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4291,14 +4291,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4275,14 +4275,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 771744d4540fcd163efcde43c27111680b25c928..2efc715857d49f69a8289bcf50f42296
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
)
@@ -4313,11 +4317,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4297,11 +4301,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 771744d4540fcd163efcde43c27111680b25c928..2efc715857d49f69a8289bcf50f42296
Relative.union(Relative.DELTA, Relative.ROTATION),
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
@@ -4495,6 +4503,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4479,6 +4487,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.canPortalAsync(destination, takePassengers)) {
return false;
}
@@ -60,7 +60,7 @@ index 771744d4540fcd163efcde43c27111680b25c928..2efc715857d49f69a8289bcf50f42296
Vec3 initialPosition = this.position();
ChunkPos initialPositionChunk = new ChunkPos(
@@ -4559,9 +4571,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4543,9 +4555,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,63 +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..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,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 2efc715857d49f69a8289bcf50f422960c00c8bd..18e6e9fe39a559ae043fdafcf4e4db467144e309 100644
index 8ec2b94add58d64d9b83d632427923720ec74990..3ad00cc095588574218ca6d729ead119403202e0 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 2efc715857d49f69a8289bcf50f422960c00c8bd..18e6e9fe39a559ae043fdafcf4e4db46
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");
@@ -5061,6 +5068,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5045,6 +5052,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB bb) {

View File

@@ -3,9 +3,6 @@ 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,9 +4,6 @@ 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,12 +3,9 @@ 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 52b08be8b37117edc38dddf6d1919178b1f86271..d98eae5ee8a69a89e37751594dfff636831c8016 100644
index d61fba01feecce3610cd390f490d3097c5db19c4..67b71145e4feb4835a79a6007b04511a2c3b938a 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,9 +3,6 @@ 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

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

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

View File

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

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

@@ -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] Add config to enable Raytracing tracker
Subject: [PATCH] Raytracing tracker experiment
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 97879ba5080db09dde7cd76fe7b0ba502d8df572..002466add86b36529bff6787332b575d1f12305b 100644
index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..ceca76a5791e319dd7cc4048c9860b1df065b95a 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 97879ba5080db09dde7cd76fe7b0ba502d8df572..002466add86b36529bff6787332b575d
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@@ -6086,4 +6086,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -6049,4 +6049,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: Sun, 13 Apr 2025 11:07:04 +0800
Subject: [PATCH] Add config to disable heightmap warning
Subject: [PATCH] Disable Heightmap Warning
diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Fri, 11 Apr 2025 16:53:57 +0800
Subject: [PATCH] Add config to revert raid changes
Subject: [PATCH] Leaves-Revert-raid-changes
diff --git a/net/minecraft/world/effect/BadOmenMobEffect.java b/net/minecraft/world/effect/BadOmenMobEffect.java
@@ -21,112 +21,93 @@ index 80f17f33f670018240c854df589cf90cdeab6e70..8672757a4d5fb5c247599782fece6b8d
if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) {
serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier));
diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..0d91ae860a5c506c634e88341d958618996cc5bc 100644
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..4e2ec7f7946a70b676393f090c5ce6219314c3da 100644
--- a/net/minecraft/world/entity/raid/Raid.java
+++ b/net/minecraft/world/entity/raid/Raid.java
@@ -325,7 +325,20 @@ public class Raid {
}
if (flag1) {
- this.waveSpawnPos = this.getValidSpawnPos();
+ // Luminol Start - Raid revert
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) {
+ this.waveSpawnPos = this.getValidSpawnPos();
+ } else {
+ int n4 = 0;
+ if (this.raidCooldownTicks < 100) {
+ n4 = 1;
+ }
+ if (this.raidCooldownTicks < 40) {
+ n4 = 2;
+ }
+ this.waveSpawnPos = this.getValidSpawnPos(n4);
+ }
+ // Luminol End - Raid revert
}
if (this.raidCooldownTicks == 300 || this.raidCooldownTicks % 20 == 0) {
@@ -360,7 +373,14 @@ public class Raid {
int i = 0;
while (this.shouldSpawnGroup()) {
- BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ // Luminol Start - Raid revert
+ BlockPos blockPos;
+ if (!me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert) {
+ blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ } else {
+ blockPos = this.waveSpawnPos.isPresent() ? this.waveSpawnPos.get() : this.findRandomSpawnPos(i, 20);
+ }
+ // Luminol End - Raid revert
if (blockPos != null) {
this.started = true;
this.spawnGroup(blockPos);
@@ -372,7 +392,7 @@ public class Raid {
i++;
}
- if (i > 5) {
+ if (i > (me.earthme.luminol.config.modules.misc.RaidChangesConfig.pos_revert ? 3 : 5)) { // Luminol - Raid revert
org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit
this.stop();
break;
@@ -449,6 +469,17 @@ public class Raid {
return blockPos != null ? Optional.of(blockPos) : Optional.empty();
}
@@ -109,6 +109,12 @@ public class Raid {
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY);
// Paper end
+ // Luminol Start - Raid revert
+ private Optional<BlockPos> getValidSpawnPos(int n) {
+ for (int i = 0; i < 3; ++i) {
+ BlockPos blockPos = this.findRandomSpawnPos(n, 1);
+ if (blockPos == null) continue;
+ return Optional.of(blockPos);
+ }
+ return Optional.empty();
+ }
+ private boolean flagForceWin = false;
+ private boolean flag274911 = false;
+ private int freshTick = 0;
+ private int retryTimes = 0;
+ // Luminol End - Raid revert
+
private boolean hasMoreWaves() {
return this.hasBonusWave() ? !this.hasSpawnedBonusWave() : !this.isFinalWave();
// Folia start - make raids thread-safe
public boolean ownsRaid() {
@@ -270,7 +276,36 @@ public class Raid {
}
@@ -674,7 +705,7 @@ public class Raid {
public void tick() {
- if (!this.isStopped()) {
+ // Luminol Start - Raid revert
+ if (this.flag274911) {
+ if (this.freshTick == 20) {
+ if (this.waveSpawnPos.isPresent() && !this.level.isPositionEntityTicking(this.waveSpawnPos.get())) {
+ this.waveSpawnPos = this.getValidSpawnPos();
+ }
+
+ BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
+ if (blockPos != null && retryTimes < 3) {
+ this.started = true;
+ this.spawnGroup(blockPos);
+ this.retryTimes = 0;
+ } else if (retryTimes == 3) {
+ this.waveSpawnPos = Optional.empty();
+ this.groupsSpawned++;
+ this.retryTimes = 0;
+ } else {
+ this.retryTimes++;
+ }
+ if (!this.hasMoreWaves()) {
+ this.flag274911 = false;
+ this.flagForceWin = true;
+ }
+ this.freshTick = 0;
+ } else {
+ this.freshTick++;
+ }
+ return;
+ }
+ if (!this.isStopped() || this.flagForceWin) { // Luminol End - Raid revert
if (this.status == Raid.RaidStatus.ONGOING) {
boolean flag = this.active;
this.active = this.level.hasChunkAt(this.center);
@@ -288,6 +323,12 @@ public class Raid {
return;
}
+ // Luminol Start - Raid revert
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.revert_274911 && this.waveSpawnPos.isPresent() && this.center.distSqr(this.waveSpawnPos.get()) >= 12544) {
+ this.flag274911 = true;
+ }
+ // Luminol End - Raid revert
+
if (!this.level.isVillage(this.center)) {
this.moveRaidCenterToNearbyVillageSection();
}
@@ -379,7 +420,7 @@ public class Raid {
}
}
- if (this.isStarted() && !this.hasMoreWaves() && totalRaidersAlive == 0) {
+ if (this.flagForceWin || (this.isStarted() && !this.hasMoreWaves() && totalRaidersAlive == 0)) { // Luminol - Raid revert
if (this.postRaidTicks < 40) {
this.postRaidTicks++;
} else {
@@ -674,7 +715,7 @@ public class Raid {
int i2 = this.center.getX() + Mth.floor(Mth.cos(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3);
- if (Mth.abs(height - this.center.getY()) <= 96) {
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.height_check || Mth.abs(height - this.center.getY()) <= 96) { // Leaves - Disable height check
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.height_check || Mth.abs(height - this.center.getY()) <= 96) { // Disable height check
mutableBlockPos.set(i2, height, i3);
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
int i4 = 10;
@@ -694,6 +725,26 @@ public class Raid {
return null;
}
+ // Luminol Start - Raid revert
+ @Nullable
+ private BlockPos findRandomSpawnPos(int n, int n2) {
+ int n3 = 2 - n;
+ BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ SpawnPlacementType spawnPlacementType = SpawnPlacements.getPlacementType(EntityType.RAVAGER);
+ for (int i = 0; i < n2; ++i) {
+ float f = this.level.random.nextFloat() * ((float)Math.PI * 2);
+ int n4 = this.center.getX() + Mth.floor(Mth.cos(f) * 32.0f * (float)n3) + this.level.random.nextInt(5);
+ int n5 = this.center.getZ() + Mth.floor(Mth.sin(f) * 32.0f * (float)n3) + this.level.random.nextInt(5);
+ int n6 = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, n4, n5);
+ mutableBlockPos.set(n4, n6, n5);
+ if (this.level.isVillage(mutableBlockPos) && n < 2) continue;
+ if (!this.level.hasChunksAt(mutableBlockPos.getX() - 10, mutableBlockPos.getZ() - 10, mutableBlockPos.getX() + 10, mutableBlockPos.getZ() + 10) || !this.level.isPositionEntityTicking(mutableBlockPos) || !spawnPlacementType.isSpawnPositionOk(this.level, mutableBlockPos, EntityType.RAVAGER) && (!this.level.getBlockState((BlockPos)mutableBlockPos.below()).is(Blocks.SNOW) || !this.level.getBlockState(mutableBlockPos).isAir())) continue;
+ return mutableBlockPos;
+ }
+ return null;
+ }
+ // Luminol End - Raid revert
+
private boolean addWaveMob(int wave, Raider raider) {
return this.addWaveMob(wave, raider, true);
}
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7eab2a25c 100644
index 7c385baae81b9a987c0e1e4deb017884600331bc..262291eaeb9bc250affeda67957588d14ec1eebc 100644
--- a/net/minecraft/world/entity/raid/Raider.java
+++ b/net/minecraft/world/entity/raid/Raider.java
@@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster {
@@ -163,7 +144,7 @@ index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7
+ net.minecraft.world.effect.MobEffectInstance mobeffect1 = new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, i, false, false, true);
+
+ if (!serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_DISABLE_RAIDS)) {
+ entityhuman.addEffect(mobeffect1, entityhuman, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN, true, true); // CraftBukkit // Luminol - Raid revert adapt Cross Region Damage trace
+ entityhuman.addEffect(mobeffect1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN); // CraftBukkit
+ }
+ this.setPatrolLeader(false);
+ }
@@ -183,15 +164,24 @@ index 7c385baae81b9a987c0e1e4deb017884600331bc..75a8e0602c249df4b587a454e35f4cd7
public boolean hasActiveRaid() {
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
index 318f24d67be4daf6993ba547da0540be9c221a75..5607d2f21131510563f8fdc9079d1145483b11df 100644
index 318f24d67be4daf6993ba547da0540be9c221a75..9a6820fce3977419fd81d802720c318ac15d07c4 100644
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
+++ b/net/minecraft/world/item/component/OminousBottleAmplifier.java
@@ -28,7 +28,7 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T
@Override
public void onConsume(Level level, LivingEntity entity, ItemStack stack, Consumable consumable) {
- entity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below
+ entity.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below
}
// Paper start - properly resend entities - collect packets for bundle
@@ -40,7 +40,7 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T
@Override
public void addToTooltip(Item.TooltipContext context, Consumer<Component> tooltipAdder, TooltipFlag tooltipFlag) {
- List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true));
+ List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true)); // Luminol - Raid effect infinite
+ List<MobEffectInstance> list = List.of(new MobEffectInstance(MobEffects.BAD_OMEN, me.earthme.luminol.config.modules.misc.RaidChangesConfig.infinite ? net.minecraft.world.effect.MobEffectInstance.INFINITE_DURATION : 120000, this.value, false, false, true));
PotionContents.addPotionTooltip(list, tooltipAdder, 1.0F, context.tickRate());
}
}

View File

@@ -3,39 +3,7 @@ From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:45 +0800
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
As part of: Leaves (https://github.com/LeavesMC/Leaves/blob/master/leaves-server/paper-patches/features/0016-Fix-SculkCatalyst-exp-skip.patch)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index ca67950e35c7f420846337e885d95b8eabca3f37..d9ea3db817878ff56a2772ce983ff95431e1326c 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1358,7 +1358,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
// SPIGOT-5478 must be called manually now
- if (event.shouldDropExperience()) this.dropExperience(this.serverLevel(), cause.getEntity()); // Paper - tie to event
+ if (shouldDropExperience(event.shouldDropExperience(), event.forceUseEventDropStatus())) this.dropExperience(this.serverLevel(), cause.getEntity()); // Paper - tie to event // Leaves - exp fix
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) {
// Paper start - PlayerDeathEvent#getItemsToKeep
@@ -1392,6 +1392,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setClientLoaded(false);
}
+ // Leaves start - exp fix
+ private boolean shouldDropExperience(boolean eventResult, boolean forceUseEvent) {
+ if (forceUseEvent) {
+ return eventResult;
+ }
+ return wasExperienceConsumed() ? false : eventResult;
+ }
+ // Leaves end - exp fix
+
private void tellNeutralMobsThatIDied() {
AABB aabb = new AABB(this.blockPosition()).inflate(32.0, 10.0, 32.0);
this.level()
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..658aa09aecf8d64145feedb82dc9be2a55201450 100644
--- a/net/minecraft/world/entity/LivingEntity.java

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Thu, 7 Nov 2024 21:50:47 +0100
Subject: [PATCH] Lithium: Fast util
Subject: [PATCH] Lithium: fast util
This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java"

View File

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

View File

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

View File

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

View File

@@ -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..e3c5f4c31f084294a59830f3e764921433dd80d5 100644
index e741201fdbea0dbbc0e42313ebd33368014c9dc4..673a81734a0903a0790f3007772642d3d9a044cc 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..e3c5f4c31f084294a59830f3e7649214
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- return brandId.equals(this.brandId);
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_FOLIA_ID); // Luminol
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_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..f0c8e76efaf897a81283edbf9a9c2a71bc28c9a9 100644
index cd6e46fa68c009deb8dfebcecb88e058dfede0b0..ac4ab407095d998b1418d740ab54e8157bce6a02 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..f0c8e76efaf897a81283edbf9a9c2a71
+ // Luminol start - Tick regions api
+ @Override
+ public me.earthme.luminol.api.ThreadedRegionizer getThreadedRegionizer() {
+ return this.world.regioniser.threadedRegionizerAPI;
+ return new me.earthme.luminol.api.impl.ThreadedRegionizerImpl(this.world);
+ }
+ // Luminol end
}

View File

@@ -1,6 +1,6 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/api/impl/ThreadedRegionImpl.java
@@ -1,0 +_,52 @@
@@ -1,0 +_,47 @@
+package me.earthme.luminol.api.impl;
+
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
@@ -39,7 +39,7 @@
+
+ @Override
+ public TickRegionData getTickRegionData() {
+ return this.internal.getData().tickRegionDataAPI;
+ return new TickRegionDataImpl(this.internal.getData());
+ }
+
+ @Nullable
@@ -47,9 +47,4 @@
+ 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 got.threadedRegionAPI;
+ return new ThreadedRegionImpl(got);
+ }
+
+ @Override
@@ -51,6 +51,6 @@
+ return null;
+ }
+
+ return got.threadedRegionAPI;
+ return new ThreadedRegionImpl(got);
+ }
+}

View File

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

View File

@@ -1,25 +0,0 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/CommandTickConfig.java
@@ -1,0 +_,22 @@
+package me.earthme.luminol.config.modules.experiment;
+
+import me.earthme.luminol.config.ConfigInfo;
+import me.earthme.luminol.config.EnumConfigCategory;
+import me.earthme.luminol.config.IConfigModule;
+
+public class CommandTickConfig implements IConfigModule {
+ @ConfigInfo(baseName = "enabled", comments =
+ """
+ Allow to use tick command""")
+ public static boolean enabled = false;
+
+ @Override
+ public EnumConfigCategory getCategory() {
+ return EnumConfigCategory.EXPERIMENT;
+ }
+
+ @Override
+ public String getBaseName() {
+ return "enable_tick_command";
+ }
+}

View File

@@ -1,25 +0,0 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/EntityDamageSourceTraceConfig.java
@@ -1,0 +_,22 @@
+package me.earthme.luminol.config.modules.experiment;
+
+import me.earthme.luminol.config.ConfigInfo;
+import me.earthme.luminol.config.EnumConfigCategory;
+import me.earthme.luminol.config.IConfigModule;
+
+public class EntityDamageSourceTraceConfig implements IConfigModule {
+ @ConfigInfo(baseName = "enabled", comments =
+ """
+ Allow trace damage source cross different Region Scheduler.""")
+ public static boolean enabled = false;
+
+ @Override
+ public EnumConfigCategory getCategory() {
+ return EnumConfigCategory.EXPERIMENT;
+ }
+
+ @Override
+ public String getBaseName() {
+ return "entity-damage-source-trace";
+ }
+}

View File

@@ -1,7 +1,7 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/ForceCleanupEntityBrainMemoryConfig.java
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/ForceCleanupEntityBrainMemoryConfig.java
@@ -1,0 +_,22 @@
+package me.earthme.luminol.config.modules.fixes;
+package me.earthme.luminol.config.modules.experiment;
+
+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 +_,27 @@
@@ -1,0 +_,20 @@
+package me.earthme.luminol.config.modules.misc;
+
+import me.earthme.luminol.config.ConfigInfo;
@@ -10,13 +10,6 @@
+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

@@ -1,6 +1,6 @@
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RaidChangesConfig.java
@@ -1,0 +_,54 @@
@@ -1,0 +_,52 @@
+package me.earthme.luminol.config.modules.misc;
+
+import me.earthme.luminol.config.ConfigInfo;
@@ -28,9 +28,7 @@
+
+ @ConfigInfo(baseName = "skip-height-check", comments =
+ """
+ Disable y <= 96 check.
+ If you enabled revert_274911, this config will useless
+ and always behavior of enabled""")
+ Disable y <= 96 check""")
+ public static boolean height_check = false;
+
+ @ConfigInfo(baseName = "skip-self-raid-check", comments =
@@ -41,9 +39,9 @@
+
+ @ConfigInfo(baseName = "revert-274911", comments =
+ """
+ Revert Old raid's find spawn position logic
+ --- This revert MC-274911""")
+ public static boolean pos_revert = false;
+ Revert MC-274911(hard-revert)
+ --- maybe have some bugs""")
+ public static boolean revert_274911 = false;
+
+ @Override
+ public EnumConfigCategory getCategory() {

View File

@@ -1,212 +0,0 @@
--- /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);
+ }
+}