Compare commits
141 Commits
1.20.4-782
...
1.20.4-046
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0461985e95 | ||
|
|
04b1668fa7 | ||
|
|
fb85fe59e6 | ||
|
|
514fe3ca71 | ||
|
|
b1f0a68b10 | ||
|
|
fd780f417b | ||
|
|
6339b2adc1 | ||
|
|
cc593b53e2 | ||
|
|
3b838086e9 | ||
|
|
9f0574db9f | ||
|
|
705170d111 | ||
|
|
5fdb14947b | ||
|
|
d66ce6fb87 | ||
|
|
b81eb1857c | ||
|
|
cc0312cd76 | ||
|
|
3313ff7c61 | ||
|
|
06a87833f3 | ||
|
|
6d39abe168 | ||
|
|
9243eea30b | ||
|
|
1334c291e5 | ||
|
|
bd1178911d | ||
|
|
41a500a5ad | ||
|
|
a1ba257238 | ||
|
|
a40d934630 | ||
|
|
79b6b41b63 | ||
|
|
52ab368069 | ||
|
|
0bfac95070 | ||
|
|
c69ed4279e | ||
|
|
127aa3728a | ||
|
|
1e7b4394ac | ||
|
|
f129a1e860 | ||
|
|
922a85f662 | ||
|
|
d13bfadde4 | ||
|
|
88aab8eadc | ||
|
|
8914d3fcbc | ||
|
|
d2f2ea4382 | ||
|
|
a6888b27d0 | ||
|
|
efabe850e0 | ||
|
|
6c6786792f | ||
|
|
dddb28fdf6 | ||
|
|
8546ac56e2 | ||
|
|
2c09274132 | ||
|
|
a9238f8e8e | ||
|
|
7522e3c67b | ||
|
|
71a7127bb1 | ||
|
|
75266cceed | ||
|
|
8a292a655a | ||
|
|
a0779956f1 | ||
|
|
1de9ca9d5f | ||
|
|
bc842c855a | ||
|
|
120ddafc2f | ||
|
|
3b1a8cc929 | ||
|
|
2914a219e2 | ||
|
|
07bbbd3d7e | ||
|
|
e69cf4c9ec | ||
|
|
6b679bc02e | ||
|
|
124a240fe9 | ||
|
|
e8b9aaee48 | ||
|
|
eb3502eb86 | ||
|
|
bdd41593e0 | ||
|
|
06dcc037df | ||
|
|
9247a01058 | ||
|
|
856ddfe7cc | ||
|
|
4013d9dc3b | ||
|
|
ce8a2afb0f | ||
|
|
ea3efdb597 | ||
|
|
678c3faeea | ||
|
|
815adcc00e | ||
|
|
c0d766fd07 | ||
|
|
a9cd09f900 | ||
|
|
1452008bbe | ||
|
|
e71abbd761 | ||
|
|
6db86f10e7 | ||
|
|
f134186657 | ||
|
|
ef1b7ce6f7 | ||
|
|
f16e5c1064 | ||
|
|
0b9a436044 | ||
|
|
76f2aa58e1 | ||
|
|
6317a5399b | ||
|
|
3c1be89214 | ||
|
|
9551755b0d | ||
|
|
e1afa32f90 | ||
|
|
fa109ea506 | ||
|
|
ebe2b03455 | ||
|
|
3456a29225 | ||
|
|
c06f539f46 | ||
|
|
259d5173b8 | ||
|
|
3aa2070f49 | ||
|
|
248ac6ae2b | ||
|
|
54da5452d2 | ||
|
|
b1a3d6f0d1 | ||
|
|
9b761ef0c0 | ||
|
|
e965f7285a | ||
|
|
0f1f8b3f78 | ||
|
|
cce9600afb | ||
|
|
5ced673fd8 | ||
|
|
5a8c6b91d0 | ||
|
|
64f826fd98 | ||
|
|
5b0465efeb | ||
|
|
2f30488144 | ||
|
|
1aca9f74c4 | ||
|
|
932c9f9194 | ||
|
|
eafe7cd5e3 | ||
|
|
a319241fc2 | ||
|
|
540bbd4f6a | ||
|
|
8b8328c5b6 | ||
|
|
c508de9f2a | ||
|
|
483e958c58 | ||
|
|
01abc6c424 | ||
|
|
6d26556182 | ||
|
|
78e463d201 | ||
|
|
f67b792dd6 | ||
|
|
38eb77a049 | ||
|
|
624825f76b | ||
|
|
4dcf8fb6ff | ||
|
|
a06ae51240 | ||
|
|
3c80338a24 | ||
|
|
59a428e597 | ||
|
|
f65089a3bc | ||
|
|
3dc384625a | ||
|
|
41d9c2cb89 | ||
|
|
48c1fde6b0 | ||
|
|
9c332ffb4b | ||
|
|
4aaa78b7fc | ||
|
|
2d1a64177a | ||
|
|
5363c69ea7 | ||
|
|
5e79b7c916 | ||
|
|
c0797d33df | ||
|
|
fed8624fff | ||
|
|
0715533d18 | ||
|
|
d0d9402571 | ||
|
|
eb52e43eda | ||
|
|
1a7154a26e | ||
|
|
58d264ff28 | ||
|
|
80e9064854 | ||
|
|
8628f803c2 | ||
|
|
dc4a73f92b | ||
|
|
785325c5e2 | ||
|
|
f1f23b48a9 | ||
|
|
1e7ec58c46 | ||
|
|
a5b1d1c1c4 |
14
.github/FUNDING.yml
vendored
Normal file
14
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
custom: https://afdian.net/a/Luminol
|
||||
68
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
68
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
name: Bug反馈 Bug report
|
||||
description:
|
||||
报告Bug,插件不兼容情况,以及其他相关问题。
|
||||
Report issues with plugin incompatbility or other behavior related issues.
|
||||
labels:
|
||||
- bug
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
请详细描述您所遇到的Bug。确保您**真的**遇到了**服务端**Bug,而非原版特性或客户端Bug。
|
||||
Please describe the bug you encountered in detail. Make sure you're **actually** hitting a **server-side** bug, not a vanilla feature or client-side bug.<br>
|
||||
如果您确定的话,就按照下面的模板填充信息,并提交反馈。
|
||||
If you are sure, follow the template below to fill in the information and submit your feedback.<br>
|
||||
如果此bug被尝试修复,您可以帮助我们测试并回复。若bug的确被修复,您可以关闭issue来让开发者确认。
|
||||
If this bug is tried to fix, you can help us test and reply. If the bug is fixed, you can close the issue to let the developer confirm.
|
||||
- type: input
|
||||
id: leavesMC-version
|
||||
attributes:
|
||||
label: 服务端版本 LuminolMC Version
|
||||
description:
|
||||
LuminolMC服务端发行版本 LuminolMC server release version (contains the git commit's hash)<br>
|
||||
通过执行`/version`命令将获取到的内容复制到这里。 Run `/version` on your server and paste the full, unmodified output here.
|
||||
placeholder: >
|
||||
e.g. git-Luminol-"0635a89" (MC: 1.20.4)
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: 预期的行为 Expected behavior
|
||||
description: 你期望看到的情况是什么样。What you expected to see.
|
||||
placeholder: e.g. 使用 /tpsbar [NAME] 命令可以切换TPSBAR的开关
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual-behavior
|
||||
attributes:
|
||||
label: 观测到的实际行为 Observed/Actual behavior
|
||||
description: 你实际看到的。 What you actually saw.
|
||||
placeholder: e.g. 使用 /tpsbar [NAME] 命令切换不了TPSBAR
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: 复现步骤 Steps/models to reproduce
|
||||
description:
|
||||
这里应该有一个图片、视频或其他信息来展现你的问题。<br>
|
||||
This may include a build schematic, a video, or detailed instructions to help reconstruct the issue.
|
||||
placeholder: e.g. 登录其他账号,使用 /tpsbar [NAME] 命令切换不了TPSBAR
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: plugin-list
|
||||
attributes:
|
||||
label: 插件与数据包列表。 Plugin and Datapack List.
|
||||
description:
|
||||
服务器上的所有插件和数据包列表。
|
||||
All plugins and datapacks running on your server.<br>
|
||||
执行命令`/plugins`查看插件列表。执行命令`/datapack list`查看数据包列表。
|
||||
To list plugins, run `/plugins`. For datapacks, run `/datapack list`.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: other
|
||||
attributes:
|
||||
label: 更多详细信息。 The more information.
|
||||
31
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
31
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: 新的需求 Feature Request
|
||||
description:
|
||||
为Luminol提供新的想法。
|
||||
Suggest an idea for Luminol.
|
||||
labels:
|
||||
- enhancement
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
感谢您为 Luminol 提交新的需求!请尽可能详细地描述,以便我们可以更轻松地考虑和审查请求。
|
||||
Thank you for filling out a feature request for Luminol! Please be as detailed as possible so that we may consider and review the request easier.<br>
|
||||
请搜索所有问题以避免重复的功能请求。如果您期望的功能已存在,请回复如果您有什么要补充的。
|
||||
We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add.<br>
|
||||
在请求新功能之前,请确保您使用的是最新版本并且您请求的功能不在 Luminol 中。
|
||||
Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in Paper.<br>
|
||||
我们的开发人员可能没有过多时间来测试新功能的可用性,如新功能进入Test状态,您可以帮助我们进行测试并回复。
|
||||
Our developers may not have much time to test the usability of new functions. If the new functions enter the Test state, you can help us test and reply.
|
||||
|
||||
- type: textarea
|
||||
id: feature
|
||||
attributes:
|
||||
label: 描述你希望添加的功能。 Describe the feature you'd like.
|
||||
placeholder: e.g. 添加新的PATH
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: othre
|
||||
attributes:
|
||||
label: 其他 Other
|
||||
description: 添加其他的信息。 Add any other context or screenshots about the feature request below.
|
||||
@@ -17,7 +17,7 @@ permissions: write-all
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -37,21 +37,21 @@ jobs:
|
||||
- name: Build project to paperclip jar
|
||||
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
|
||||
with:
|
||||
arguments: createReobfPaperclipJar
|
||||
arguments: createReobfBundlerJar createReobfPaperclipJar
|
||||
- name: Capture build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Artifacts
|
||||
path: build/libs/
|
||||
- name: Publish API
|
||||
- name: Publish All
|
||||
run: |
|
||||
echo "GITHUB_USERNAME=LuminolCI" >> $GITHUB_ENV
|
||||
export GITHUB_USERNAME=LuminolCI
|
||||
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
|
||||
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||
./gradlew publish
|
||||
./gradlew publish -PpublishDevBundle=true
|
||||
- name: Rename jar file
|
||||
run: mv build/libs/Luminol-paperclip-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-paperclip.jar
|
||||
run: mv build/libs/luminol-paperclip-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-paperclip.jar
|
||||
- name: Release Artifacts
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
64
.github/workflows/build_1_20_4_v2.yml
vendored
Normal file
64
.github/workflows/build_1_20_4_v2.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Luminol CI v2 - Ver/1.20.4
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "ver/1.20.4" ]
|
||||
pull_request:
|
||||
branches: [ "ver/1.20.4" ]
|
||||
# workflow_dispatch:
|
||||
permissions: write-all
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
environment: default
|
||||
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
- name: Setup Git Config
|
||||
run: |
|
||||
git config --global user.email "ci@luminolmc.com"
|
||||
git config --global user.name "Luminol CI"
|
||||
- name: Apply Patches
|
||||
run: ./gradlew applyPatches
|
||||
- name: Build
|
||||
run: ./gradlew createReobfBundlerJar createReobfPaperclipJar
|
||||
- uses: "actions/upload-artifact@v3"
|
||||
with:
|
||||
name: "Luminol CI Artifacts"
|
||||
path: "build/libs/*.jar"
|
||||
- name: Rename jar file
|
||||
run: |
|
||||
mv build/libs/luminol-bundler-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-bundler.jar
|
||||
mv build/libs/luminol-paperclip-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-paperclip.jar
|
||||
- name: setenv
|
||||
run: |
|
||||
sh scripts/SetENV.sh
|
||||
echo "${{ env.tag }}"
|
||||
- name: Create Release
|
||||
if: "!contains(github.event.commits[0].message, '[release-skip]')"
|
||||
uses: ncipollo/release-action@v1.12.0
|
||||
with:
|
||||
tag: ${{ env.tag }}
|
||||
name: Luminol ${{ env.mcversion }} - ${{ env.commitid }}
|
||||
body: |
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commitid }} [](https://github.com/LeavesMC/LuminolMC/Luminol/download/${{ env.tag }}/luminol-1.20.4-paperclip.jar)
|
||||
This release is automatically compiled by GitHub Actions
|
||||
artifacts: |
|
||||
build/libs/luminol-1.20.4-bundler.jar
|
||||
build/libs/luminol-1.20.4-paperclip.jar
|
||||
generateReleaseNotes: true
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: Push to Api
|
||||
if: "!contains(github.event.commits[0].message, '[release-skip]')"
|
||||
env:
|
||||
secret_v2: ${{ secrets.API_KEY }}
|
||||
tag: ${{ env.tag }}
|
||||
run: sh scripts/PushToAPI.sh
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -33,7 +33,6 @@ target/
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# various other potential build files
|
||||
build/
|
||||
bin/
|
||||
dist/
|
||||
manifest.mf
|
||||
@@ -51,8 +50,10 @@ manifest.mf
|
||||
# other stuff
|
||||
run/
|
||||
|
||||
# Luminol
|
||||
build-data/
|
||||
Hearse-API
|
||||
Hearse-Server
|
||||
Luminol-API
|
||||
Luminol-Server
|
||||
paper-api-generator
|
||||
*.jar
|
||||
/patches2/todo/
|
||||
BIN
Luminol-02.png
BIN
Luminol-02.png
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
72
README.md
72
README.md
@@ -1,10 +1,7 @@
|
||||
<img src="./public/image/Luminol_5.png" alt="Logo" align="right" width="250">
|
||||
|
||||
# Luminol
|
||||
|
||||
<h4>Luminol is a folia fork with many useful optimizations, configurable vanilla features, and more API supports, and it was designed for survival and anarchy servers</h4>
|
||||
|
||||
**English** | [中文](./README_CN.md)
|
||||
<h4>Luminol 是一个基于Folia的分支,具有许多有用的优化、可配置的原版特性和更多的API支持,它专为生存和无政府服务器设计</h4>
|
||||
|
||||
[](LICENSE)
|
||||
[](https://github.com/LuminolMC/Luminol/issues)
|
||||
@@ -12,52 +9,69 @@
|
||||

|
||||

|
||||
|
||||
## Features
|
||||
- Configurable vanilla features
|
||||
- Tpsbar support
|
||||
- Linear region file format(from kaiiju)
|
||||
- Useful optimizations to improve the performance of single threaded region
|
||||
- More API support for plugin development (W.I.P)
|
||||
[English](./README_EN) | **中文**
|
||||
|
||||
## Download
|
||||
Any versions are available in the [release](https://github.com/LuminolMC/Luminol/releases), also you can build it by yourself through the following steps.
|
||||
## 特性
|
||||
- 可配置的原版特性
|
||||
- Tpsbar 支持
|
||||
- 线性区域文件格式 (from kaiiju)
|
||||
- 对单线程区域性能的优化
|
||||
- 更多的插件开发API支持(进行中)
|
||||
|
||||
## 下载
|
||||
任何版本都可以在 [Release](https://github.com/LuminolMC/Luminol/releases) 中找到,你也可以通过[以下步骤](./README.md#构建)自己构建。
|
||||
|
||||
## 构建
|
||||
要构建一个paperclip jar,你需要运行以下命令。你可以在build/libs中找到jar(注意:需要`JDK17`)
|
||||
|
||||
## Build
|
||||
To build a paperclip jar, you need to run the following command. You can find the jar in build/libs(Note: JDK17 is needed)
|
||||
```shell
|
||||
./gradlew applyPatches && ./gradlew createReobfPaperclipJar
|
||||
```
|
||||
## Using API
|
||||
For gradle:
|
||||
|
||||
## 使用API
|
||||
使用 Gradle:
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.20.2-R0.1-SNAPSHOT")
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.20.4-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
For maven
|
||||
|
||||
使用 Maven
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.earthme.luminol</groupId>
|
||||
<artifactId>luminol-api</artifactId>
|
||||
<version>1.20.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## Contact
|
||||
> If you are interested in this project or have any issue, feel free to ask us.
|
||||
## 联系方式
|
||||
> 如果您对这个项目感兴趣或有任何问题,请随时向我们提问。
|
||||
|
||||
QQ Group: 368632360
|
||||
QQ群: [368632360](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=MfosKhcDd8Fdxn1MREuZ8Krbf9T6jiBC&authKey=3cm6qdHohON3gHnuD63FK4k07fIbrWnY4hdyq8OmELsfjMVP1kbFTJY9mRyM2Rkj&noverify=0&group_code=368632360) | QQ频道: [点击加入](https://pd.qq.com/s/eq9krf9j) | Telegram: [点击加入](https://t.me/LuminolMC) | Discord: [点击加入](https://discord.gg/5hgtU72w33)
|
||||
|
||||
## About Issue
|
||||
When you meet any problems, just ask us, we will do our best to solve it, but remember to state your problem clear and provide enough logs etc.
|
||||
> [!WARNING]
|
||||
> **此项目与Leaves无关。不要向Leaves报告任何有关协议支持的错误,因为协议支持已经重构**
|
||||
|
||||
## 关于 Issue
|
||||
当您遇到任何问题时,请向我们提问,我们将尽力解决,但请记得清楚地描述您的问题并提供足够的日志等信息。
|
||||
|
||||
## 贡献代码
|
||||
可[查看 Contributing](./docs/CONTRIBUTING.md)
|
||||
|
||||
## BStats
|
||||

|
||||
|
||||
## Please star us
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=LuminolMC/Lumino&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=LuminolMC/Luminol&type=Date" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=LuminolMC/Luminol&type=Date" />
|
||||
## 请给我们一个 ⭐Star!
|
||||
> 你的每一个免费的 ⭐Star 就是我们每一个前进的动力。
|
||||
|
||||
<a href="https://star-history.com/#LuminolMC/Luminol&LuminolMC/LightingLuminol&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date" />
|
||||
<img alt="Star历史表" src="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
|
||||
55
README_CN.md
55
README_CN.md
@@ -1,55 +0,0 @@
|
||||
<img src="./public/image/Luminol_5.png" alt="Logo" align="right" width="250">
|
||||
|
||||
# Luminol
|
||||
|
||||
<h4>Luminol 是一个基于folia的分支,具有许多有用的优化、可配置的原版特性和更多的API支持,它专为生存和无政府服务器设计</h4>
|
||||
|
||||
[English](./README.md) | **中文**
|
||||
|
||||
[](LICENSE)
|
||||
[](https://github.com/LuminolMC/Luminol/issues)
|
||||

|
||||

|
||||

|
||||
|
||||
## 特性
|
||||
- 可配置的原版特性
|
||||
- Tpsbar 支持
|
||||
- 线性区域文件格式 (from kaiiju)
|
||||
- 对单线程区域性能的优化
|
||||
- 更多的插件开发API支持(进行中)
|
||||
|
||||
## 下载
|
||||
任何版本都可以在 [release](https://github.com/LuminolMC/Luminol/releases), 中找到,您也可以通过以下步骤自己构建。
|
||||
|
||||
## 构建
|
||||
要构建一个paperclip jar,你需要运行以下命令。你可以在build/libs中找到jar(注意:需要JDK17)
|
||||
```shell
|
||||
./gradlew applyPatches && ./gradlew createReobfPaperclipJar
|
||||
```
|
||||
## 使用API
|
||||
使用 Gradle:
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.20.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
使用 Maven
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.earthme.luminol</groupId>
|
||||
<artifactId>luminol-api</artifactId>
|
||||
<version>1.20.2-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## 联系方式
|
||||
> 如果您对这个项目感兴趣或有任何问题,请随时向我们提问。
|
||||
|
||||
QQ群:368632360
|
||||
|
||||
## 关于 Issue
|
||||
当您遇到任何问题时,请向我们提问,我们将尽力解决,但请记得清楚地描述您的问题并提供足够的日志等信息。
|
||||
|
||||
## BStats
|
||||

|
||||
74
README_EN.md
Normal file
74
README_EN.md
Normal file
@@ -0,0 +1,74 @@
|
||||
<img src="./public/image/Luminol_5.png" alt="Logo" align="right" width="250">
|
||||
|
||||
# Luminol
|
||||
<h4>Luminol is a Folia fork with many useful optimizations, configurable vanilla features, and more API supports, and it was designed for survival and anarchy servers</h4>
|
||||
|
||||
[](LICENSE)
|
||||
[](https://github.com/LuminolMC/Luminol/issues)
|
||||

|
||||

|
||||

|
||||
|
||||
**English** | [中文](./README)
|
||||
|
||||
## Features
|
||||
- Configurable vanilla features
|
||||
- Tpsbar support
|
||||
- Linear region file format(from kaiiju)
|
||||
- Useful optimizations to improve the performance of single threaded region
|
||||
- More API support for plugin development (W.I.P)
|
||||
|
||||
## Download
|
||||
Any versions are available in the [release](https://github.com/LuminolMC/Luminol/releases), also you can build it by yourself through [the following steps](./README_EN.md#build).
|
||||
|
||||
## Build
|
||||
To build a paperclip jar, you need to run the following command. You can find the jar in build/libs(Note: JDK17 is needed)
|
||||
|
||||
```shell
|
||||
./gradlew applyPatches && ./gradlew createReobfPaperclipJar
|
||||
```
|
||||
|
||||
## Using API
|
||||
For gradle:
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.20.4-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
For maven
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.earthme.luminol</groupId>
|
||||
<artifactId>luminol-api</artifactId>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## Contact
|
||||
> If you are interested in this project or have any issue, feel free to ask us.
|
||||
|
||||
QQ Group: [368632360](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=MfosKhcDd8Fdxn1MREuZ8Krbf9T6jiBC&authKey=3cm6qdHohON3gHnuD63FK4k07fIbrWnY4hdyq8OmELsfjMVP1kbFTJY9mRyM2Rkj&noverify=0&group_code=368632360) | QQ Channel: [Click To Join](https://pd.qq.com/s/eq9krf9j) | Telegram: [Click To Join](https://t.me/LuminolMC) | Discord: [Click To Join](https://discord.gg/5hgtU72w33)
|
||||
|
||||
> [!WARNING]
|
||||
> **This project is not related to Leaves.Do not report any bugs about protocol support to leaves because the protocol supports are already refactored.**
|
||||
|
||||
## About Issue
|
||||
When you meet any problems, just ask us, we will do our best to solve it, but remember to state your problem clear and provide enough logs etc.</br>
|
||||
|
||||
## Pull Requests
|
||||
See [Contributing](./docs/CONTRIBUTING_EN.md)
|
||||
|
||||
## BStats
|
||||

|
||||
|
||||
## Please ⭐star us!
|
||||
<a href="https://star-history.com/#LuminolMC/Luminol&LuminolMC/LightingLuminol&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
@@ -2,7 +2,7 @@ plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.9"
|
||||
id("io.papermc.paperweight.patcher") version "1.5.11"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
@@ -63,7 +63,7 @@ tasks.generateDevelopmentBundle {
|
||||
libraryRepositories.set(
|
||||
listOf(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
paperMavenPublicUrl,
|
||||
"https://maven.pkg.github.com/LuminolMC/Luminol",
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -98,3 +98,43 @@ paperweight {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.generateDevelopmentBundle {
|
||||
apiCoordinates.set("me.earthme.luminol:luminol-api")
|
||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||
libraryRepositories.addAll(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
paperMavenPublicUrl,
|
||||
)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "githubPackage"
|
||||
url = uri("https://maven.pkg.github.com/LuminolMC/Luminol")
|
||||
|
||||
credentials.username = System.getenv("GITHUB_USERNAME")
|
||||
credentials.password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
|
||||
publications {
|
||||
register<MavenPublication>("gpr") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
if (project.hasProperty("publishDevBundle")) {
|
||||
publications.create<MavenPublication>("devBundle") {
|
||||
artifact(tasks.generateDevelopmentBundle) {
|
||||
artifactId = "dev-bundle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
67
docs/CONTRIBUTING.md
Normal file
67
docs/CONTRIBUTING.md
Normal file
@@ -0,0 +1,67 @@
|
||||
为Luminol贡献代码
|
||||
===========
|
||||
|
||||
[English](./CONTRIBUTING_EN.md) | **中文**
|
||||
|
||||
我们很开心您想为我们的项目做出贡献!一般来说,我们对PR的审核是十分宽松的;
|
||||
但是如果您可以遵守下列的规则,我们可以更快地完成审核。
|
||||
|
||||
## 使用个人账户进行 Fork
|
||||
|
||||
我们会定期尝试合并已有的 PR,如果有一些小问题,会尝试帮您解决这些问题。
|
||||
|
||||
但是如果您使用了组织账号进行 PR,我们就不能对您的 PR 进行修改了。因此我们只能关闭你的PR然后进行手动合并。
|
||||
|
||||
所以,请不要使用组织账号进行 Fork!
|
||||
|
||||
您可以看看 [这个 Issue](https://github.com/isaacs/github/issues/1681) 来了解一下我们为什么无法修改组织账号的 PR。
|
||||
|
||||
## 开发环境
|
||||
|
||||
在开始开发之前,您首先需要拥有以下软件作为开发环境:
|
||||
|
||||
- `git`
|
||||
- `JDK 17 或更高版本`
|
||||
|
||||
## 了解补丁(Patches)
|
||||
|
||||
Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的修改分成了两个目录:
|
||||
|
||||
- `luminol-api` - 对 `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit` 进行的修改。
|
||||
|
||||
补丁系统是基于 git 的,你可以在这里了解 git 的基本内容: <https://git-scm.com/docs/gittutorial>
|
||||
|
||||
如果你已经 Fork 了主储存库,那么下面你应该这么做:
|
||||
|
||||
1. 将你的仓库 clone 到本地;
|
||||
2. 在你的 IDE 或 终端 内执行 Gradle 的 `applyPatches` 任务,如果是在终端内,你可以执行 `./gradlew applyPatches`;
|
||||
3. 进入 `luminol-api` 文件夹进行修改。
|
||||
|
||||
顺便一提,`luminol-api` 并不是正常的 git 仓库:
|
||||
|
||||
- 在应用补丁前,基点将会指向未被更改的源码
|
||||
- 在基点后的每一个提交都是一个补丁
|
||||
- 只有在 Folia 最后一个提交后的提交才会被视为 luminol 补丁
|
||||
|
||||
## 增加补丁
|
||||
|
||||
按照以下步骤增加一个补丁是非常简单的:
|
||||
|
||||
1. 对 `luminol-api` 进行修改;
|
||||
2. 使用 git 添加你的修改,比如 `git add .`;
|
||||
3. 使用 `git commit -m <提交信息>` 进行提交;
|
||||
4. 运行 Gradle 任务 `rebuildPatches` 将你的提交转化为一个补丁;
|
||||
5. 将你生成的补丁文件进行推送。
|
||||
|
||||
这样做以后,你就可以将你的补丁文件进行 PR 提交。
|
||||
|
||||
## 修改补丁
|
||||
|
||||
你可以使用以下方法来修改一个补丁的内容:
|
||||
|
||||
1. 在 HEAD 上直接进行修改;
|
||||
2. 使用 `git commit -a --fixup <hash>` 来进行一个更正提交;
|
||||
- 如果你想要更改提交信息,你也可以用 `--squash` 来代替 `--fixup`。
|
||||
3. 使用 `git rebase -i --autosquash base` 来进行自动变基,你只需要输入 `:q` 来关闭确认页面即可;
|
||||
4. 运行 Gradle 任务 `rebuildPatches` 来修改已被修改的补丁;
|
||||
5. 将修改后的补丁 PR 发回储存库。
|
||||
70
docs/CONTRIBUTING_EN.md
Normal file
70
docs/CONTRIBUTING_EN.md
Normal file
@@ -0,0 +1,70 @@
|
||||
Contributing to Luminol
|
||||
===========
|
||||
|
||||
**English** | [中文](./CONTRIBUTING.md)
|
||||
|
||||
We're glad that you want to contribute to our project!
|
||||
In general, our review of pull requests is very lenient.
|
||||
And if you can follow the rules below, we can complete the review faster.
|
||||
|
||||
## Please fork using your personal account
|
||||
|
||||
We regularly merge existing PRs.
|
||||
If there're some small problems, we'll help you solve them by editing your PR.
|
||||
|
||||
But, if your PR is from a organization, we can NOT edit your PR, so we must merge your PR manually.
|
||||
|
||||
So, don't use orgnization accounts for fork!
|
||||
|
||||
See also [This issue](https://github.com/isaacs/github/issues/1681), and then you'll know why we can't edit PRs from organizations.
|
||||
|
||||
## Development Environment
|
||||
|
||||
Before coding, you need these softwares / tools as Dev Environment.
|
||||
|
||||
- `git`
|
||||
- `JDK 17 or higher`
|
||||
|
||||
## Understanding "Patches"
|
||||
|
||||
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`.
|
||||
|
||||
The patching system is based on git, and you can learn about it at here: <https://git-scm.com/docs/gittutorial>
|
||||
|
||||
If you have forked the main repository, then you should follow the steps below:
|
||||
|
||||
1. Clone your repository to local
|
||||
2. Run Gradle's `applyPatches` task in your IDE or terminal (You can run `./gradlew applyPatches` directly in terminal.)
|
||||
3. Enter `luminol-api` directory to carry out modifications.
|
||||
|
||||
BTW, `luminol-api` 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.
|
||||
- Only commits after the last commit of Paper will be considered Luminol' patches.
|
||||
|
||||
## Adding new patches
|
||||
|
||||
It's very easy to to add patches by following the steps below:
|
||||
|
||||
1. Modify the code of `luminol-api`
|
||||
2. Add these changes to the local git repository (For example, `git add .`)
|
||||
3. Commit these changes using `git commit -m <Commit Message>`
|
||||
4. Run Gradle's task `rebuildPatches` to convert your commits to a new patch
|
||||
5. Push your patches to your repository
|
||||
|
||||
After pushing, you can open a PR to submit your patches.
|
||||
|
||||
## Modifying patches
|
||||
|
||||
You can modify a 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
|
||||
- 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 `rebuildPatches` to modify existing patches
|
||||
5. Push and PR again
|
||||
@@ -1,9 +1,13 @@
|
||||
group = me.earthme.luminol
|
||||
version = 1.20.4-R0.1-SNAPSHOT
|
||||
|
||||
foliaCommit = 32ff12e4dc360df395d093d8b72dda150d64bc34
|
||||
foliaCommit = ef2c6971891b7571261591cd22d27ff555c5d3f2
|
||||
|
||||
org.gradle.caching = true
|
||||
org.gradle.parallel = true
|
||||
org.gradle.vfs.watch = false
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
|
||||
mcVersion=1.20.4
|
||||
GroupMCV=1.20
|
||||
preVersion=false
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: M2ke4U <79621885+MrHua269@users.noreply.github.com>
|
||||
Date: Sun, 24 Dec 2023 12:11:45 +0800
|
||||
Subject: [PATCH] Added maven publish
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 3e3ea0e4e4ceb3283ad2b99957e3795d66a9a716..0f1846c506cbe25cdd37b8f4b7fd9f7aef2bf0b9 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -199,3 +199,23 @@ tasks.check {
|
||||
dependsOn(scanJarForOldGeneratedCode)
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+// Luminol start
|
||||
+publishing {
|
||||
+ repositories {
|
||||
+ maven {
|
||||
+ name = "githubPackage"
|
||||
+ url = uri("https://maven.pkg.github.com/LuminolMC/Luminol")
|
||||
+
|
||||
+ credentials.username = System.getenv("GITHUB_USERNAME")
|
||||
+ credentials.password = System.getenv("GITHUB_TOKEN")
|
||||
+ }
|
||||
+
|
||||
+ publications {
|
||||
+ register<MavenPublication>("gpr") {
|
||||
+ from(components["java"])
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+// Luminol end
|
||||
\ No newline at end of file
|
||||
@@ -0,0 +1,101 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 9 Feb 2024 03:32:05 +0000
|
||||
Subject: [PATCH] Threaded region start tick and finished tick event
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/api/events/TickRegionFinishedTickEvent.java b/src/main/java/me/earthme/luminol/api/events/TickRegionFinishedTickEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..29b98728d3ca4a439c6b3333cd123c0e0b8a2846
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/api/events/TickRegionFinishedTickEvent.java
|
||||
@@ -0,0 +1,42 @@
|
||||
+package me.earthme.luminol.api.events;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a region finished its tick task.
|
||||
+ */
|
||||
+public class TickRegionFinishedTickEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final long currTime;
|
||||
+ private final long regionId;
|
||||
+
|
||||
+ public TickRegionFinishedTickEvent(long currTime, long regionId) {
|
||||
+ this.currTime = currTime;
|
||||
+ this.regionId = regionId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the time of tick end
|
||||
+ * @return The time of tick end in nanoseconds
|
||||
+ */
|
||||
+ public long getFinishedTime() {
|
||||
+ return this.currTime;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the id of current region
|
||||
+ * Notice: The id of global region is -1 in this event
|
||||
+ * @return The id of current region
|
||||
+ */
|
||||
+ public long getRegionId() {
|
||||
+ return this.regionId;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/api/events/TickRegionStartTickEvent.java b/src/main/java/me/earthme/luminol/api/events/TickRegionStartTickEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1f3cba43ebd873965c24b96ca116abfb149ab4e6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/api/events/TickRegionStartTickEvent.java
|
||||
@@ -0,0 +1,41 @@
|
||||
+package me.earthme.luminol.api.events;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a tick was started.
|
||||
+ */
|
||||
+public class TickRegionStartTickEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final long currTime;
|
||||
+ private final long regionId;
|
||||
+
|
||||
+ public TickRegionStartTickEvent(long currTime, long regionId) {
|
||||
+ this.currTime = currTime;
|
||||
+ this.regionId = regionId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the id of current region
|
||||
+ * Notice: The id of global region is -1 in this event
|
||||
+ * @return The id of current region
|
||||
+ */
|
||||
+ public long getRegionId() {
|
||||
+ return this.regionId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the time of tick start
|
||||
+ * @return The time of tick start in nanoseconds
|
||||
+ */
|
||||
+ public long getStartTime(){
|
||||
+ return this.currTime;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
129
patches/api/0002-Leaves-Replay-Mod-API.patch
Normal file
129
patches/api/0002-Leaves-Replay-Mod-API.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sun, 17 Mar 2024 00:00:45 +0000
|
||||
Subject: [PATCH] Leaves Replay Mod API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 4d6de4f2c67b1f122768806443766bd20c5ae617..b5155ffe86c490252fd0fcd1a00581e09808eeee 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2886,4 +2886,10 @@ public final class Bukkit {
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
}
|
||||
+
|
||||
+ // Leaves start - Photographer API
|
||||
+ public static @NotNull top.leavesmc.leaves.entity.PhotographerManager getPhotographerManager() {
|
||||
+ return server.getPhotographerManager();
|
||||
+ }
|
||||
+ // Leaves end - Photographer API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index d46f932b595495816ea038cf161bc7f2d85f177e..7d8a9bab880656e34d8c4dceb4dea3b0c1ced4c8 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2518,4 +2518,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public boolean isGlobalTickThread();
|
||||
// Folia end - region threading API
|
||||
+
|
||||
+ // Leaves start - Photographer API
|
||||
+ @NotNull top.leavesmc.leaves.entity.PhotographerManager getPhotographerManager();
|
||||
+ // Leaves end - Photographer API
|
||||
}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/entity/Photographer.java b/src/main/java/top/leavesmc/leaves/entity/Photographer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bfa6fe2a0ca095170aa5e073251402cf83a53ba0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/entity/Photographer.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package top.leavesmc.leaves.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.io.File;
|
||||
+
|
||||
+public interface Photographer extends Player {
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getId();
|
||||
+
|
||||
+ public void setRecordFile(@NotNull File file);
|
||||
+
|
||||
+ public void stopRecording();
|
||||
+
|
||||
+ public void stopRecording(boolean async);
|
||||
+
|
||||
+ public void stopRecording(boolean async, boolean save);
|
||||
+
|
||||
+ public void pauseRecording();
|
||||
+
|
||||
+ public void resumeRecording();
|
||||
+
|
||||
+ public void setFollowPlayer(@Nullable Player player);
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/entity/PhotographerManager.java b/src/main/java/top/leavesmc/leaves/entity/PhotographerManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2889a4835edea4254a3d35fc7861983644a1dc4b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/entity/PhotographerManager.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package top.leavesmc.leaves.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.util.Consumer;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import top.leavesmc.leaves.replay.BukkitRecorderOption;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+public interface PhotographerManager {
|
||||
+ @Nullable
|
||||
+ public Photographer getPhotographer(@NotNull UUID uuid);
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Photographer getPhotographer(@NotNull String id);
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location);
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
|
||||
+
|
||||
+ public void removePhotographer(@NotNull String id);
|
||||
+
|
||||
+ public void removePhotographer(@NotNull UUID uuid);
|
||||
+
|
||||
+ public void removeAllPhotographers();
|
||||
+
|
||||
+ public Collection<Photographer> getPhotographers();
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/replay/BukkitRecorderOption.java b/src/main/java/top/leavesmc/leaves/replay/BukkitRecorderOption.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3df4a6055b91c28e273d6fb2697b608778f40a9c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/replay/BukkitRecorderOption.java
|
||||
@@ -0,0 +1,18 @@
|
||||
+package top.leavesmc.leaves.replay;
|
||||
+
|
||||
+public class BukkitRecorderOption {
|
||||
+
|
||||
+ // public int recordDistance = -1;
|
||||
+ public String serverName = "Leaves";
|
||||
+ public BukkitRecordWeather forceWeather = BukkitRecordWeather.NULL;
|
||||
+ public int forceDayTime = -1;
|
||||
+ public boolean ignoreChat = false;
|
||||
+ // public boolean ignoreItem = false;
|
||||
+
|
||||
+ public enum BukkitRecordWeather {
|
||||
+ CLEAR,
|
||||
+ RAIN,
|
||||
+ THUNDER,
|
||||
+ NULL
|
||||
+ }
|
||||
+}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix build
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 959e62d800de05b2dd77a252f442c3daf8438490..b9c5ef4d15aa97a380419912e3ee09d094ae752e 100644
|
||||
index 905262067dabc7cbe5b08639fcefd3a996a937e0..c0608731dd7a352628a1e31997d0658dfa9f2ea8 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating
|
||||
@@ -17,7 +17,7 @@ index 959e62d800de05b2dd77a252f442c3daf8438490..b9c5ef4d15aa97a380419912e3ee09d0
|
||||
implementation("io.papermc.paper:paper-mojangapi:${project.version}") {
|
||||
exclude("io.papermc.paper", "paper-api")
|
||||
}
|
||||
@@ -73,7 +73,7 @@ tasks.jar {
|
||||
@@ -75,7 +75,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ Subject: [PATCH] Empty config file base
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index b9c5ef4d15aa97a380419912e3ee09d094ae752e..e837f1f9b444318cbee8719b9dd0eb669478742e 100644
|
||||
index 48e9f6ff317bfc7077563e9c651d2a90da6bb37a..d4baa7a193eba22be23921029ca4808a73de063d 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -19,6 +19,7 @@ dependencies {
|
||||
@@ -16,6 +16,82 @@ index b9c5ef4d15aa97a380419912e3ee09d094ae752e..e837f1f9b444318cbee8719b9dd0eb66
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
diff --git a/src/main/java/me/earthme/luminol/commands/LuminolConfigCommand.java b/src/main/java/me/earthme/luminol/commands/LuminolConfigCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5c8745dffa80cf47e856d04d283937bda86881f8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/commands/LuminolConfigCommand.java
|
||||
@@ -0,0 +1,70 @@
|
||||
+package me.earthme.luminol.commands;
|
||||
+
|
||||
+import me.earthme.luminol.config.LuminolConfig;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+
|
||||
+public class LuminolConfigCommand extends Command {
|
||||
+ public LuminolConfigCommand(){
|
||||
+ super("luminolconfig");
|
||||
+ this.setPermission("luminol.commands.luminolconfig");
|
||||
+ this.setDescription("Manage config file");
|
||||
+ this.setUsage("/luminolconfig");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args, @Nullable Location location) throws IllegalArgumentException {
|
||||
+ final List<String> result = new ArrayList<>();
|
||||
+
|
||||
+ if (args.length == 1){
|
||||
+ result.add("reload");
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
|
||||
+ if (!this.testPermission(sender)){
|
||||
+ sender.sendMessage(Component
|
||||
+ .text("No permission to execute this command!")
|
||||
+ .color(TextColor.color(255,0,0))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ if (args.length < 1){
|
||||
+ sender.sendMessage(
|
||||
+ Component
|
||||
+ .text("Wrong use!\n")
|
||||
+ .color(TextColor.color(255,0,0))
|
||||
+ );
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ switch (args[0]){
|
||||
+ case "reload" -> {
|
||||
+ LuminolConfig.reloadAsync().thenAccept(nullValue -> sender.sendMessage(
|
||||
+ Component
|
||||
+ .text("Reloaded config file!")
|
||||
+ .color(TextColor.color(0,255,0))
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ default -> sender.sendMessage(
|
||||
+ Component
|
||||
+ .text("Unknown action!\n")
|
||||
+ .color(TextColor.color(255,0,0))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/ConfigInfo.java b/src/main/java/me/earthme/luminol/config/ConfigInfo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..01b64c2cf6b437114337626c242e1da3fbdb8ead
|
||||
@@ -71,6 +147,20 @@ index 0000000000000000000000000000000000000000..ac2a92fe0ddbebb71ea4dd8c96f461d0
|
||||
+ return this.baseKeyName;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/HotReloadUnsupported.java b/src/main/java/me/earthme/luminol/config/HotReloadUnsupported.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..559c11cb523c7cade34a0abfad15c988f5ad87fe
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/HotReloadUnsupported.java
|
||||
@@ -0,0 +1,8 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import java.lang.annotation.Retention;
|
||||
+import java.lang.annotation.RetentionPolicy;
|
||||
+
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+public @interface HotReloadUnsupported {
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/IConfigModule.java b/src/main/java/me/earthme/luminol/config/IConfigModule.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9f6896711907ac30fe0c00130207b970007e4bb4
|
||||
@@ -101,13 +191,18 @@ index 0000000000000000000000000000000000000000..9f6896711907ac30fe0c00130207b970
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/LuminolConfig.java b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a52b3b8a6
|
||||
index 0000000000000000000000000000000000000000..2b4e64796bf01b0a5fcb306850cd60837ed4d36b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
@@ -0,0 +1,184 @@
|
||||
@@ -0,0 +1,218 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import io.papermc.paper.threadedregions.RegionizedServer;
|
||||
+import me.earthme.luminol.commands.LuminolConfigCommand;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.io.File;
|
||||
@@ -120,6 +215,7 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+import java.net.URLDecoder;
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+import java.util.*;
|
||||
+import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.jar.JarEntry;
|
||||
+import java.util.jar.JarFile;
|
||||
+
|
||||
@@ -132,7 +228,34 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ private static final File baseConfigFile = new File(baseConfigFolder,"luminol_global_config.toml");
|
||||
+ private static final Set<IConfigModule> allInstanced = new HashSet<>();
|
||||
+ private static CommentedFileConfig configFileInstance;
|
||||
+
|
||||
+ public static boolean alreadyInited = false;
|
||||
+ private static MinecraftInternalPlugin NULL_PLUGIN = new MinecraftInternalPlugin();
|
||||
+
|
||||
+ public static void setupLatch(){
|
||||
+ Bukkit.getCommandMap().register("luminolconfig","luminol",new LuminolConfigCommand());
|
||||
+ alreadyInited = true;
|
||||
+ }
|
||||
+
|
||||
+ public static void reload(){
|
||||
+ RegionizedServer.ensureGlobalTickThread("Reload luminol config off global region thread!");
|
||||
+
|
||||
+ dropAllInstanced();
|
||||
+ try {
|
||||
+ loadConfig();
|
||||
+ }catch (Exception e){
|
||||
+ logger.error(e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Contract(" -> new")
|
||||
+ public static @NotNull CompletableFuture<Void> reloadAsync(){
|
||||
+ return CompletableFuture.runAsync(LuminolConfig::reload,task -> Bukkit.getGlobalRegionScheduler().run(NULL_PLUGIN,scheduled -> task.run()));
|
||||
+ }
|
||||
+
|
||||
+ public static void dropAllInstanced(){
|
||||
+ allInstanced.clear();
|
||||
+ }
|
||||
+
|
||||
+ public static void loadConfig() throws IOException {
|
||||
+ baseConfigFolder.mkdirs();
|
||||
+
|
||||
@@ -147,9 +270,8 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ try {
|
||||
+ instanceAllModule();
|
||||
+ loadAllModules();
|
||||
+ System.out.println(allInstanced.size());
|
||||
+ }catch (Exception e){
|
||||
+ e.printStackTrace();
|
||||
+ logger.error("Failed to load config modules!",e);
|
||||
+ }
|
||||
+
|
||||
+ configFileInstance.save();
|
||||
@@ -177,7 +299,7 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ for (Field field : fields) {
|
||||
+ int modifiers = field.getModifiers();
|
||||
+ if (Modifier.isStatic(modifiers) && !Modifier.isFinal(modifiers)) {
|
||||
+ boolean skipLoad = field.getAnnotation(DoNotLoad.class) != null;
|
||||
+ boolean skipLoad = field.getAnnotation(DoNotLoad.class) != null || (alreadyInited && field.getAnnotation(HotReloadUnsupported.class) != null);
|
||||
+ ConfigInfo configInfo = field.getAnnotation(ConfigInfo.class);
|
||||
+
|
||||
+ if (skipLoad || configInfo == null){
|
||||
@@ -206,18 +328,17 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+
|
||||
+ final Object actuallyValue = configFileInstance.get(fullConfigKeyName);
|
||||
+ field.set(null,actuallyValue);
|
||||
+
|
||||
+
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ singleConfigModule.onLoaded(configFileInstance);
|
||||
+ }
|
||||
+
|
||||
+ public static Set<Class<?>> getClasses(String pack) {
|
||||
+ Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
|
||||
+ public static @NotNull Set<Class<?>> getClasses(String pack) {
|
||||
+ Set<Class<?>> classes = new LinkedHashSet<>();
|
||||
+ String packageDirName = pack.replace('.', '/');
|
||||
+ Enumeration<URL> dirs;
|
||||
+
|
||||
+ try {
|
||||
+ dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName);
|
||||
+ while (dirs.hasMoreElements()) {
|
||||
@@ -233,21 +354,24 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ Enumeration<JarEntry> entries = jar.entries();
|
||||
+ findClassesInPackageByJar(pack, entries, packageDirName, classes);
|
||||
+ } catch (IOException e) {
|
||||
+ e.printStackTrace();
|
||||
+ throw new RuntimeException(e);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (IOException e) {
|
||||
+ e.printStackTrace();
|
||||
+ throw new RuntimeException(e);
|
||||
+ }
|
||||
+
|
||||
+ return classes;
|
||||
+ }
|
||||
+
|
||||
+ private static void findClassesInPackageByFile(String packageName, String packagePath, Set<Class<?>> classes) {
|
||||
+ File dir = new File(packagePath);
|
||||
+
|
||||
+ if (!dir.exists() || !dir.isDirectory()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ File[] dirfiles = dir.listFiles((file) -> file.isDirectory() || file.getName().endsWith(".class"));
|
||||
+ if (dirfiles != null) {
|
||||
+ for (File file : dirfiles) {
|
||||
@@ -258,7 +382,7 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ try {
|
||||
+ classes.add(Class.forName(packageName + '.' + className));
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ e.printStackTrace();
|
||||
+ throw new RuntimeException(e);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@@ -282,7 +406,7 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ try {
|
||||
+ classes.add(Class.forName(packageName + '.' + className));
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ e.printStackTrace();
|
||||
+ throw new RuntimeException(e);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@@ -290,7 +414,7 @@ index 0000000000000000000000000000000000000000..caeb3249c2d99cc920f7a3e6380a263a
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 0f8c868fce0a054a0ba356350baf4c3824c2c958..d99e0acf0000c566fdb1bffb149ec13a55d7c8dd 100644
|
||||
index 6b3242117d62175de462d04e4d178b49ae2521e9..4744ace98d1741db80ac2aea198f332d95c0ba33 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -19,6 +19,8 @@ import java.util.Locale;
|
||||
@@ -302,11 +426,12 @@ index 0f8c868fce0a054a0ba356350baf4c3824c2c958..d99e0acf0000c566fdb1bffb149ec13a
|
||||
import net.minecraft.DefaultUncaughtExceptionHandler;
|
||||
import net.minecraft.DefaultUncaughtExceptionHandlerWithName;
|
||||
import net.minecraft.SharedConstants;
|
||||
@@ -209,6 +211,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -209,6 +211,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
+ LuminolConfig.loadConfig(); //Luminol - load config file
|
||||
+ LuminolConfig.setupLatch(); //Luminol - load config file
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
this.getProfileCache().save(false); // Paper
|
||||
|
||||
@@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..94e7c8910e3623163528a844fd7a08b3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 22aff010859dded150b6e3dd0644fe3c38dbaea9..4468e6fdbbe527111f4410188f2f2df7f592f81e 100644
|
||||
index 8c9a80197247a384dd80747bf23fdd809d08b341..0d756dd5181a2444175184227bef648d07c17236 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1954,7 +1954,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1963,7 +1963,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Add config for unsafe teleportation
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ea10d8d38ecdb791b7b2a748496791c04eff5997
|
||||
index 0000000000000000000000000000000000000000..1b0de6f0ccab72c409a63dc1904829008e30328e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..ea10d8d38ecdb791b7b2a748496791c0
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class UnsafeTeleportationConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ @ConfigInfo(baseName = "enabled", comments = "If you want to use sand duping,please turn on this")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
@@ -27,14 +27,14 @@ index 0000000000000000000000000000000000000000..ea10d8d38ecdb791b7b2a748496791c0
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "unsafe_teleportation";
|
||||
+ return "allow_unsafe_teleportation";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index eade31ea668c171dceafee958e265041a439c54b..6b560754382936d4889e5729613077a3401d8740 100644
|
||||
index 1d77bc6bdb87de1ad6c8740376391dedcaa73089..5e3a5e6b05254481ad413069b249ef554b591f8c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4043,6 +4043,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -4065,6 +4065,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
|
||||
protected boolean tryEndPortal() {
|
||||
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
|
||||
@@ -43,7 +43,7 @@ index eade31ea668c171dceafee958e265041a439c54b..6b560754382936d4889e5729613077a3
|
||||
ServerLevel world = this.portalWorld;
|
||||
this.portalBlock = null;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
index a0c1db8cfebaa0344012cc0af18d6231cdcdcbb8..cb174f06f9701cc4f0ff479649f39ee9aa63a97a 100644
|
||||
index afc9445941b984cc1122839e4a8a17cf27aa966e..0eb328e2b32179ebeefc90063441a1510e0058b8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
@@ -61,6 +61,13 @@ public class EndPortalBlock extends BaseEntityBlock {
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 00:56:34 +0000
|
||||
Subject: [PATCH] Add config for sand duping
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/SandDupingFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/SandDupingFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cacb1f51a28eaa260aedba8d5b541475605e36ea
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/SandDupingFixConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class SandDupingFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.FIXES;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "sand_duping";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 25b7b85cbd1130c5320e55b3c6b6f81ec228da81..c43f710a558cfe887a373a94ee48c4804986186d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -133,7 +133,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@Override
|
||||
public void tick() {
|
||||
// Paper start - fix sand duping
|
||||
- if (this.isRemoved()) {
|
||||
+ if (!me.earthme.luminol.config.modules.fixes.SandDupingFixConfig.enabled && this.isRemoved()) { //Luminol - Add config for sand duping
|
||||
return;
|
||||
}
|
||||
// Paper end - fix sand duping
|
||||
@@ -149,7 +149,7 @@ public class FallingBlockEntity extends Entity {
|
||||
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
// Paper start - fix sand duping
|
||||
- if (this.isRemoved()) {
|
||||
+ if (!me.earthme.luminol.config.modules.fixes.SandDupingFixConfig.enabled && this.isRemoved()) { //Luminol - Add config for sand duping
|
||||
return;
|
||||
}
|
||||
// Paper end - fix sand duping
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Add config for void trading
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/VoidTradingFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/VoidTradingFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a72f3a6cf1580f901b12417cac10303090a3370f
|
||||
index 0000000000000000000000000000000000000000..22f3c6c70e4287f1bdd0b18f87f57efeb20140a2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/VoidTradingFixConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -27,14 +27,14 @@ index 0000000000000000000000000000000000000000..a72f3a6cf1580f901b12417cac103030
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "void_trading";
|
||||
+ return "allow_void_trading";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index a16fc5ba55dbde0cf7f968884da40d70a754a0d8..9e82dc98ef2d4da39839699f455e0ef20ab4ef65 100644
|
||||
index 81749b8da7182abd1bf35629f33388e813dbeac0..10df17ad79092f3e226df08e58620694b3581758 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -3046,7 +3046,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -3045,7 +3045,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
// Paper start - Fix merchant inventory not closing on entity removal
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Add config for vanilla random
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/VanillaRandomSourceConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/VanillaRandomSourceConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8ba66e737d36157b3797c308cb9fca804e396915
|
||||
index 0000000000000000000000000000000000000000..ee247014c9a2ec1bbb7f25ef41da110a270154d6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/VanillaRandomSourceConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -27,14 +27,14 @@ index 0000000000000000000000000000000000000000..8ba66e737d36157b3797c308cb9fca80
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "vanilla_random_source";
|
||||
+ return "use_vanilla_random_source";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6b560754382936d4889e5729613077a3401d8740..865804a16fce714497b2c025a869f972787442e3 100644
|
||||
index 5e3a5e6b05254481ad413069b249ef554b591f8c..9bbfac91f97331b1b558264c867b7e00185291f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -563,7 +563,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -567,7 +567,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 01:05:57 +0000
|
||||
Subject: [PATCH] Add config for incorrect tripwire updating fixing
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/IncorrectTripwireFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/IncorrectTripwireFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8779c9fba1990c62e010387e32d1923410a043ed
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/IncorrectTripwireFixConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class IncorrectTripwireFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.FIXES;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "update_incorrect_trip_wire";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 7f2dcf6a9e69779e6f898284b58fb1e32902000c..e1a7208b76e4dc7f388923d72edeceb6daefa774 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -162,7 +162,7 @@ public class TripWireHookBlock extends Block {
|
||||
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);
|
||||
|
||||
flag5 |= flag6 && flag7;
|
||||
- if (k != i || !tripWireBeingRemoved || !flag6) // Paper - fix tripwire state inconsistency; don't update the tripwire again if being removed and not disarmed
|
||||
+ if (k != i || !tripWireBeingRemoved || !flag6 || me.earthme.luminol.config.modules.fixes.IncorrectTripwireFixConfig.enabled) // Paper - don't update the tripwire again if being removed and not disarmed //Luminol - Add config for incorrect tripwire updating fixing
|
||||
aiblockdata[k] = iblockdata2;
|
||||
if (k == i) {
|
||||
world.scheduleTick(pos, block, 10);
|
||||
@@ -6,14 +6,19 @@ Subject: [PATCH] Add a simple tpsbar
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/commands/TpsBarCommand.java b/src/main/java/me/earthme/luminol/commands/TpsBarCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ac8f0e3bf130ba6dfd7202e2f480352218154cdc
|
||||
index 0000000000000000000000000000000000000000..01677f210fae53a108bfe194189cb4c233e9fa47
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/commands/TpsBarCommand.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,50 @@
|
||||
+package me.earthme.luminol.commands;
|
||||
+
|
||||
+import me.earthme.luminol.config.modules.misc.TpsBarConfig;
|
||||
+import me.earthme.luminol.functions.GlobalServerTpsBar;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import net.kyori.adventure.util.RGBLike;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.Color;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.entity.Player;
|
||||
@@ -33,18 +38,23 @@ index 0000000000000000000000000000000000000000..ac8f0e3bf130ba6dfd7202e2f4803522
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!TpsBarConfig.tpsbarEnabled){
|
||||
+ sender.sendMessage(Component.text("Tpsbar was already disabled!").color(TextColor.color(255,0,0)));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!(sender instanceof Player player)){
|
||||
+ sender.sendMessage(ChatColor.RED+"Only player can use this command!");
|
||||
+ sender.sendMessage(Component.text("Only player can use this command!").color(TextColor.color(255,0,0)));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (GlobalServerTpsBar.isPlayerVisible(player)) {
|
||||
+ player.sendMessage(ChatColor.BLUE + "Disabled tps bar");
|
||||
+ player.sendMessage(Component.text("Disabled tps bar").color(TextColor.color(0,255,0)));
|
||||
+ GlobalServerTpsBar.setVisibilityForPlayer(player,false);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ player.sendMessage(ChatColor.GREEN + "Enabled tps bar");
|
||||
+ player.sendMessage(Component.text("Enabled tps bar").color(TextColor.color(0,255,0)));
|
||||
+ GlobalServerTpsBar.setVisibilityForPlayer(player,true);
|
||||
+
|
||||
+ return true;
|
||||
@@ -52,17 +62,15 @@ index 0000000000000000000000000000000000000000..ac8f0e3bf130ba6dfd7202e2f4803522
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/TpsBarConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/TpsBarConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b370787c3f525b9b978ad14b3e7056d7c92fcae5
|
||||
index 0000000000000000000000000000000000000000..aafb2f5052c7c8e5971a47308253badb3027093c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/TpsBarConfig.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,49 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.commands.TpsBarCommand;
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.*;
|
||||
+import me.earthme.luminol.functions.GlobalServerTpsBar;
|
||||
+import org.bukkit.Bukkit;
|
||||
+
|
||||
@@ -77,6 +85,11 @@ index 0000000000000000000000000000000000000000..b370787c3f525b9b978ad14b3e7056d7
|
||||
+ public static List<String> tpsColors = List.of("GREEN","YELLOW","RED","PURPLE");
|
||||
+ @ConfigInfo(baseName = "ping_color_list")
|
||||
+ public static List<String> pingColors = List.of("GREEN","YELLOW","RED","PURPLE");
|
||||
+ @ConfigInfo(baseName = "update_interval_ticks")
|
||||
+ public static int updateInterval = 15;
|
||||
+
|
||||
+ @DoNotLoad
|
||||
+ private static boolean inited = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
@@ -92,16 +105,22 @@ index 0000000000000000000000000000000000000000..b370787c3f525b9b978ad14b3e7056d7
|
||||
+ public void onLoaded(CommentedFileConfig configInstance){
|
||||
+ if (tpsbarEnabled){
|
||||
+ GlobalServerTpsBar.init();
|
||||
+ }else{
|
||||
+ GlobalServerTpsBar.cancelBarUpdateTask();
|
||||
+ }
|
||||
+
|
||||
+ if (!inited){
|
||||
+ Bukkit.getCommandMap().register("tpsbar","luminol",new TpsBarCommand("tpsbar"));
|
||||
+ inited = true;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7511bc3f6828ab712f644cf4292a5f831e8c8653
|
||||
index 0000000000000000000000000000000000000000..3f1478dde900d671c4bfa43df80f629519cd602e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
@@ -0,0 +1,206 @@
|
||||
@@ -0,0 +1,225 @@
|
||||
+package me.earthme.luminol.functions;
|
||||
+
|
||||
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
|
||||
@@ -133,18 +152,37 @@ index 0000000000000000000000000000000000000000..7511bc3f6828ab712f644cf4292a5f83
|
||||
+ private static final Logger logger = LogManager.getLogger();
|
||||
+
|
||||
+ public static void init(){
|
||||
+ Bukkit.getAsyncScheduler().runAtFixedRate(NULL_PLUGIN,c -> {
|
||||
+ cancelBarUpdateTask();
|
||||
+
|
||||
+ Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN,c -> {
|
||||
+ tpsbarTask = c;
|
||||
+ try {
|
||||
+ update();
|
||||
+ }catch (Exception e){
|
||||
+ logger.error(e);
|
||||
+ }
|
||||
+ },1,1, TimeUnit.SECONDS);
|
||||
+ },1,TpsBarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ public static void removeAllBars(){
|
||||
+ for (Map.Entry<UUID,BossBar> barEntry : uuid2Bossbars.entrySet()){
|
||||
+ final UUID playerUUID = barEntry.getKey();
|
||||
+ final BossBar tpsBar = barEntry.getValue();
|
||||
+
|
||||
+ final Player targetPlayer = Bukkit.getPlayer(playerUUID);{
|
||||
+ if (targetPlayer != null){
|
||||
+ targetPlayer.hideBossBar(tpsBar);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ uuid2Bossbars.clear();
|
||||
+ }
|
||||
+
|
||||
+ public static void cancelBarUpdateTask(){
|
||||
+ if (tpsbarTask == null){
|
||||
+ removeAllBars();
|
||||
+
|
||||
+ if (tpsbarTask == null || tpsbarTask.isCancelled()){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -309,10 +347,10 @@ index 0000000000000000000000000000000000000000..7511bc3f6828ab712f644cf4292a5f83
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index d99e0acf0000c566fdb1bffb149ec13a55d7c8dd..9c5d4cab2e2ec03f5413cfc9d809f2f148f0ba4d 100644
|
||||
index 4744ace98d1741db80ac2aea198f332d95c0ba33..550fb11c64e3adb35bb7f78c53f0b5ae5ce9ff58 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -830,6 +830,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -832,6 +832,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
@Override
|
||||
public void stopServer() {
|
||||
@@ -321,7 +359,7 @@ index d99e0acf0000c566fdb1bffb149ec13a55d7c8dd..9c5d4cab2e2ec03f5413cfc9d809f2f1
|
||||
//Util.shutdownExecutors(); // Paper - moved into super
|
||||
SkullBlockEntity.clear();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c8ee0307fa6c13c34a1db80ddf65d8381fd556be..92a2e116f47d1434cc406709c3bcf85fedd2bb86 100644
|
||||
index cbc89b8898f9243776af88c2b04ad3c2e4e23fb6..318cb1e98a3d73b7893f07c9f0db3adab801b67e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -285,6 +285,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -333,10 +371,10 @@ index c8ee0307fa6c13c34a1db80ddf65d8381fd556be..92a2e116f47d1434cc406709c3bcf85f
|
||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances getViewDistances() {
|
||||
return this.viewDistances.get();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index fc301fcf812b79ac7ceae710132a762f101b82b2..f4b7f2f223964df7533577342d8af158af35363b 100644
|
||||
index d2902fc7f3b7af59f181bd1e12435d946db7ad23..26f70965b45fa3c344781b569a651a4668d0621d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2257,6 +2257,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2287,6 +2287,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
handle.expToDrop = data.getInt("expToDrop");
|
||||
handle.keepLevel = data.getBoolean("keepLevel");
|
||||
}
|
||||
@@ -346,7 +384,7 @@ index fc301fcf812b79ac7ceae710132a762f101b82b2..f4b7f2f223964df7533577342d8af158
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2278,6 +2281,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2308,6 +2311,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
data.putLong("lastPlayed", System.currentTimeMillis());
|
||||
data.putString("lastKnownName", handle.getScoreboardName());
|
||||
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..502b93c7bda9e8577a1901a8777b7cf9
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 9c5d4cab2e2ec03f5413cfc9d809f2f148f0ba4d..f88c42852555461ec6a2e868adbce55227da38f0 100644
|
||||
index 550fb11c64e3adb35bb7f78c53f0b5ae5ce9ff58..71151811c36c75ace1e41837123b320ae48a4b53 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -282,7 +282,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -284,7 +284,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
||||
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
||||
// Paper end - Add Velocity IP Forwarding Support
|
||||
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Tue, 20 Feb 2024 13:10:07 +0000
|
||||
Subject: [PATCH] Add config for out-of-order chat checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/InorderChatConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/InorderChatConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83176a8a7e993b51a0663b0f76161884abbf4951
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/InorderChatConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class InorderChatConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "mojang_out_of_order_chat_check";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
index ba12919c3f9aec34a9e64993b143ae92be5eb172..ba983d557ae16b3fbb7d0ea6ff67666a809d2e99 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
@@ -38,7 +38,7 @@ public class SignedMessageChain {
|
||||
throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false); // Paper - diff on change (if disconnects, need a new kick event cause)
|
||||
} else if (playerPublicKey.data().hasExpired()) {
|
||||
throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
|
||||
- } else if (body.timeStamp().isBefore(this.lastTimeStamp)) {
|
||||
+ } else if (me.earthme.luminol.config.modules.misc.InorderChatConfig.enabled && body.timeStamp().isBefore(this.lastTimeStamp)) { // Luminol - Add config for out-of-order chat checks
|
||||
throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
|
||||
} else {
|
||||
this.lastTimeStamp = body.timeStamp();
|
||||
257
patches/server/0013-Add-a-simple-watchdog-for-tick-regions.patch
Normal file
257
patches/server/0013-Add-a-simple-watchdog-for-tick-regions.patch
Normal file
@@ -0,0 +1,257 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sun, 10 Mar 2024 05:04:33 +0000
|
||||
Subject: [PATCH] Add a simple watchdog for tick regions
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
index fc3d332aa1c1d469cedfe2aaa7102dcd78e25642..1ae61bc6603dd3ac290e3ead20416f9c5b63ff02 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
@@ -279,6 +279,7 @@ public final class RegionizedServer {
|
||||
*/
|
||||
|
||||
private void globalTick(final int tickCount) {
|
||||
+ me.earthme.luminol.utils.LuminolWatchDog.globalRegionHeartBeat(); //Luminol
|
||||
/*
|
||||
if (false) {
|
||||
io.papermc.paper.threadedregions.ThreadedTicketLevelPropagator.main(null);
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
index 531aa50f2c84e13358e8918bb0c15ea3cd036cb5..fd0053369eb68f0fd596d8acfba4a5247ef8105a 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
@@ -167,6 +167,8 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
|
||||
if (removed != region) {
|
||||
throw new IllegalStateException("Expected to remove " + region + ", but removed " + removed);
|
||||
}
|
||||
+
|
||||
+ me.earthme.luminol.utils.LuminolWatchDog.onRegionDeath(region); //Luminol - Simple watchdog
|
||||
}
|
||||
|
||||
public int getSectionCoordinate(final int chunkCoordinate) {
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegions.java b/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
|
||||
index 2ad25dd345ab42125d456f2b9cf67d8c4515c8b7..78c50292fb25e8703e9c91db892f05456f07d72f 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
|
||||
@@ -402,6 +402,7 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
|
||||
|
||||
@Override
|
||||
protected void tickRegion(final int tickCount, final long startTime, final long scheduledEnd) {
|
||||
+ me.earthme.luminol.utils.LuminolWatchDog.tickRegionHeartBeat(); //Luminol - Simple watchdog
|
||||
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
|
||||
profiler.startTick(); try { // Folia - profiler
|
||||
MinecraftServer.getServer().tickServer(startTime, scheduledEnd, TimeUnit.MILLISECONDS.toMillis(10L), this.region);
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/WatchdogConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/WatchdogConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..71d80b401470db777a86274d32f178bb2aa023d5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/WatchdogConfig.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.HotReloadUnsupported;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class WatchdogConfig implements IConfigModule {
|
||||
+
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+ @ConfigInfo(baseName = "warn_period_ticks")
|
||||
+ public static long warnPeriodTicks = 5 * 20;
|
||||
+ @ConfigInfo(baseName = "timeout_ticks")
|
||||
+ public static long timeOutTicks = 30 * 20;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "watchdog";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/utils/LuminolWatchDog.java b/src/main/java/me/earthme/luminol/utils/LuminolWatchDog.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6b4368cdf9762ad981345fef0f26cd008a4236ee
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/utils/LuminolWatchDog.java
|
||||
@@ -0,0 +1,161 @@
|
||||
+package me.earthme.luminol.utils;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
|
||||
+import io.papermc.paper.threadedregions.TickRegionScheduler;
|
||||
+import io.papermc.paper.util.StacktraceDeobfuscator;
|
||||
+import me.earthme.luminol.config.modules.misc.WatchdogConfig;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.apache.commons.lang3.tuple.Pair;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import org.slf4j.Logger;
|
||||
+
|
||||
+import java.lang.management.ManagementFactory;
|
||||
+import java.lang.management.ThreadInfo;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.concurrent.Executor;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+
|
||||
+public class LuminolWatchDog {
|
||||
+ private static final Object keepaliveDataLock = new Object();
|
||||
+ private static Pair<Thread,Long> globalRegionLastKeepalive = null;
|
||||
+ private static final Map<Thread,Pair<ThreadedRegionizer.ThreadedRegion<?,?>,Long>> otherTickRegionKeepalive = Maps.newHashMap();
|
||||
+ private static final Executor checkTimer = CompletableFuture.delayedExecutor(50, TimeUnit.MILLISECONDS);
|
||||
+ private static final Logger logger = MinecraftServer.LOGGER;
|
||||
+ private static int tickCount = 0;
|
||||
+ private static boolean runScheduleNext = true;
|
||||
+
|
||||
+ public static void boot(){
|
||||
+ runCheck();
|
||||
+ }
|
||||
+
|
||||
+ private static void scheduleCheck(){
|
||||
+ checkTimer.execute(LuminolWatchDog::runCheck);
|
||||
+ }
|
||||
+
|
||||
+ private static void runCheck(){
|
||||
+ try {
|
||||
+ if (MinecraftServer.getServer().isStopped() || !runScheduleNext){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ tickCount++;
|
||||
+
|
||||
+ final List<Pair<Thread,Long>> threadsToWarn = new ArrayList<>();
|
||||
+ final long currentTimeNano = System.nanoTime();
|
||||
+ boolean shouldStopServer = false;
|
||||
+
|
||||
+ synchronized (keepaliveDataLock){
|
||||
+ if (globalRegionLastKeepalive != null){
|
||||
+ final Thread lastGlobalRegionThread = globalRegionLastKeepalive.getLeft();
|
||||
+ final long lastTicked = globalRegionLastKeepalive.getRight();
|
||||
+
|
||||
+ final long timeEscaped = currentTimeNano - lastTicked;
|
||||
+
|
||||
+ if (timeEscaped >= WatchdogConfig.warnPeriodTicks * 50 * 1000 * 1000){
|
||||
+ threadsToWarn.add(Pair.of(lastGlobalRegionThread,timeEscaped));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for(Pair<Thread,Long> warnInfo : threadsToWarn){
|
||||
+ final Thread targetThread = warnInfo.getLeft();
|
||||
+ final long timeEscaped = warnInfo.getRight();
|
||||
+
|
||||
+ final ThreadedRegionizer.ThreadedRegion<?,?> targetRegion;
|
||||
+
|
||||
+ synchronized (keepaliveDataLock){
|
||||
+ targetRegion = otherTickRegionKeepalive.get(targetThread).getLeft();
|
||||
+ }
|
||||
+
|
||||
+ if (tickCount % WatchdogConfig.warnPeriodTicks == 0){
|
||||
+ dumpSingleRegion(targetThread,targetRegion,timeEscaped);
|
||||
+ }
|
||||
+
|
||||
+ if (timeEscaped > WatchdogConfig.timeOutTicks * 50 * 1000 * 1000){
|
||||
+ shouldStopServer = true;
|
||||
+ runScheduleNext = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (shouldStopServer){
|
||||
+ MinecraftServer.getServer().stopServer();
|
||||
+ }
|
||||
+ }
|
||||
+ }finally {
|
||||
+ if (runScheduleNext){
|
||||
+ scheduleCheck();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void dumpSingleRegion(@NotNull Thread thread, @Nullable ThreadedRegionizer.ThreadedRegion<?,?> region,long timeEscaped){
|
||||
+ final StringBuilder messageBuilder = new StringBuilder();
|
||||
+ messageBuilder.append("====================================").append("\n");
|
||||
+ messageBuilder.append("There is a single region that has no responding in " + TimeUnit.NANOSECONDS.toSeconds(timeEscaped) + " seconds!").append("\n");
|
||||
+ messageBuilder.append("If you believe this is a bug,please send it to github issue after checking your plugins!").append("\n");
|
||||
+ messageBuilder.append("Tick Region: ").append(region == null ? "Global Region" : "ChunkX(Center): " + region.getCenterChunk().x + " ChunkZ(Center): " + region.getCenterChunk().z).append("\n");
|
||||
+ messageBuilder.append("Thread Name: ").append(thread.getName()).append("\n");
|
||||
+ messageBuilder.append("Thread Id: ").append(thread.getId()).append("\n");
|
||||
+
|
||||
+ final ThreadInfo targetThreadInfo = ManagementFactory.getThreadMXBean().getThreadInfo(thread.getId());
|
||||
+
|
||||
+ messageBuilder.append("Is Suspend: ").append(targetThreadInfo.isSuspended()).append("\n");
|
||||
+ messageBuilder.append("Thread State: ").append(targetThreadInfo.getThreadState()).append("\n");
|
||||
+ messageBuilder.append("Thread Priority: ").append(targetThreadInfo.getPriority()).append("\n");
|
||||
+ messageBuilder.append("Thread Stack Trace:").append("\n");
|
||||
+
|
||||
+ for (StackTraceElement stackTraceElement : StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(thread.getStackTrace())){
|
||||
+ messageBuilder.append("\t\t").append(stackTraceElement).append("\n");
|
||||
+ }
|
||||
+
|
||||
+ messageBuilder.append("\n");
|
||||
+ messageBuilder.append("====================================");
|
||||
+
|
||||
+ logger.error(messageBuilder.toString());
|
||||
+ }
|
||||
+
|
||||
+ public static void globalRegionHeartBeat(){
|
||||
+ if (!WatchdogConfig.enabled){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ synchronized (keepaliveDataLock){
|
||||
+ globalRegionLastKeepalive = Pair.of(Thread.currentThread(),System.nanoTime());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void tickRegionHeartBeat(){
|
||||
+ if (!WatchdogConfig.enabled){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final ThreadedRegionizer.ThreadedRegion<?,?> currentRegion = TickRegionScheduler.getCurrentRegion();
|
||||
+
|
||||
+ if (currentRegion == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ synchronized (keepaliveDataLock){
|
||||
+ if (!otherTickRegionKeepalive.containsKey(Thread.currentThread())){
|
||||
+ otherTickRegionKeepalive.put(Thread.currentThread(),Pair.of(currentRegion,System.nanoTime()));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ otherTickRegionKeepalive.replace(Thread.currentThread(),Pair.of(currentRegion,System.nanoTime()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onRegionDeath(ThreadedRegionizer.ThreadedRegion<?,?> currentRegion){
|
||||
+ if (!WatchdogConfig.enabled){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ synchronized (keepaliveDataLock){
|
||||
+ otherTickRegionKeepalive.remove(Thread.currentThread());
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0d756dd5181a2444175184227bef648d07c17236..59b1da130e519cbe06ed5eedf9e4dc881e45ba36 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1222,6 +1222,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.statusIcon = (ServerStatus.Favicon) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
|
||||
this.status = this.buildServerStatus();
|
||||
|
||||
+ me.earthme.luminol.utils.LuminolWatchDog.boot(); //Luminol - Simple watchdog
|
||||
+
|
||||
// Folia start - region threading
|
||||
if (true) {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().init(); // Folia - region threading - only after loading worlds
|
||||
@@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Mon, 25 Mar 2024 13:16:04 +0000
|
||||
Subject: [PATCH] Add config for incorrect tripwire updating fixing
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/IncorrectTripwireFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/IncorrectTripwireFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..79ce93a1e97f176c7b0e5b00d7f0880f0d157d03
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/IncorrectTripwireFixConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class IncorrectTripwireFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.FIXES;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "allow_update_incorrect_trip_wire";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 8bf94fcf5c46ffe6d90f8431338b768ef1a2dd61..25e069bd660720232737031fe1630765cce9a1b1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -201,8 +201,13 @@ public class TripWireHookBlock extends Block {
|
||||
BlockState iblockdata4 = aiblockdata[l];
|
||||
|
||||
if (iblockdata4 != null) {
|
||||
- if (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE)) { // Paper - Fix tripwire disarming not working as intended
|
||||
+ if (me.earthme.luminol.config.modules.fixes.IncorrectTripwireFixConfig.enabled || world.getBlockState(blockposition2).is(Blocks.TRIPWIRE)) { // Paper - Fix tripwire disarming not working as intended //Luminol - Add config for this
|
||||
world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
+ //Luminol start - Add config for incorrect tripwire updating
|
||||
+ if (me.earthme.luminol.config.modules.fixes.IncorrectTripwireFixConfig.enabled){
|
||||
+ world.getBlockState(blockposition2).isAir();
|
||||
+ }
|
||||
+ //Luminol end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Io_uring channel type support
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index e837f1f9b444318cbee8719b9dd0eb669478742e..3a787b0afa3a34f23f1c18fb5250a5ff4bcd2f96 100644
|
||||
index 66c34f883a93dd86fcac8029cce63ffe7340c89b..66cb23bce8bf0a96867144874643f771f7440034 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -35,6 +35,7 @@ dependencies {
|
||||
@@ -18,17 +18,19 @@ index e837f1f9b444318cbee8719b9dd0eb669478742e..3a787b0afa3a34f23f1c18fb5250a5ff
|
||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/IOUringSupportConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/IOUringSupportConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..313c3908ea406119da4f49db2e4fac6572727c80
|
||||
index 0000000000000000000000000000000000000000..f3090b6e11d82d02528c7afd358ef4db61707092
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/IOUringSupportConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -0,0 +1,22 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.HotReloadUnsupported;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class IOUringSupportConfig implements IConfigModule {
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..8487799cdfb776eaca33b57f7c99ae3a
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 92a2e116f47d1434cc406709c3bcf85fedd2bb86..59f3ea98d0346d5b92053e13fa20048e3a946203 100644
|
||||
index 318cb1e98a3d73b7893f07c9f0db3adab801b67e..9cbf17436b4cf52aae374767aafe79ea4f60c3ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -17,6 +17,8 @@ import java.util.OptionalInt;
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 07:18:27 +0000
|
||||
Subject: [PATCH] Piston fixes from molean server
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 55c42fa5fb60858af08c98940a2e786038f2ca4e..539ddfb88a5409b2270b36cf81120d81cffb197d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1448,7 +1448,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
if (movement.lengthSqr() <= 1.0E-7D) {
|
||||
return movement;
|
||||
} else {
|
||||
- long i = this.level().getGameTime();
|
||||
+ long i = this.level().getRedstoneGameTime(); //Luminol - Piston fixes from molean server
|
||||
|
||||
if (i != this.pistonDeltasGameTime) {
|
||||
Arrays.fill(this.pistonDeltas, 0.0D);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index be74adc86f0ca467f3b59e7b57fd47a8f381d86e..3482ed0449478b258d85751ffc90ce677acbc60f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -152,7 +152,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
if (tileentity instanceof PistonMovingBlockEntity) {
|
||||
PistonMovingBlockEntity tileentitypiston = (PistonMovingBlockEntity) tileentity;
|
||||
|
||||
- if (tileentitypiston.isExtending() && (tileentitypiston.getProgress(0.0F) < 0.5F || world.getGameTime() == tileentitypiston.getLastTicked() || ((ServerLevel) world).isHandlingTick())) {
|
||||
+ if (tileentitypiston.isExtending() && (tileentitypiston.getProgress(0.0F) < 0.5F || world.getRedstoneGameTime() == tileentitypiston.getLastTicked() || ((ServerLevel) world).isHandlingTick())) { //Luminol - Piston fixes from molean server
|
||||
b0 = 2;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
index 1c23597f172f46eec714b510acfedb415bb01bff..3262398db1b053115b83ed6aab15f9fef511d5d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
@@ -277,7 +277,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public static void tick(Level world, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) {
|
||||
- blockEntity.lastTicked = world.getGameTime();
|
||||
+ blockEntity.lastTicked = world.getRedstoneGameTime(); //Luminol - Piston fixes from molean server
|
||||
blockEntity.progressO = blockEntity.progress;
|
||||
if (blockEntity.progressO >= 1.0F) {
|
||||
if (world.isClientSide && blockEntity.deathTicks < 5) {
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Teleport async if entity was moving to another region at once
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaEntityMovingFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaEntityMovingFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9ccd6a3a07abfce54dccf9b6e01d0050d03279b2
|
||||
index 0000000000000000000000000000000000000000..73d99a105a18231901e691922b0c283adae0cc79
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaEntityMovingFixConfig.java
|
||||
@@ -0,0 +1,22 @@
|
||||
@@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..9ccd6a3a07abfce54dccf9b6e01d0050
|
||||
+public class FoliaEntityMovingFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+ @ConfigInfo(baseName = "warnOnDetected")
|
||||
+ @ConfigInfo(baseName = "warn_on_detected")
|
||||
+ public static boolean warnOnDetected = true;
|
||||
+
|
||||
+ @Override
|
||||
@@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..9ccd6a3a07abfce54dccf9b6e01d0050
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 865804a16fce714497b2c025a869f972787442e3..7ba9c8677a09d43107ab0d178f4141c44a1d25bc 100644
|
||||
index 9bbfac91f97331b1b558264c867b7e00185291f2..dfb1b8c3af93bfcddb976c003c6ac2d52afc41c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
|
||||
@@ -53,7 +53,7 @@ index 865804a16fce714497b2c025a869f972787442e3..7ba9c8677a09d43107ab0d178f4141c4
|
||||
import net.minecraft.BlockUtil;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
@@ -1071,10 +1074,40 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -1086,10 +1089,40 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
@@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..b8aceab54bb60000e7c5681014027102
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 59f3ea98d0346d5b92053e13fa20048e3a946203..4799627301db90734dd891c099ffe5000c8873a0 100644
|
||||
index 9cbf17436b4cf52aae374767aafe79ea4f60c3ce..f2068e7608ed765e35759eb981db6c95b07a06d8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -332,6 +332,10 @@ public class ServerPlayer extends Player {
|
||||
@@ -48,7 +48,7 @@ index 59f3ea98d0346d5b92053e13fa20048e3a946203..4799627301db90734dd891c099ffe500
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
this.chatVisibility = ChatVisiblity.FULL;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 095134bb3c07ad8daeaf4b28076d60b96b481458..7d6ac979135c62e35187cb2aed4c25d9137f9c45 100644
|
||||
index 3b2508dc6cd4f70b09dce3b7e745e6efabaaa74e..b3ff8ed6d0f0414c15b9d2e6a51a0e34c361f92a 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -675,7 +675,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -61,7 +61,7 @@ index 095134bb3c07ad8daeaf4b28076d60b96b481458..7d6ac979135c62e35187cb2aed4c25d9
|
||||
|
||||
// If the event is cancelled we move the player back to their old location.
|
||||
if (event.isCancelled()) {
|
||||
@@ -1625,7 +1627,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -1621,7 +1623,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
@@ -72,7 +72,7 @@ index 095134bb3c07ad8daeaf4b28076d60b96b481458..7d6ac979135c62e35187cb2aed4c25d9
|
||||
// If the event is cancelled we move the player back to their old location.
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 7ba9c8677a09d43107ab0d178f4141c44a1d25bc..55c42fa5fb60858af08c98940a2e786038f2ca4e 100644
|
||||
index dfb1b8c3af93bfcddb976c003c6ac2d52afc41c6..09cdd28dcb2357ba3d7be316b7ca94dc93ac5dd0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -27,6 +27,7 @@ import java.util.stream.Stream;
|
||||
@@ -99,7 +99,7 @@ index 7ba9c8677a09d43107ab0d178f4141c44a1d25bc..55c42fa5fb60858af08c98940a2e7860
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
@@ -3967,6 +3966,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -3989,6 +3988,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
java.util.function.Consumer<Entity> teleportComplete) {
|
||||
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot teleport entity async");
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Kaiiju linear region format and settings
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 3a787b0afa3a34f23f1c18fb5250a5ff4bcd2f96..18326989bfccea2c6d292b0020aab711438031c8 100644
|
||||
index 66cb23bce8bf0a96867144874643f771f7440034..57fcd58883effe57051b72a4e9f4af91aacd421a 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -20,6 +20,10 @@ dependencies {
|
||||
@@ -573,10 +573,10 @@ index 9017907c0ec67a37a506f09b7e4499cef7885279..8b9ffcaab5d71660291d1c0454d2abd9
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/RegionFormatConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/RegionFormatConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5219ef799585db502a19e79145b971365a736277
|
||||
index 0000000000000000000000000000000000000000..5d594b606178bd26180caad49de17c0e67e89747
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RegionFormatConfig.java
|
||||
@@ -0,0 +1,50 @@
|
||||
@@ -0,0 +1,58 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
@@ -587,12 +587,16 @@ index 0000000000000000000000000000000000000000..5219ef799585db502a19e79145b97136
|
||||
+ @DoNotLoad
|
||||
+ public static RegionFileFormat regionFormatName = RegionFileFormat.ANVIL;
|
||||
+
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "formatName")
|
||||
+ private static String formatName = "ANVIL";
|
||||
+ @ConfigInfo(baseName = "linear_compression_level")
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "linear_compression_level",comments = "WARNING: DO NOT USE TOO HIGH COMPRESSION LEVEL(Recommended is 1 which is default value if you are using linear) BECAUSE THAT WOULD MAKE YOUR DATA IN DANGER!")
|
||||
+ public static int regionFormatLinearCompressionLevel = 1;
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "linear_flusher_thread_count")
|
||||
+ public static int linearFlushThreads = 1;
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "linear_flush_frequency")
|
||||
+ public static int linearFlushFrequency = 10;
|
||||
+
|
||||
@@ -608,6 +612,10 @@ index 0000000000000000000000000000000000000000..5219ef799585db502a19e79145b97136
|
||||
+
|
||||
+ @Override
|
||||
+ public void onLoaded(CommentedFileConfig configInstance){
|
||||
+ if (LuminolConfig.alreadyInited){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ regionFormatName = RegionFileFormat.fromString(formatName);
|
||||
+ if (regionFormatName.equals(RegionFileFormat.INVALID)) {
|
||||
+ LuminolConfig.logger.error("Unknown region format in luminol global config: {}", formatName);
|
||||
@@ -628,7 +636,7 @@ index 0000000000000000000000000000000000000000..5219ef799585db502a19e79145b97136
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 4468e6fdbbe527111f4410188f2f2df7f592f81e..13ad20b3d43cc22ad1046220b24272dd274de997 100644
|
||||
index 59b1da130e519cbe06ed5eedf9e4dc881e45ba36..c924951c3dd7652ee446b40689ff9004546e972a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -923,7 +923,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -650,7 +658,7 @@ index 4468e6fdbbe527111f4410188f2f2df7f592f81e..13ad20b3d43cc22ad1046220b24272dd
|
||||
|
||||
return flag3;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 21ec49acb3c1241d9286959c42a7f8363f637e4f..c212030a24174115a975604b91d03cf8ad4043de 100644
|
||||
index 6ab9f83786dcfbd3156d2f2bd6da57baed1399f4..76ad4d8bce1611ead6f1596b2ba78267e3718655 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -211,7 +211,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -697,10 +705,10 @@ index 21ec49acb3c1241d9286959c42a7f8363f637e4f..c212030a24174115a975604b91d03cf8
|
||||
regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 9e82dc98ef2d4da39839699f455e0ef20ab4ef65..c0f8f72d1677d4ef6a15f487262953c5df3b03c0 100644
|
||||
index 10df17ad79092f3e226df08e58620694b3581758..da6269249a95d78f91e90416a96bf1b776fd9c97 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -447,8 +447,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -446,8 +446,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
||||
|
||||
@@ -711,7 +719,7 @@ index 9e82dc98ef2d4da39839699f455e0ef20ab4ef65..c0f8f72d1677d4ef6a15f487262953c5
|
||||
}
|
||||
|
||||
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
||||
@@ -809,7 +809,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -808,7 +808,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// CraftBukkit end
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
@@ -1117,10 +1125,10 @@ index 4aac1979cf57300825a999c876fcf24d3170e68e..3b96582f15d0985b670b5b5a1548800d
|
||||
this.factory = factory;
|
||||
this.fixerUpper = dataFixer;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index d3bdc355bee762b90a77528e9da96d74e6b174ae..f5e12147b7e387f34b9ef648c9a2a3ec77522496 100644
|
||||
index 379c10e791a961d25d7de571f81ace1ac7d84381..e268ef6a373fa0e144104eb7fcfaf7bc9005c987 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -569,7 +569,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -575,7 +575,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
world.getChunk(x, z); // make sure we're at ticket level 32 or lower
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Kaiiju Vanilla end portal teleportation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 539ddfb88a5409b2270b36cf81120d81cffb197d..93936213c0ddd3fc1435be15eae09a2cdb1a099e 100644
|
||||
index 09cdd28dcb2357ba3d7be316b7ca94dc93ac5dd0..d955a555d260d39812b84eb5319db619ec0f8d28 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4173,12 +4173,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -4195,12 +4195,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
targetPos, 16, // load 16 blocks to be safe from block physics
|
||||
ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH,
|
||||
(chunks) -> {
|
||||
@@ -28,7 +28,7 @@ index 539ddfb88a5409b2270b36cf81120d81cffb197d..93936213c0ddd3fc1435be15eae09a2c
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -4365,6 +4370,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -4387,6 +4392,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
if (!this.canPortalAsync(takePassengers)) {
|
||||
return false;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ index 539ddfb88a5409b2270b36cf81120d81cffb197d..93936213c0ddd3fc1435be15eae09a2c
|
||||
|
||||
Vec3 initialPosition = this.position();
|
||||
ChunkPos initialPositionChunk = new ChunkPos(
|
||||
@@ -4423,7 +4432,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -4445,7 +4454,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
// place
|
||||
passengerTree.root.placeInAsync(
|
||||
originWorld, destination, Entity.TELEPORT_FLAG_LOAD_CHUNK | (takePassengers ? Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS : 0L),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 07:33:03 +0000
|
||||
Date: Mon, 25 Mar 2024 13:47:32 +0000
|
||||
Subject: [PATCH] Kaiiju Async path processing
|
||||
|
||||
|
||||
@@ -515,10 +515,10 @@ index 0000000000000000000000000000000000000000..a5472bb9d453bbeee92738c8d1a57ef4
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index a1a0ac986e2052d3669428a29987630bc226d80f..192584ac3b280cef2e76bc510c03ff6e0fd26ce2 100644
|
||||
index 54297b9dde40fe853d873d60373cd8c0a3c9466b..67210fc018349ab0a79740dee140fb60c82c431a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -296,6 +296,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -297,6 +297,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@Nullable
|
||||
@Override
|
||||
public LivingEntity getTarget() {
|
||||
@@ -1191,7 +1191,7 @@ index 3049edb5a8b5967e5242a3896b23665888eb3472..0da9acd785cf785d82be7aab0a1e2bfd
|
||||
return false;
|
||||
} else if (o.nodes.size() != this.nodes.size()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
index eb18494bd7257fa5eb00dea16cf4d5667b796f2b..3cbc29fa169350879254a90e198e6247b6ab3037 100644
|
||||
index 8aa4ac3a6affbe888d6084a27b668c58dfda6c79..d8f443af840b1a4b1d2868fefd87d70dad55a764 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
@@ -24,37 +24,80 @@ public class PathFinder {
|
||||
@@ -1293,11 +1293,11 @@ index eb18494bd7257fa5eb00dea16cf4d5667b796f2b..3cbc29fa169350879254a90e198e6247
|
||||
|
||||
for(int l = 0; l < k; ++l) {
|
||||
Node node2 = this.neighbors[l];
|
||||
@@ -123,6 +166,7 @@ public class PathFinder {
|
||||
@@ -123,7 +166,6 @@ public class PathFinder {
|
||||
if (best == null || comparator.compare(path, best) < 0)
|
||||
best = path;
|
||||
}
|
||||
+ //noinspection ConstantConditions // Kaiiju - petal - ignore this warning, we know that the above loop always runs at least once since positions is not empty
|
||||
- profiler.pop();
|
||||
return best;
|
||||
// Paper end - Perf: remove streams and optimize collection
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ index 0000000000000000000000000000000000000000..dd45cf1fde5ee4cf8347064f106c64b8
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 192584ac3b280cef2e76bc510c03ff6e0fd26ce2..8e2da025ff13abd7f021099b66dc04d1ead64390 100644
|
||||
index 67210fc018349ab0a79740dee140fb60c82c431a..b90865dbfb3a4bd83e4cd3ba3b5b965036039f98 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -926,10 +926,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -927,10 +927,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
return;
|
||||
}
|
||||
// Paper end - Allow nerfed mobs to jump and float
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Pufferfish Optimize entity coordinate key
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index 878306271d4af280c7a086d1839c446a01da1ad6..cb22cac2b8c4eaf705b76fd4a9d8b82fb8eb0140 100644
|
||||
index 08d282400644be5949f28eb879b333cc221da2cc..49ccb27a17bec1d4ff31bc8d72e4724d65adc20c 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -212,7 +212,7 @@ public final class MCUtil {
|
||||
@@ -215,7 +215,7 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static long getCoordinateKey(final Entity entity) {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Pufferfish Cache climbing check for activation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 93936213c0ddd3fc1435be15eae09a2cdb1a099e..9c80582a02123364eea527bd59ff3cb0e4aad98f 100644
|
||||
index d955a555d260d39812b84eb5319db619ec0f8d28..7834646fd6a894ff85973566d9aeda98e5b0c284 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -310,7 +310,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -311,7 +311,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public double yo;
|
||||
public double zo;
|
||||
private Vec3 position;
|
||||
@@ -18,10 +18,10 @@ index 93936213c0ddd3fc1435be15eae09a2cdb1a099e..9c80582a02123364eea527bd59ff3cb0
|
||||
private Vec3 deltaMovement;
|
||||
private float yRot;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 28da90b59f60d3f7618a42e149467a3a55c91682..dd50c93283dfce2ed33d3eece48e1829b9cdc9d0 100644
|
||||
index fdb5ef574c14fafa1af50f4f656763119695f00e..bbfbeddcba884ae1964f7421fcdf179923bd0d2b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -141,7 +141,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
@@ -143,7 +143,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -29,7 +29,7 @@ index 28da90b59f60d3f7618a42e149467a3a55c91682..dd50c93283dfce2ed33d3eece48e1829
|
||||
|
||||
public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@@ -2014,6 +2013,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2043,6 +2042,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..3e48cd297b4869e5c89b6abc43c726d3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index dd50c93283dfce2ed33d3eece48e1829b9cdc9d0..e304407868a109ea9455112b2003c89d62db1607 100644
|
||||
index bbfbeddcba884ae1964f7421fcdf179923bd0d2b..df789b13f57200c66ff4cc59e6b63949a6804e3d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -418,7 +418,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -428,7 +428,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -43,7 +43,7 @@ index dd50c93283dfce2ed33d3eece48e1829b9cdc9d0..e304407868a109ea9455112b2003c89d
|
||||
this.hurt(this.damageSources().inWall(), 1.0F);
|
||||
} else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) {
|
||||
double d0 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1419,6 +1419,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1436,6 +1436,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.getHealth() <= 0.0F;
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ index dd50c93283dfce2ed33d3eece48e1829b9cdc9d0..e304407868a109ea9455112b2003c89d
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(source)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index ac9eaeaf7df1e84ee588f371628c0a10784d50bc..ea8883b0661e894a466eca24bfc247ac37f40a81 100644
|
||||
index 12440ee2dccc0a697fb403765f2e1b987ccc0283..de2471cfa96a23944f229f33ffdff88b6b7756e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -150,6 +150,13 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
@@ -151,6 +151,13 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
this.bossEvent.setName(this.getDisplayName());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Pufferfish Reduce entity fluid lookups if no fluids
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9c80582a02123364eea527bd59ff3cb0e4aad98f..e6b90e53b2b539543084ddbfda4ab819656a3179 100644
|
||||
index 7834646fd6a894ff85973566d9aeda98e5b0c284..21284dba89c8adbb46086afd9a900fb24ba3e3ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -5240,16 +5240,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -5262,16 +5262,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
|
||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
|
||||
@@ -34,7 +34,7 @@ index 9c80582a02123364eea527bd59ff3cb0e4aad98f..e6b90e53b2b539543084ddbfda4ab819
|
||||
double d1 = 0.0D;
|
||||
boolean flag = this.isPushedByFluid();
|
||||
boolean flag1 = false;
|
||||
@@ -5257,14 +5259,61 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -5279,14 +5281,61 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
int k1 = 0;
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
|
||||
@@ -102,7 +102,7 @@ index 9c80582a02123364eea527bd59ff3cb0e4aad98f..e6b90e53b2b539543084ddbfda4ab819
|
||||
|
||||
if (d2 >= axisalignedbb.minY) {
|
||||
flag1 = true;
|
||||
@@ -5286,9 +5335,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -5308,9 +5357,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..15697d69659b6e1e776acf5094684b5f
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e6b90e53b2b539543084ddbfda4ab819656a3179..03a6633edd34a34f7c5cfb1a58f4d132e6bd1c12 100644
|
||||
index 21284dba89c8adbb46086afd9a900fb24ba3e3ea..f8a410e9ed04d9a78d1a6a7e63673b1863d715f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -798,6 +798,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -814,6 +814,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@@ -71,10 +71,10 @@ index 0000000000000000000000000000000000000000..af5893ba1f738ec9827d7b714682c314
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c0f8f72d1677d4ef6a15f487262953c5df3b03c0..33154e89457e3d7331c6d17785544d08f7e6bed8 100644
|
||||
index da6269249a95d78f91e90416a96bf1b776fd9c97..25a2f23618cd02366f71e704638adfbaed9fa8c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -988,6 +988,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -987,6 +987,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.timings.entityTick.startTiming(); // Spigot
|
||||
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); try { // Folia - profiler
|
||||
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
|
||||
@@ -83,10 +83,10 @@ index c0f8f72d1677d4ef6a15f487262953c5df3b03c0..33154e89457e3d7331c6d17785544d08
|
||||
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
entity.discard();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 03a6633edd34a34f7c5cfb1a58f4d132e6bd1c12..f61ac02037ce13bb80b0db0814145fd9ff39bc37 100644
|
||||
index f8a410e9ed04d9a78d1a6a7e63673b1863d715f2..4b3acc0de20b246e20e2cc91ba0eca493a675729 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -482,6 +482,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -483,6 +483,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
|
||||
// Folia - region ticking
|
||||
// Paper end - optimise entity tracking
|
||||
@@ -111,10 +111,10 @@ index 8deae3e95a26f4b42b2c2134e22f9649bd7a5391..c09357c1ef84a29d972119cb496b0ae9
|
||||
private String descriptionId;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 8e2da025ff13abd7f021099b66dc04d1ead64390..2f592612ddc39723b76ddc6de3b20681ece5829d 100644
|
||||
index b90865dbfb3a4bd83e4cd3ba3b5b965036039f98..66c581585e6ca58eba0e8b7af0fa1f0c9f924f94 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -233,10 +233,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -234,10 +234,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
super.inactiveTick();
|
||||
@@ -127,7 +127,7 @@ index 8e2da025ff13abd7f021099b66dc04d1ead64390..2f592612ddc39723b76ddc6de3b20681
|
||||
this.targetSelector.tick();
|
||||
}
|
||||
}
|
||||
@@ -934,16 +934,20 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -935,16 +935,20 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
|
||||
if (i % 2 != 0 && this.tickCount > 1) {
|
||||
this.level().getProfiler().push("targetSelector");
|
||||
@@ -216,10 +216,10 @@ index 580da502c62ec5d669cb09932d99d1c7d711c965..b94d775e366f5cb251e9199ff5022ad5
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("frogActivityUpdate");
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
index 4aeab90e778629c355189dfe79c39c4b21f5f5ac..6ed4ac06c76b8d0d6e8db778cade15dbd1e3e5f5 100644
|
||||
index 958816ce2166248b542c96c10c398a52d769b4db..415afe3473d9f8a50b1edab8cfda6158e59836e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
@@ -77,9 +77,11 @@ public class Tadpole extends AbstractFish {
|
||||
@@ -80,9 +80,11 @@ public class Tadpole extends AbstractFish {
|
||||
return SoundEvents.TADPOLE_FLOP;
|
||||
}
|
||||
|
||||
@@ -298,10 +298,10 @@ index 7aadd36f0fe986635b495ab8c1426644620400cf..0c947d7509d66647327bce885ad2c605
|
||||
this.level().getProfiler().pop();
|
||||
super.customServerAiStep();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 853c777bad19656cd48e9de9015c12e2c078d940..fba0f3725ff3001decdb9efeeab50dd7ce3e4ddc 100644
|
||||
index 3eeff0cd8563939c656b5ded8470cab016903f25..90d8cd94d987416a3e9f6e6d47a5b366d4687fe0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -142,6 +142,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -143,6 +143,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
return holder.is(PoiTypes.MEETING);
|
||||
});
|
||||
|
||||
@@ -310,7 +310,7 @@ index 853c777bad19656cd48e9de9015c12e2c078d940..fba0f3725ff3001decdb9efeeab50dd7
|
||||
public Villager(EntityType<? extends Villager> entityType, Level world) {
|
||||
this(entityType, world, VillagerType.PLAINS);
|
||||
}
|
||||
@@ -245,6 +247,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -246,6 +248,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
@@ -318,7 +318,7 @@ index 853c777bad19656cd48e9de9015c12e2c078d940..fba0f3725ff3001decdb9efeeab50dd7
|
||||
@Override
|
||||
@Deprecated // Paper
|
||||
protected void customServerAiStep() {
|
||||
@@ -254,7 +257,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -255,7 +258,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
protected void customServerAiStep(final boolean inactive) {
|
||||
// Paper end
|
||||
this.level().getProfiler().push("villagerBrain");
|
||||
@@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Tue, 20 Feb 2024 13:03:42 +0000
|
||||
Subject: [PATCH] Pufferfish Throttle goal selector during inactive ticking
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/EntityGoalSelectorInactiveTickConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/EntityGoalSelectorInactiveTickConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..acc032f727e605e79b688efb4873ff474fe7e132
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/optimizations/EntityGoalSelectorInactiveTickConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class EntityGoalSelectorInactiveTickConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.OPTIMIZATIONS;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "skip_goal_selector_tick_in_inactive_tick";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 66c581585e6ca58eba0e8b7af0fa1f0c9f924f94..97e099eea537aea8f8ffd031063949c363820701 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -230,11 +230,13 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
return this.lookControl;
|
||||
}
|
||||
|
||||
+ int _pufferfish_inactiveTickDisableCounter = 0; // Pufferfish - throttle inactive goal selector ticking
|
||||
// Paper start
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
super.inactiveTick();
|
||||
- if (this.goalSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priroity
|
||||
+ boolean isThrottled = me.earthme.luminol.config.modules.optimizations.EntityGoalSelectorInactiveTickConfig.enabled && _pufferfish_inactiveTickDisableCounter++ % 20 != 0; // Pufferfish - throttle inactive goal selector ticking
|
||||
+ if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking
|
||||
this.goalSelector.tick();
|
||||
}
|
||||
if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Tue, 20 Feb 2024 13:11:11 +0000
|
||||
Subject: [PATCH] Pufferfish Reduce entity allocations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index 897d7632ecfea40890433474870dd7a5e534d8ab..683c9693754d1a87b7e8fccc757a0d0963351f60 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
@@ -23,9 +23,11 @@ public class AttributeMap {
|
||||
private final Map<Attribute, AttributeInstance> attributes = Maps.newHashMap();
|
||||
private final Set<AttributeInstance> dirtyAttributes = Sets.newHashSet();
|
||||
private final AttributeSupplier supplier;
|
||||
+ private final java.util.function.Function<Attribute, AttributeInstance> createInstance; // Pufferfish
|
||||
|
||||
public AttributeMap(AttributeSupplier defaultAttributes) {
|
||||
this.supplier = defaultAttributes;
|
||||
+ this.createInstance = attribute -> this.supplier.createInstance(this::onAttributeModified, attribute); // Pufferfish
|
||||
}
|
||||
|
||||
private void onAttributeModified(AttributeInstance instance) {
|
||||
@@ -45,11 +47,10 @@ public class AttributeMap {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
+
|
||||
@Nullable
|
||||
public AttributeInstance getInstance(Attribute attribute) {
|
||||
- return this.attributes.computeIfAbsent(attribute, (attributex) -> {
|
||||
- return this.supplier.createInstance(this::onAttributeModified, attributex);
|
||||
- });
|
||||
+ return this.attributes.computeIfAbsent(attribute, this.createInstance); // Pufferfish - cache lambda, as for some reason java allocates it anyways
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sat, 27 Jan 2024 11:55:08 +0000
|
||||
Date: Mon, 25 Mar 2024 13:48:33 +0000
|
||||
Subject: [PATCH] Pufferfish Improve container checking with a bitset
|
||||
|
||||
|
||||
@@ -237,10 +237,10 @@ index d6cbe98e67fdbf8db46338a88ab1356dd63b50a3..20dd3a63b2f955b05a75eb240e33ae4c
|
||||
int LARGE_MAX_STACK_SIZE = 64;
|
||||
int DEFAULT_DISTANCE_LIMIT = 8;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
index 6d23c39e4eadf23616080d6d08672e13b5d3c37d..e7115f1635821e0aab32e8aeea6914388dc24639 100644
|
||||
index 756d0434472921992c9d84597d7c9c824e93614c..38c573d440946ca7ee6016ef92e9c1605031e611 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -27,7 +27,10 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
@@ -28,7 +28,10 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity {
|
||||
|
||||
@@ -251,7 +251,7 @@ index 6d23c39e4eadf23616080d6d08672e13b5d3c37d..e7115f1635821e0aab32e8aeea691438
|
||||
@Nullable
|
||||
public ResourceLocation lootTable;
|
||||
public long lootTableSeed;
|
||||
@@ -89,12 +92,18 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@@ -90,12 +93,18 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
|
||||
protected AbstractMinecartContainer(EntityType<?> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -272,7 +272,7 @@ index 6d23c39e4eadf23616080d6d08672e13b5d3c37d..e7115f1635821e0aab32e8aeea691438
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,6 +165,10 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@@ -164,6 +173,10 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
protected void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
this.lootableData.loadNbt(nbt); // Paper
|
||||
@@ -362,10 +362,10 @@ index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..3514022d898a24052c917ebf55dcef3e
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962fcb55634 100644
|
||||
index 82e7e76fecceb55522b5828a56f036e42ef55201..882e27de852c89c837d7943c5a9ae6fb3c2e896b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -47,7 +47,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -48,7 +48,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
public static final int MOVE_ITEM_SPEED = 8;
|
||||
public static final int HOPPER_CONTAINER_SIZE = 5;
|
||||
@@ -373,10 +373,10 @@ index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962
|
||||
private NonNullList<ItemStack> items;
|
||||
+ private gg.airplane.structs.ItemListWithBitset optimizedItems; // Pufferfish
|
||||
+ // Pufferfish end
|
||||
private int cooldownTime;
|
||||
private long tickedGameTime;
|
||||
public int cooldownTime;
|
||||
private long tickedGameTime = Long.MIN_VALUE; // Folia - region threading
|
||||
|
||||
@@ -83,14 +86,37 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -94,14 +97,37 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
public HopperBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.HOPPER, pos, state);
|
||||
@@ -416,7 +416,7 @@ index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962
|
||||
if (!this.tryLoadLootTable(nbt)) {
|
||||
ContainerHelper.loadAllItems(nbt, this.items);
|
||||
}
|
||||
@@ -493,6 +519,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -504,6 +530,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
}
|
||||
|
||||
private static boolean isFullContainer(Container inventory, Direction direction) {
|
||||
@@ -424,7 +424,7 @@ index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962
|
||||
// Paper start - Perf: Optimize Hoppers
|
||||
if (inventory instanceof WorldlyContainer worldlyContainer) {
|
||||
for (final int slot : worldlyContainer.getSlotsForFace(direction)) {
|
||||
@@ -515,7 +542,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -526,7 +553,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
}
|
||||
|
||||
private static boolean isEmptyContainer(Container inv, Direction facing) {
|
||||
@@ -437,7 +437,7 @@ index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962
|
||||
}
|
||||
|
||||
public static boolean suckInItems(Level world, Hopper hopper) {
|
||||
@@ -716,7 +747,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -727,7 +758,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
if (HopperBlockEntity.canPlaceItemInContainer(to, stack, slot, side)) {
|
||||
boolean flag = false;
|
||||
@@ -446,7 +446,7 @@ index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
|
||||
@@ -911,7 +942,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -922,7 +953,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
@Override
|
||||
protected void setItems(NonNullList<ItemStack> list) {
|
||||
@@ -459,7 +459,7 @@ index 26ff1a3d07c92f7035020d08d35116f7feede600..009263f6aab41608d7e17bebbed6f962
|
||||
|
||||
public static void entityInside(Level world, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
index a94300a457b25f0e33a8eeabba6dd5720ca9ab1e..b41635dd0569ff7df909df492d3e850aef7214be 100644
|
||||
index f52ccd4f3e062af3c7cc6eaea5b074a3bbd21690..a5cd70b6ada2b44f64db0985483ee5eadc67003f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
@@ -94,12 +94,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..ed62d25d6cd6dfcf8c5db20ced36eb3d
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f61ac02037ce13bb80b0db0814145fd9ff39bc37..0d8dd2d9b038f0694c955e649f7a4ad0039a3d89 100644
|
||||
index 4b3acc0de20b246e20e2cc91ba0eca493a675729..2d78d28120af075bebee4d97428ed48cf27c9d78 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -5438,6 +5438,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -5460,6 +5460,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
return this.feetBlockState;
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ index f61ac02037ce13bb80b0db0814145fd9ff39bc37..0d8dd2d9b038f0694c955e649f7a4ad0
|
||||
return this.chunkPosition;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index e304407868a109ea9455112b2003c89d62db1607..aea521bd240db699eabcbe110d9a25b1141d3634 100644
|
||||
index df789b13f57200c66ff4cc59e6b63949a6804e3d..c2d155882c94f875c96c13746ff0c5433ab25ed0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2033,19 +2033,43 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2062,19 +2062,43 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
public boolean onClimableCached() {
|
||||
if (!this.blockPosition().equals(this.lastClimbingPosition)) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Gale Optimize sun burn tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0d8dd2d9b038f0694c955e649f7a4ad0039a3d89..d1f31b991a2a10593fa0ae45d10d7761baffdd75 100644
|
||||
index 2d78d28120af075bebee4d97428ed48cf27c9d78..a4682b8bd269f52af26a03347e8d3869d2b1ba41 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -309,7 +309,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -310,7 +310,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public double xo;
|
||||
public double yo;
|
||||
public double zo;
|
||||
@@ -17,7 +17,7 @@ index 0d8dd2d9b038f0694c955e649f7a4ad0039a3d89..d1f31b991a2a10593fa0ae45d10d7761
|
||||
public BlockPos blockPosition; // Pufferfish - private->public
|
||||
private ChunkPos chunkPosition;
|
||||
private Vec3 deltaMovement;
|
||||
@@ -2053,9 +2053,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -2068,9 +2068,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public float getLightLevelDependentMagicValue() {
|
||||
@@ -37,10 +37,10 @@ index 0d8dd2d9b038f0694c955e649f7a4ad0039a3d89..d1f31b991a2a10593fa0ae45d10d7761
|
||||
this.absMoveTo(x, y, z);
|
||||
this.setYRot(yaw % 360.0F);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 2f592612ddc39723b76ddc6de3b20681ece5829d..570371a2c903f2dfaee2935e0f845e36e3922a86 100644
|
||||
index 97e099eea537aea8f8ffd031063949c363820701..71b1f576aff8dcf51dd888280b5b7a25a387d197 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1740,13 +1740,29 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -1750,13 +1750,29 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Gale Check frozen ticks before landing block
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index aea521bd240db699eabcbe110d9a25b1141d3634..64ffefc98ebf19a7541b73332f050692e6d71b3a 100644
|
||||
index c2d155882c94f875c96c13746ff0c5433ab25ed0..84b47e6cea7ed9730f9c450ba8ba3167d71b2cc9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -587,11 +587,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -597,11 +597,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void tryAddFrost() {
|
||||
@@ -21,7 +21,7 @@ index aea521bd240db699eabcbe110d9a25b1141d3634..64ffefc98ebf19a7541b73332f050692
|
||||
|
||||
if (attributemodifiable == null) {
|
||||
return;
|
||||
@@ -601,7 +600,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -611,7 +610,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
attributemodifiable.addTransientModifier(new AttributeModifier(LivingEntity.SPEED_MODIFIER_POWDER_SNOW_UUID, "Powder snow slow", (double) f, AttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Gale Don't trigger lootable refresh for non-player
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
index b41635dd0569ff7df909df492d3e850aef7214be..7ff40b74827a52eb5daaff72e1563b044d41c6c1 100644
|
||||
index a5cd70b6ada2b44f64db0985483ee5eadc67003f..e49be65c2d379027c2821c0db7f151bc3cd20a4b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
@@ -68,6 +68,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||
@@ -99,10 +99,10 @@ public class Main {
|
||||
```
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index cb22cac2b8c4eaf705b76fd4a9d8b82fb8eb0140..f24132f5ab6362829e88559304173bd9a259caa3 100644
|
||||
index 49ccb27a17bec1d4ff31bc8d72e4724d65adc20c..34ccd489268c51c0aeecf5918878122b49c8d123 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -165,13 +165,11 @@ public final class MCUtil {
|
||||
@@ -168,13 +168,11 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static int fastFloor(double x) {
|
||||
@@ -118,7 +118,7 @@ index cb22cac2b8c4eaf705b76fd4a9d8b82fb8eb0140..f24132f5ab6362829e88559304173bd9
|
||||
}
|
||||
|
||||
public static float normalizeYaw(float f) {
|
||||
@@ -232,11 +230,11 @@ public final class MCUtil {
|
||||
@@ -235,11 +233,11 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static int getChunkCoordinate(final double coordinate) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Gale Skip entity move if movement is zero
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d1f31b991a2a10593fa0ae45d10d7761baffdd75..f7407665c286717456a2525ceea621f6f6db10b7 100644
|
||||
index a4682b8bd269f52af26a03347e8d3869d2b1ba41..d78ad18ac3b69c893a23b6bb9a6837b6a82ebdc2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -318,6 +318,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -319,6 +319,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public float yRotO;
|
||||
public float xRotO;
|
||||
private AABB bb;
|
||||
@@ -16,7 +16,7 @@ index d1f31b991a2a10593fa0ae45d10d7761baffdd75..f7407665c286717456a2525ceea621f6
|
||||
public boolean onGround;
|
||||
public boolean horizontalCollision;
|
||||
public boolean verticalCollision;
|
||||
@@ -1089,6 +1090,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -1104,6 +1105,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
//Luminol end
|
||||
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
@@ -28,7 +28,7 @@ index d1f31b991a2a10593fa0ae45d10d7761baffdd75..f7407665c286717456a2525ceea621f6
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
@@ -4935,6 +4941,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -4957,6 +4963,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
@@ -0,0 +1,192 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 9 Feb 2024 23:43:16 +0000
|
||||
Subject: [PATCH] Gale Optimize world generation chunk and block access
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/Pos.java b/src/main/java/me/jellysquid/mods/lithium/common/util/Pos.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f2f10b651e4fbecdd1ea1bc28ebf40d685a67cee
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/Pos.java
|
||||
@@ -0,0 +1,95 @@
|
||||
+// Gale - Lithium - position utility
|
||||
+
|
||||
+package me.jellysquid.mods.lithium.common.util;
|
||||
+
|
||||
+import net.minecraft.core.SectionPos;
|
||||
+import net.minecraft.world.level.LevelHeightAccessor;
|
||||
+
|
||||
+public class Pos {
|
||||
+
|
||||
+ public static class BlockCoord {
|
||||
+ public static int getYSize(LevelHeightAccessor view) {
|
||||
+ return view.getHeight();
|
||||
+ }
|
||||
+ public static int getMinY(LevelHeightAccessor view) {
|
||||
+ return view.getMinBuildHeight();
|
||||
+ }
|
||||
+ public static int getMaxYInclusive(LevelHeightAccessor view) {
|
||||
+ return view.getMaxBuildHeight() - 1;
|
||||
+ }
|
||||
+ public static int getMaxYExclusive(LevelHeightAccessor view) {
|
||||
+ return view.getMaxBuildHeight();
|
||||
+ }
|
||||
+
|
||||
+ public static int getMaxInSectionCoord(int sectionCoord) {
|
||||
+ return 15 + getMinInSectionCoord(sectionCoord);
|
||||
+ }
|
||||
+
|
||||
+ public static int getMaxYInSectionIndex(LevelHeightAccessor view, int sectionIndex){
|
||||
+ return getMaxInSectionCoord(SectionYCoord.fromSectionIndex(view, sectionIndex));
|
||||
+ }
|
||||
+
|
||||
+ public static int getMinInSectionCoord(int sectionCoord) {
|
||||
+ return SectionPos.sectionToBlockCoord(sectionCoord);
|
||||
+ }
|
||||
+
|
||||
+ public static int getMinYInSectionIndex(LevelHeightAccessor view, int sectionIndex) {
|
||||
+ return getMinInSectionCoord(SectionYCoord.fromSectionIndex(view, sectionIndex));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class ChunkCoord {
|
||||
+ public static int fromBlockCoord(int blockCoord) {
|
||||
+ return SectionPos.blockToSectionCoord(blockCoord);
|
||||
+ }
|
||||
+
|
||||
+ public static int fromBlockSize(int i) {
|
||||
+ return i >> 4; //same method as fromBlockCoord, just be clear about coord/size semantic difference
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class SectionYCoord {
|
||||
+ public static int getNumYSections(LevelHeightAccessor view) {
|
||||
+ return view.getSectionsCount();
|
||||
+ }
|
||||
+ public static int getMinYSection(LevelHeightAccessor view) {
|
||||
+ return view.getMinSection();
|
||||
+ }
|
||||
+ public static int getMaxYSectionInclusive(LevelHeightAccessor view) {
|
||||
+ return view.getMaxSection() - 1;
|
||||
+ }
|
||||
+ public static int getMaxYSectionExclusive(LevelHeightAccessor view) {
|
||||
+ return view.getMaxSection();
|
||||
+ }
|
||||
+
|
||||
+ public static int fromSectionIndex(LevelHeightAccessor view, int sectionCoord) {
|
||||
+ return sectionCoord + SectionYCoord.getMinYSection(view);
|
||||
+ }
|
||||
+ public static int fromBlockCoord(int blockCoord) {
|
||||
+ return SectionPos.blockToSectionCoord(blockCoord);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class SectionYIndex {
|
||||
+ public static int getNumYSections(LevelHeightAccessor view) {
|
||||
+ return view.getSectionsCount();
|
||||
+ }
|
||||
+ public static int getMinYSectionIndex(LevelHeightAccessor view) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ public static int getMaxYSectionIndexInclusive(LevelHeightAccessor view) {
|
||||
+ return view.getSectionsCount() - 1;
|
||||
+ }
|
||||
+ public static int getMaxYSectionIndexExclusive(LevelHeightAccessor view) {
|
||||
+ return view.getSectionsCount();
|
||||
+ }
|
||||
+
|
||||
+ public static int fromSectionCoord(LevelHeightAccessor view, int sectionCoord) {
|
||||
+ return sectionCoord - SectionYCoord.getMinYSection(view);
|
||||
+ }
|
||||
+ public static int fromBlockCoord(LevelHeightAccessor view, int blockCoord) {
|
||||
+ return fromSectionCoord(view, SectionPos.blockToSectionCoord(blockCoord));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 33c1ef45ed620f8424c2c83dd30b674892ddffe3..60db67956d8455d02c7b315cbdcb952206d776db 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -8,6 +8,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -83,6 +84,10 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
private Supplier<String> currentlyGenerating;
|
||||
private final AtomicLong subTickCount = new AtomicLong();
|
||||
private static final ResourceLocation WORLDGEN_REGION_RANDOM = new ResourceLocation("worldgen_region_random");
|
||||
+ // Gale start - Lithium - optimize world generation chunk and block access
|
||||
+ private ChunkAccess[] chunksArr;
|
||||
+ private int minChunkX, minChunkZ;
|
||||
+ // Gale end - Lithium - optimize world generation chunk and block access
|
||||
|
||||
// Folia start - region threading
|
||||
@Override
|
||||
@@ -112,6 +117,11 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
this.lastPos = ((ChunkAccess) chunks.get(chunks.size() - 1)).getPos();
|
||||
this.structureManager = world.structureManager().forWorldGenRegion(this);
|
||||
}
|
||||
+ // Gale start - Lithium - optimize world generation chunk and block access
|
||||
+ this.minChunkX = this.firstPos.x;
|
||||
+ this.minChunkZ = this.firstPos.z;
|
||||
+ this.chunksArr = chunks.toArray(new ChunkAccess[0]);
|
||||
+ // Gale end - Lithium - optimize world generation chunk and block access
|
||||
}
|
||||
|
||||
// Paper start - starlight
|
||||
@@ -150,9 +160,29 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
|
||||
@Override
|
||||
public ChunkAccess getChunk(int chunkX, int chunkZ) {
|
||||
- return this.getChunk(chunkX, chunkZ, ChunkStatus.EMPTY);
|
||||
+ // Gale start - Lithium - optimize world generation chunk and block access - use the chunk array for faster access
|
||||
+ int x = chunkX - this.minChunkX;
|
||||
+ int z = chunkZ - this.minChunkZ;
|
||||
+ int w = this.size;
|
||||
+
|
||||
+ if (x >= 0 && z >= 0 && x < w && z < w) {
|
||||
+ return this.chunksArr[x + z * w];
|
||||
+ } else {
|
||||
+ throw new NullPointerException("No chunk exists at " + new ChunkPos(chunkX, chunkZ));
|
||||
+ }
|
||||
+ // Gale end - Lithium - optimize world generation chunk and block access - use the chunk array for faster access
|
||||
}
|
||||
|
||||
+ // Gale start - Lithium - optimize world generation chunk and block access
|
||||
+ /**
|
||||
+ * Use our chunk fetch function
|
||||
+ */
|
||||
+ public ChunkAccess getChunk(BlockPos pos) {
|
||||
+ // Skip checking chunk.getStatus().isAtLeast(ChunkStatus.EMPTY) here, because it is always true
|
||||
+ return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()));
|
||||
+ }
|
||||
+ // Gale end - Lithium - optimize world generation chunk and block access
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
|
||||
@@ -210,7 +240,17 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
- return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos);
|
||||
+ // Gale start - Lithium - optimize world generation chunk and block access - avoid pointer de-referencing, make method easier to inline
|
||||
+ int x = SectionPos.blockToSectionCoord(pos.getX()) - this.minChunkX;
|
||||
+ int z = SectionPos.blockToSectionCoord(pos.getZ()) - this.minChunkZ;
|
||||
+ int w = this.size;
|
||||
+
|
||||
+ if (x >= 0 && z >= 0 && x < w && z < w) {
|
||||
+ return this.chunksArr[x + z * w].getBlockState(pos);
|
||||
+ } else {
|
||||
+ throw new NullPointerException("No chunk exists at " + new ChunkPos(pos));
|
||||
+ }
|
||||
+ // Gale end - Lithium - optimize world generation chunk and block access - avoid pointer de-referencing, make method easier to inline
|
||||
}
|
||||
|
||||
@Override
|
||||
239
patches/server/0047-Gale-Optimize-noise-generation.patch
Normal file
239
patches/server/0047-Gale-Optimize-noise-generation.patch
Normal file
@@ -0,0 +1,239 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 9 Feb 2024 23:44:23 +0000
|
||||
Subject: [PATCH] Gale Optimize noise generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace57675d130 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
@@ -11,6 +11,27 @@ public final class ImprovedNoise {
|
||||
public final double yo;
|
||||
public final double zo;
|
||||
|
||||
+ // Gale start - C2ME - optimize noise generation
|
||||
+ private static final double[] FLAT_SIMPLEX_GRAD = new double[]{
|
||||
+ 1, 1, 0, 0,
|
||||
+ -1, 1, 0, 0,
|
||||
+ 1, -1, 0, 0,
|
||||
+ -1, -1, 0, 0,
|
||||
+ 1, 0, 1, 0,
|
||||
+ -1, 0, 1, 0,
|
||||
+ 1, 0, -1, 0,
|
||||
+ -1, 0, -1, 0,
|
||||
+ 0, 1, 1, 0,
|
||||
+ 0, -1, 1, 0,
|
||||
+ 0, 1, -1, 0,
|
||||
+ 0, -1, -1, 0,
|
||||
+ 1, 1, 0, 0,
|
||||
+ 0, -1, 1, 0,
|
||||
+ -1, 1, 0, 0,
|
||||
+ 0, -1, -1, 0,
|
||||
+ };
|
||||
+ // Gale end - C2ME - optimize noise generation
|
||||
+
|
||||
public ImprovedNoise(RandomSource random) {
|
||||
this.xo = random.nextDouble() * 256.0D;
|
||||
this.yo = random.nextDouble() * 256.0D;
|
||||
@@ -40,12 +61,14 @@ public final class ImprovedNoise {
|
||||
double d = x + this.xo;
|
||||
double e = y + this.yo;
|
||||
double f = z + this.zo;
|
||||
- int i = Mth.floor(d);
|
||||
- int j = Mth.floor(e);
|
||||
- int k = Mth.floor(f);
|
||||
- double g = d - (double)i;
|
||||
- double h = e - (double)j;
|
||||
- double l = f - (double)k;
|
||||
+ // Gale start - C2ME - optimize noise generation - optimize: remove frequent type conversions
|
||||
+ double i = Math.floor(d);
|
||||
+ double j = Math.floor(e);
|
||||
+ double k = Math.floor(f);
|
||||
+ double g = d - i;
|
||||
+ double h = e - j;
|
||||
+ double l = f - k;
|
||||
+ // Gale end - C2ME - optimize noise generation - optimize: remove frequent type conversions
|
||||
double o;
|
||||
if (yScale != 0.0D) {
|
||||
double m;
|
||||
@@ -55,25 +78,27 @@ public final class ImprovedNoise {
|
||||
m = h;
|
||||
}
|
||||
|
||||
- o = (double)Mth.floor(m / yScale + (double)1.0E-7F) * yScale;
|
||||
+ o = Math.floor(m / yScale + (double)1.0E-7F) * yScale; // Gale - C2ME - optimize noise generation - optimize: remove frequent type conversions
|
||||
} else {
|
||||
o = 0.0D;
|
||||
}
|
||||
|
||||
- return this.sampleAndLerp(i, j, k, g, h - o, l, h);
|
||||
+ return this.sampleAndLerp((int) i, (int) j, (int) k, g, h - o, l, h); // Gale - C2ME - optimize noise generation - optimize: remove frequent type conversions
|
||||
}
|
||||
|
||||
public double noiseWithDerivative(double x, double y, double z, double[] ds) {
|
||||
double d = x + this.xo;
|
||||
double e = y + this.yo;
|
||||
double f = z + this.zo;
|
||||
- int i = Mth.floor(d);
|
||||
- int j = Mth.floor(e);
|
||||
- int k = Mth.floor(f);
|
||||
- double g = d - (double)i;
|
||||
- double h = e - (double)j;
|
||||
- double l = f - (double)k;
|
||||
- return this.sampleWithDerivative(i, j, k, g, h, l, ds);
|
||||
+ // Gale start - C2ME - optimize noise generation - optimize: remove frequent type conversions
|
||||
+ double i = Math.floor(d);
|
||||
+ double j = Math.floor(e);
|
||||
+ double k = Math.floor(f);
|
||||
+ double g = d - i;
|
||||
+ double h = e - j;
|
||||
+ double l = f - k;
|
||||
+ return this.sampleWithDerivative((int) i, (int) j, (int) k, g, h, l, ds);
|
||||
+ // Gale end - C2ME - optimize noise generation - optimize: remove frequent type conversions
|
||||
}
|
||||
|
||||
private static double gradDot(int hash, double x, double y, double z) {
|
||||
@@ -85,24 +110,69 @@ public final class ImprovedNoise {
|
||||
}
|
||||
|
||||
private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalY) {
|
||||
- int i = this.p(sectionX);
|
||||
- int j = this.p(sectionX + 1);
|
||||
- int k = this.p(i + sectionY);
|
||||
- int l = this.p(i + sectionY + 1);
|
||||
- int m = this.p(j + sectionY);
|
||||
- int n = this.p(j + sectionY + 1);
|
||||
- double d = gradDot(this.p(k + sectionZ), localX, localY, localZ);
|
||||
- double e = gradDot(this.p(m + sectionZ), localX - 1.0D, localY, localZ);
|
||||
- double f = gradDot(this.p(l + sectionZ), localX, localY - 1.0D, localZ);
|
||||
- double g = gradDot(this.p(n + sectionZ), localX - 1.0D, localY - 1.0D, localZ);
|
||||
- double h = gradDot(this.p(k + sectionZ + 1), localX, localY, localZ - 1.0D);
|
||||
- double o = gradDot(this.p(m + sectionZ + 1), localX - 1.0D, localY, localZ - 1.0D);
|
||||
- double p = gradDot(this.p(l + sectionZ + 1), localX, localY - 1.0D, localZ - 1.0D);
|
||||
- double q = gradDot(this.p(n + sectionZ + 1), localX - 1.0D, localY - 1.0D, localZ - 1.0D);
|
||||
- double r = Mth.smoothstep(localX);
|
||||
- double s = Mth.smoothstep(fadeLocalY);
|
||||
- double t = Mth.smoothstep(localZ);
|
||||
- return Mth.lerp3(r, s, t, d, e, f, g, h, o, p, q);
|
||||
+ // Gale start - C2ME - optimize noise generation - inline math & small optimization: remove frequent type conversions and redundant ops
|
||||
+ final int var0 = sectionX & 0xFF;
|
||||
+ final int var1 = (sectionX + 1) & 0xFF;
|
||||
+ final int var2 = this.p[var0] & 0xFF;
|
||||
+ final int var3 = this.p[var1] & 0xFF;
|
||||
+ final int var4 = (var2 + sectionY) & 0xFF;
|
||||
+ final int var5 = (var3 + sectionY) & 0xFF;
|
||||
+ final int var6 = (var2 + sectionY + 1) & 0xFF;
|
||||
+ final int var7 = (var3 + sectionY + 1) & 0xFF;
|
||||
+ final int var8 = this.p[var4] & 0xFF;
|
||||
+ final int var9 = this.p[var5] & 0xFF;
|
||||
+ final int var10 = this.p[var6] & 0xFF;
|
||||
+ final int var11 = this.p[var7] & 0xFF;
|
||||
+
|
||||
+ final int var12 = (var8 + sectionZ) & 0xFF;
|
||||
+ final int var13 = (var9 + sectionZ) & 0xFF;
|
||||
+ final int var14 = (var10 + sectionZ) & 0xFF;
|
||||
+ final int var15 = (var11 + sectionZ) & 0xFF;
|
||||
+ final int var16 = (var8 + sectionZ + 1) & 0xFF;
|
||||
+ final int var17 = (var9 + sectionZ + 1) & 0xFF;
|
||||
+ final int var18 = (var10 + sectionZ + 1) & 0xFF;
|
||||
+ final int var19 = (var11 + sectionZ + 1) & 0xFF;
|
||||
+ final int var20 = (this.p[var12] & 15) << 2;
|
||||
+ final int var21 = (this.p[var13] & 15) << 2;
|
||||
+ final int var22 = (this.p[var14] & 15) << 2;
|
||||
+ final int var23 = (this.p[var15] & 15) << 2;
|
||||
+ final int var24 = (this.p[var16] & 15) << 2;
|
||||
+ final int var25 = (this.p[var17] & 15) << 2;
|
||||
+ final int var26 = (this.p[var18] & 15) << 2;
|
||||
+ final int var27 = (this.p[var19] & 15) << 2;
|
||||
+ final double var60 = localX - 1.0;
|
||||
+ final double var61 = localY - 1.0;
|
||||
+ final double var62 = localZ - 1.0;
|
||||
+ final double var87 = FLAT_SIMPLEX_GRAD[(var20) | 0] * localX + FLAT_SIMPLEX_GRAD[(var20) | 1] * localY + FLAT_SIMPLEX_GRAD[(var20) | 2] * localZ;
|
||||
+ final double var88 = FLAT_SIMPLEX_GRAD[(var21) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var21) | 1] * localY + FLAT_SIMPLEX_GRAD[(var21) | 2] * localZ;
|
||||
+ final double var89 = FLAT_SIMPLEX_GRAD[(var22) | 0] * localX + FLAT_SIMPLEX_GRAD[(var22) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var22) | 2] * localZ;
|
||||
+ final double var90 = FLAT_SIMPLEX_GRAD[(var23) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var23) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var23) | 2] * localZ;
|
||||
+ final double var91 = FLAT_SIMPLEX_GRAD[(var24) | 0] * localX + FLAT_SIMPLEX_GRAD[(var24) | 1] * localY + FLAT_SIMPLEX_GRAD[(var24) | 2] * var62;
|
||||
+ final double var92 = FLAT_SIMPLEX_GRAD[(var25) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var25) | 1] * localY + FLAT_SIMPLEX_GRAD[(var25) | 2] * var62;
|
||||
+ final double var93 = FLAT_SIMPLEX_GRAD[(var26) | 0] * localX + FLAT_SIMPLEX_GRAD[(var26) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var26) | 2] * var62;
|
||||
+ final double var94 = FLAT_SIMPLEX_GRAD[(var27) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var27) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var27) | 2] * var62;
|
||||
+
|
||||
+ final double var95 = localX * 6.0 - 15.0;
|
||||
+ final double var96 = fadeLocalY * 6.0 - 15.0;
|
||||
+ final double var97 = localZ * 6.0 - 15.0;
|
||||
+ final double var98 = localX * var95 + 10.0;
|
||||
+ final double var99 = fadeLocalY * var96 + 10.0;
|
||||
+ final double var100 = localZ * var97 + 10.0;
|
||||
+ final double var101 = localX * localX * localX * var98;
|
||||
+ final double var102 = fadeLocalY * fadeLocalY * fadeLocalY * var99;
|
||||
+ final double var103 = localZ * localZ * localZ * var100;
|
||||
+
|
||||
+ final double var113 = var87 + var101 * (var88 - var87);
|
||||
+ final double var114 = var93 + var101 * (var94 - var93);
|
||||
+ final double var115 = var91 + var101 * (var92 - var91);
|
||||
+ final double var116 = var89 + var101 * (var90 - var89);
|
||||
+ final double var117 = var114 - var115;
|
||||
+ final double var118 = var102 * (var116 - var113);
|
||||
+ final double var119 = var102 * var117;
|
||||
+ final double var120 = var113 + var118;
|
||||
+ final double var121 = var115 + var119;
|
||||
+ return var120 + (var103 * (var121 - var120));
|
||||
+ // Gale end - C2ME - optimize noise generation - inline math & small optimization: remove frequent type conversions and redundant ops
|
||||
}
|
||||
|
||||
private double sampleWithDerivative(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double[] ds) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
index 97ef7288ea935f3d17c5b7a9eba642143c786c2b..6d084145f8529fa8b0439123f9a9812940cc62da 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
@@ -26,6 +26,10 @@ public class PerlinNoise {
|
||||
private final double lowestFreqValueFactor;
|
||||
private final double lowestFreqInputFactor;
|
||||
private final double maxValue;
|
||||
+ // Gale start - C2ME - optimize noise generation
|
||||
+ private final int octaveSamplersCount;
|
||||
+ private final double [] amplitudesArray;
|
||||
+ // Gale end - C2ME - optimize noise generation
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
@@ -131,6 +135,10 @@ public class PerlinNoise {
|
||||
this.lowestFreqInputFactor = Math.pow(2.0D, (double)(-j));
|
||||
this.lowestFreqValueFactor = Math.pow(2.0D, (double)(i - 1)) / (Math.pow(2.0D, (double)i) - 1.0D);
|
||||
this.maxValue = this.edgeValue(2.0D);
|
||||
+ // Gale start - C2ME - optimize noise generation
|
||||
+ this.octaveSamplersCount = this.noiseLevels.length;
|
||||
+ this.amplitudesArray = this.amplitudes.toDoubleArray();
|
||||
+ // Gale end - C2ME - optimize noise generation
|
||||
}
|
||||
|
||||
protected double maxValue() {
|
||||
@@ -142,7 +150,27 @@ public class PerlinNoise {
|
||||
}
|
||||
|
||||
public double getValue(double x, double y, double z) {
|
||||
- return this.getValue(x, y, z, 0.0D, 0.0D, false);
|
||||
+ // Gale start - C2ME - optimize noise generation - optimize for common cases
|
||||
+ double d = 0.0;
|
||||
+ double e = this.lowestFreqInputFactor;
|
||||
+ double f = this.lowestFreqValueFactor;
|
||||
+
|
||||
+ for(int i = 0; i < this.octaveSamplersCount; ++i) {
|
||||
+ ImprovedNoise perlinNoiseSampler = this.noiseLevels[i];
|
||||
+ if (perlinNoiseSampler != null) {
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ double g = perlinNoiseSampler.noise(
|
||||
+ wrap(x * e), wrap(y * e), wrap(z * e), 0.0, 0.0
|
||||
+ );
|
||||
+ d += this.amplitudesArray[i] * g * f;
|
||||
+ }
|
||||
+
|
||||
+ e *= 2.0;
|
||||
+ f /= 2.0;
|
||||
+ }
|
||||
+
|
||||
+ return d;
|
||||
+ // Gale end - C2ME - optimize noise generation - optimize for common cases
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
434
patches/server/0048-Gale-Faster-chunk-serialization.patch
Normal file
434
patches/server/0048-Gale-Faster-chunk-serialization.patch
Normal file
@@ -0,0 +1,434 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Tue, 20 Feb 2024 13:21:53 +0000
|
||||
Subject: [PATCH] Gale Faster chunk serialization
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..349618b7f544bf9a30e0796d4d9a26407a2b8329
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
@@ -0,0 +1,192 @@
|
||||
+// Gale - Lithium - faster chunk serialization
|
||||
+
|
||||
+package me.jellysquid.mods.lithium.common.world.chunk;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import it.unimi.dsi.fastutil.HashCommon;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+import java.util.function.Predicate;
|
||||
+import net.minecraft.core.IdMap;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.VarInt;
|
||||
+import net.minecraft.world.level.chunk.Palette;
|
||||
+import net.minecraft.world.level.chunk.PaletteResize;
|
||||
+
|
||||
+import 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 Reference2IntMap<T> table;
|
||||
+ private T[] entries;
|
||||
+ private int size = 0;
|
||||
+
|
||||
+ public LithiumHashPalette(IdMap<T> idList, PaletteResize<T> resizeHandler, int indexBits, T[] entries, Reference2IntMap<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(T obj) {
|
||||
+ int id = this.table.getInt(obj);
|
||||
+
|
||||
+ if (id == ABSENT_VALUE) {
|
||||
+ id = this.computeEntry(obj);
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean maybeHas(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 T valueFor(int id) {
|
||||
+ T[] entries = this.entries;
|
||||
+
|
||||
+ if (id >= 0 && id < entries.length) {
|
||||
+ return entries[id];
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void read(FriendlyByteBuf buf) {
|
||||
+ this.clear();
|
||||
+
|
||||
+ int entryCount = buf.readVarInt();
|
||||
+
|
||||
+ for (int i = 0; i < entryCount; ++i) {
|
||||
+ this.addEntry(this.idList.byId(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 Palette<T> copy() {
|
||||
+ return new LithiumHashPalette<>(this.idList, this.resizeHandler, this.indexBits, this.entries.clone(), new Reference2IntOpenHashMap<>(this.table), this.size);
|
||||
+ }
|
||||
+
|
||||
+ private void clear() {
|
||||
+ Arrays.fill(this.entries, null);
|
||||
+ this.table.clear();
|
||||
+ this.size = 0;
|
||||
+ }
|
||||
+
|
||||
+ public List<T> getElements() {
|
||||
+ ImmutableList.Builder<T> builder = new ImmutableList.Builder<>();
|
||||
+ for (T entry : this.entries) {
|
||||
+ if (entry != null) {
|
||||
+ builder.add(entry);
|
||||
+ }
|
||||
+ }
|
||||
+ return builder.build();
|
||||
+ }
|
||||
+
|
||||
+ public static <A> Palette<A> create(int bits, IdMap<A> idList, PaletteResize<A> listener, List<A> list) {
|
||||
+ return new LithiumHashPalette<>(idList, bits, listener, list);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
index 8bafd5fd7499ba4a04bf706cfd1e156073716e21..f62aab492f231e688b448389b1910e6fc2f5d8e6 100644
|
||||
--- a/src/main/java/net/minecraft/util/BitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
@@ -31,4 +31,6 @@ public interface BitStorage {
|
||||
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ <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
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
index 453c1d7e01970fd817d27f59c3b00ffc70e8ca0c..844539798213360831541f49d97f8401d80d030e 100644
|
||||
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
@@ -201,4 +201,45 @@ 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/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
index f8de91393564b3691c17339ac9196cc0fc1cf748..ecfe47110697378d7f7369640cd06b77f6fa0a87 100644
|
||||
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -72,4 +72,6 @@ public class ZeroBitStorage implements BitStorage {
|
||||
public BitStorage copy() {
|
||||
return this;
|
||||
}
|
||||
+
|
||||
+ @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
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
index acae3eb30e0689048937f479dc3070f0688abdad..4b79f0474a9013dd4fdb68c6363ca1942ba8b007 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
+++ b/src/main/java/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 newBits, T object);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de8f1066bf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -25,6 +25,22 @@ 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 = (newSize, added) -> {
|
||||
return 0;
|
||||
@@ -302,30 +318,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // 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<>(idList, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
- int i = paletteProvider.size();
|
||||
- int[] is = new int[i];
|
||||
- this.data.storage.unpack(is);
|
||||
- swapPalette(is, (id) -> {
|
||||
- return hashMapPalette.idFor(this.data.palette.valueFor(id));
|
||||
- });
|
||||
- int j = paletteProvider.calculateBitsForSerialization(idList, hashMapPalette.getSize());
|
||||
- Optional<LongStream> optional;
|
||||
- if (j != 0) {
|
||||
- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(j, i, is);
|
||||
- optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw()));
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
+ // The palette that will be serialized
|
||||
+ me.jellysquid.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 me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
|
||||
+ hashPalette = lithiumHashPalette;
|
||||
}
|
||||
|
||||
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
|
||||
+ if (elements == null) {
|
||||
+ me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> compactedPalette = new me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<>(idList, storage.getBits(), this.dummyPaletteResize);
|
||||
+ short[] array = this.getOrCreate(paletteProvider.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() == paletteProvider.calculateBitsForSerialization(idList, 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 = paletteProvider.calculateBitsForSerialization(idList, 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[] is, IntUnaryOperator applier) {
|
||||
@@ -365,17 +405,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> counter) {
|
||||
- if (this.data.palette.getSize() == 1) {
|
||||
- counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
- } else {
|
||||
- Int2IntOpenHashMap int2IntOpenHashMap = new Int2IntOpenHashMap();
|
||||
- this.data.storage.getAll((key) -> {
|
||||
- int2IntOpenHashMap.addTo(key, 1);
|
||||
- });
|
||||
- int2IntOpenHashMap.int2IntEntrySet().forEach((entry) -> {
|
||||
- counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.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) {
|
||||
+ counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
+ } else {
|
||||
+ Int2IntOpenHashMap int2IntOpenHashMap = new Int2IntOpenHashMap();
|
||||
+ this.data.storage.getAll((key) -> {
|
||||
+ int2IntOpenHashMap.addTo(key, 1);
|
||||
+ });
|
||||
+ int2IntOpenHashMap.int2IntEntrySet().forEach((entry) -> {
|
||||
+ counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.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) {
|
||||
+ counter.accept(obj, counts[i]);
|
||||
+ }
|
||||
}
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
}
|
||||
|
||||
static record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sat, 6 Apr 2024 05:14:57 +0000
|
||||
Subject: [PATCH] Gale Reduce lambda and Optional allocation in
|
||||
EntityBasedExplosionDamageCalculator
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
index 2f9f15d99f8b31e9f13f7f32378b2a9e09bcb5e5..4e4dfb72d5a0b46917999b709c655ccfdae27183 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
@@ -15,9 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
|
||||
|
||||
@Override
|
||||
public Optional<Float> getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) {
|
||||
- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState).map((max) -> {
|
||||
- return this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, max);
|
||||
- });
|
||||
+ // Gale start - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator
|
||||
+ Optional<Float> optionalBlastResistance = super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
|
||||
+ if (optionalBlastResistance.isPresent()) {
|
||||
+ float blastResistance = optionalBlastResistance.get();
|
||||
+ float effectiveExplosionResistance = this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, blastResistance);
|
||||
+ if (effectiveExplosionResistance != blastResistance) {
|
||||
+ return Optional.of(effectiveExplosionResistance);
|
||||
+ }
|
||||
+ }
|
||||
+ return optionalBlastResistance;
|
||||
+ // Gale end - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sat, 6 Apr 2024 05:17:19 +0000
|
||||
Subject: [PATCH] Gale Replace AI goal set with optimized collection
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
index 0f53c206b4c0607e2cda5cfa4edeae5209e897bf..6313020a80cab0b8df8d775431d4aa063c51ce18 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
@@ -13,6 +13,7 @@ import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import org.slf4j.Logger;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
|
||||
|
||||
public class GoalSelector {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -28,7 +29,7 @@ public class GoalSelector {
|
||||
}
|
||||
};
|
||||
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
|
||||
- private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
|
||||
+ private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>(); // Gale - Lithium - replace AI goal set with optimized collection
|
||||
private final Supplier<ProfilerFiller> profiler;
|
||||
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
|
||||
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sat, 6 Apr 2024 05:17:42 +0000
|
||||
Subject: [PATCH] Gale Replace AI attributes with optimized collections
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index 683c9693754d1a87b7e8fccc757a0d0963351f60..d904cc2d882f62f74ff34f7e8266947798563ed4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
@@ -1,8 +1,6 @@
|
||||
package net.minecraft.world.entity.ai.attributes;
|
||||
|
||||
-import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
-import com.google.common.collect.Sets;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
@@ -10,6 +8,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
|
||||
+import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
@@ -20,8 +21,10 @@ import org.slf4j.Logger;
|
||||
|
||||
public class AttributeMap {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- private final Map<Attribute, AttributeInstance> attributes = Maps.newHashMap();
|
||||
- private final Set<AttributeInstance> dirtyAttributes = Sets.newHashSet();
|
||||
+ // Gale start - Lithium - replace AI attributes with optimized collections
|
||||
+ private final Map<Attribute, AttributeInstance> attributes = new Reference2ReferenceOpenHashMap<>(0);
|
||||
+ private final Set<AttributeInstance> dirtyAttributes = new ReferenceOpenHashSet<>(0);
|
||||
+ // Gale end - Lithium - replace AI attributes with optimized collections
|
||||
private final AttributeSupplier supplier;
|
||||
private final java.util.function.Function<Attribute, AttributeInstance> createInstance; // Pufferfish
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sat, 6 Apr 2024 05:18:00 +0000
|
||||
Subject: [PATCH] Gale Replace throttle tracker map with optimized collection
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
index a53dd1ea02bd19826cd9fd337459b08e9533bce8..dec666713a1d3b5e3f2aa4bcbe8094ade8be1b05 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server.network;
|
||||
|
||||
+import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -13,7 +15,8 @@ import net.minecraft.server.MinecraftServer;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.net.InetAddress;
|
||||
-import java.util.HashMap;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.Map;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketListener {
|
||||
@@ -24,7 +27,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
static final java.util.regex.Pattern PROP_PATTERN = java.util.regex.Pattern.compile("\\w{0,16}");
|
||||
// Spigot end
|
||||
// CraftBukkit start - add fields
|
||||
- private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
|
||||
+ private static final Object2LongOpenHashMap<InetAddress> throttleTracker = new Object2LongOpenHashMap<>(); // Gale - Dionysus - replace throttle tracker map with optimized collection
|
||||
private static int throttleCounter = 0;
|
||||
// CraftBukkit end
|
||||
private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request");
|
||||
@@ -51,7 +54,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
|
||||
|
||||
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
|
||||
- if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
|
||||
+ if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.getLong(address) < connectionThrottle) { // Gale - Dionysus - replace throttle tracker map with optimized collection
|
||||
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
|
||||
Component chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message
|
||||
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||
@@ -65,13 +68,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
ServerHandshakePacketListenerImpl.throttleCounter = 0;
|
||||
|
||||
// Cleanup stale entries
|
||||
- java.util.Iterator iter = ServerHandshakePacketListenerImpl.throttleTracker.entrySet().iterator();
|
||||
- while (iter.hasNext()) {
|
||||
- java.util.Map.Entry<InetAddress, Long> entry = (java.util.Map.Entry) iter.next();
|
||||
- if (entry.getValue() > connectionThrottle) {
|
||||
- iter.remove();
|
||||
- }
|
||||
- }
|
||||
+ throttleTracker.object2LongEntrySet().removeIf(entry -> entry.getLongValue() > connectionThrottle); // Gale - Dionysus - replace throttle tracker map with optimized collection
|
||||
}
|
||||
}
|
||||
} // Paper - Unix domain socket support
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Sparkly Paper Optimize canSee checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index c212030a24174115a975604b91d03cf8ad4043de..2fc86eb396ed600154840dd6cd43b9294a34595c 100644
|
||||
index 76ad4d8bce1611ead6f1596b2ba78267e3718655..d1dc02b3e4f775c9bd79073a8e96243aa5ab6c24 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1408,7 +1408,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -18,10 +18,10 @@ index c212030a24174115a975604b91d03cf8ad4043de..2fc86eb396ed600154840dd6cd43b929
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index f4b7f2f223964df7533577342d8af158af35363b..93e022f9b30da70d86638b9ac9105d1b97a53e12 100644
|
||||
index 26f70965b45fa3c344781b569a651a4668d0621d..49f207b7e06a3f939dc6c9b4a078f6db7b779618 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -181,7 +181,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -187,7 +187,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private boolean hasPlayedBefore = false;
|
||||
private final ConversationTracker conversationTracker = new ConversationTracker();
|
||||
private final Set<String> channels = new HashSet<String>();
|
||||
@@ -30,7 +30,7 @@ index f4b7f2f223964df7533577342d8af158af35363b..93e022f9b30da70d86638b9ac9105d1b
|
||||
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
|
||||
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
|
||||
private int hash = 0;
|
||||
@@ -2116,9 +2116,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2146,9 +2146,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Leaves Protocol Core
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
index fc3d332aa1c1d469cedfe2aaa7102dcd78e25642..bebaa4e7abcbd01dc57fddf2a473b846e887cc7f 100644
|
||||
index 1ae61bc6603dd3ac290e3ead20416f9c5b63ff02..168ed2c21aed6a10f3aca259880b1b8bdbf98b78 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
|
||||
@@ -313,6 +313,8 @@ public final class RegionizedServer {
|
||||
@@ -314,6 +314,8 @@ public final class RegionizedServer {
|
||||
|
||||
// player list
|
||||
MinecraftServer.getServer().getPlayerList().tick();
|
||||
@@ -56,10 +56,10 @@ index c68910b2a2eb703406fb406a86783cf6ab48651e..f935214ed80fe54038a96a5cd668a072
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index d13edeff0de64cb77d7668e5b964cabcf9729388..c8c72cefba44ce8587a9ae22f5a87d3199f8ca5f 100644
|
||||
index 90be312057221a5a78066d89783c5e22008d797d..0f172512085e9dfc0850451d2c6bbffb18221f8f 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -433,6 +433,8 @@ public abstract class PlayerList {
|
||||
@@ -441,6 +441,8 @@ public abstract class PlayerList {
|
||||
//return; // Folia - region threading - must still allow the player to connect, as we must add to chunk map before handling disconnect
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ index d13edeff0de64cb77d7668e5b964cabcf9729388..c8c72cefba44ce8587a9ae22f5a87d31
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
@@ -688,6 +690,7 @@ public abstract class PlayerList {
|
||||
@@ -696,6 +698,7 @@ public abstract class PlayerList {
|
||||
return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())));
|
||||
}
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
||||
@@ -77,10 +77,10 @@ index d13edeff0de64cb77d7668e5b964cabcf9729388..c8c72cefba44ce8587a9ae22f5a87d31
|
||||
ServerLevel worldserver = entityplayer.serverLevel();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 57243238d9363cc68c1022871d62b41c424b8a75..23cd0290f8939aec85b5699feb6ac7f12bde14a7 100644
|
||||
index c70eb23d9745bdbfcc340bb554cf0bf2db71f5de..dc223b536eadd2da6cf3c758a62d0ed81b5a7b3b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -469,6 +469,7 @@ public final class CraftServer implements Server {
|
||||
@@ -471,6 +471,7 @@ public final class CraftServer implements Server {
|
||||
MapPalette.setMapColorCache(new CraftMapColorCache(this.logger));
|
||||
}
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
@@ -88,7 +88,7 @@ index 57243238d9363cc68c1022871d62b41c424b8a75..23cd0290f8939aec85b5699feb6ac7f1
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1112,6 +1113,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1129,6 +1130,7 @@ public final class CraftServer implements Server {
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
@@ -120,10 +120,10 @@ index 0000000000000000000000000000000000000000..64a1d25973b032e8cab64bbffa6824a1
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..055f044ce6cef4377f6f577efdbfad0ec9a2d57b
|
||||
index 0000000000000000000000000000000000000000..8b7813c442733f5d4d3b2a072902099cbe596b37
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
@@ -0,0 +1,340 @@
|
||||
@@ -0,0 +1,344 @@
|
||||
+package top.leavesmc.leaves.protocol.core;
|
||||
+
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
@@ -167,7 +167,11 @@ index 0000000000000000000000000000000000000000..055f044ce6cef4377f6f577efdbfad0e
|
||||
+ private static final Map<LeavesProtocol, Map<ProtocolHandler.MinecraftRegister, Method>> MINECRAFT_REGISTER = new HashMap<>();
|
||||
+
|
||||
+ public static void init() {
|
||||
+ for (Class<?> clazz : getClasses("top.leavesmc.leaves.protocol")) {
|
||||
+ //Luminol start - For the protocol supports of luminol
|
||||
+ final Set<Class<?>> allClazz = getClasses("org.leavesmc.leaves.protocol");
|
||||
+ allClazz.addAll(getClasses("me.earthme.luminol.protocols"));
|
||||
+ //Luminol end
|
||||
+ for (Class<?> clazz : allClazz) {
|
||||
+ final LeavesProtocol protocol = clazz.getAnnotation(LeavesProtocol.class);
|
||||
+ if (protocol != null) {
|
||||
+ Set<Method> methods;
|
||||
@@ -6,21 +6,25 @@ Subject: [PATCH] Leaves Bladeren Protocol
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/gameplay/LeavesBladerenProtocolConfig.java b/src/main/java/me/earthme/luminol/config/modules/gameplay/LeavesBladerenProtocolConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b882549a3c3bc8c192014fd6e1ac7b4f0feddafc
|
||||
index 0000000000000000000000000000000000000000..4950d33288d6bc3c4ce90ae12bbf4797e3989500
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/gameplay/LeavesBladerenProtocolConfig.java
|
||||
@@ -0,0 +1,24 @@
|
||||
@@ -0,0 +1,28 @@
|
||||
+package me.earthme.luminol.config.modules.gameplay;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.HotReloadUnsupported;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class LeavesBladerenProtocolConfig implements IConfigModule {
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "enable_base_protocol")
|
||||
+ public static boolean enableBaseProtocol = false;
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "enable_mspt_sync_protocol")
|
||||
+ public static boolean msptSyncProtocol = false;
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "mspt_sync_interval")
|
||||
+ public static int msptSyncTickInterval = 20;
|
||||
+
|
||||
@@ -21,10 +21,10 @@ index 64a1d25973b032e8cab64bbffa6824a131676773..57a563b3f2d01719d490578907411d25
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
index 055f044ce6cef4377f6f577efdbfad0ec9a2d57b..18fc0e2c890020bf587f5b1d2e097126d3e19999 100644
|
||||
index 8b7813c442733f5d4d3b2a072902099cbe596b37..1f5b37daa5cbb709eeacf3dc7a4f9b4a0dc05274 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
@@ -56,7 +56,7 @@ public class LeavesProtocolManager {
|
||||
@@ -60,7 +60,7 @@ public class LeavesProtocolManager {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ index 055f044ce6cef4377f6f577efdbfad0ec9a2d57b..18fc0e2c890020bf587f5b1d2e097126
|
||||
for (final Method method : methods) {
|
||||
if (method.isBridge() || method.isSynthetic() || !Modifier.isStatic(method.getModifiers())) {
|
||||
continue;
|
||||
@@ -131,13 +131,13 @@ public class LeavesProtocolManager {
|
||||
@@ -135,13 +135,13 @@ public class LeavesProtocolManager {
|
||||
|
||||
public static CustomPacketPayload getPayload(ResourceLocation id, FriendlyByteBuf buf) {
|
||||
for (LeavesProtocol protocol : KNOWN_TYPES.keySet()) {
|
||||
@@ -49,7 +49,7 @@ index 055f044ce6cef4377f6f577efdbfad0ec9a2d57b..18fc0e2c890020bf587f5b1d2e097126
|
||||
try {
|
||||
return map.get(receiver).newInstance(id, buf);
|
||||
} catch (InvocationTargetException | InstantiationException | IllegalAccessException e) {
|
||||
@@ -151,15 +151,14 @@ public class LeavesProtocolManager {
|
||||
@@ -155,15 +155,14 @@ public class LeavesProtocolManager {
|
||||
|
||||
public static void handlePayload(ServerPlayer player, CustomPacketPayload payload) {
|
||||
for (LeavesProtocol protocol : KNOW_RECEIVERS.keySet()) {
|
||||
@@ -67,7 +67,7 @@ index 055f044ce6cef4377f6f577efdbfad0ec9a2d57b..18fc0e2c890020bf587f5b1d2e097126
|
||||
try {
|
||||
map.get(receiver).invoke(null, player, payload);
|
||||
} catch (InvocationTargetException | IllegalAccessException e) {
|
||||
@@ -222,7 +221,7 @@ public class LeavesProtocolManager {
|
||||
@@ -226,7 +225,7 @@ public class LeavesProtocolManager {
|
||||
public static void handleMinecraftRegister(String channelId, ServerPlayer player) {
|
||||
for (LeavesProtocol protocol : MINECRAFT_REGISTER.keySet()) {
|
||||
String[] channel = channelId.split(":");
|
||||
153
patches/server/0059-Leaves-carpet-protocol-support.patch
Normal file
153
patches/server/0059-Leaves-carpet-protocol-support.patch
Normal file
@@ -0,0 +1,153 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Thu, 8 Feb 2024 11:57:18 +0000
|
||||
Subject: [PATCH] Leaves carpet protocol support
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/gameplay/LeavesCarpetProtocolSupportConfig.java b/src/main/java/me/earthme/luminol/config/modules/gameplay/LeavesCarpetProtocolSupportConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0ef77515b213b74bdcf7dac70a02bfaa1c8804f5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/gameplay/LeavesCarpetProtocolSupportConfig.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package me.earthme.luminol.config.modules.gameplay;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.HotReloadUnsupported;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class LeavesCarpetProtocolSupportConfig implements IConfigModule {
|
||||
+ @HotReloadUnsupported
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.GAMEPLAY;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "leaves_carpet_protocol";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0542d66a3dfae2aa3ccb6ca3dced6b34024017ad
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
@@ -0,0 +1,113 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import me.earthme.luminol.config.modules.gameplay.LeavesCarpetProtocolSupportConfig;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.protocol.core.LeavesProtocol;
|
||||
+import top.leavesmc.leaves.protocol.core.ProtocolHandler;
|
||||
+import top.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Locale;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "carpet")
|
||||
+public class CarpetServerProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "carpet";
|
||||
+ public static final String VERSION = "leaves-carpet-1.0.0";
|
||||
+
|
||||
+ private static final ResourceLocation HELLO_ID = CarpetServerProtocol.id("hello");
|
||||
+
|
||||
+ private static final String HI = "69";
|
||||
+ private static final String HELLO = "420";
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (LeavesCarpetProtocolSupportConfig.enabled) {
|
||||
+ CompoundTag data = new CompoundTag();
|
||||
+ data.putString(HI, VERSION);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = CarpetPayload.class, payloadId = "hello")
|
||||
+ private static void handleHello(@NotNull ServerPlayer player, @NotNull CarpetServerProtocol.CarpetPayload payload) {
|
||||
+ if (LeavesCarpetProtocolSupportConfig.enabled) {
|
||||
+ if (payload.nbt.contains(HELLO)) {
|
||||
+ MinecraftServer.LOGGER.info("Player " + player.getScoreboardName() + " joined with carpet " + payload.nbt.getString(HELLO));
|
||||
+ CompoundTag data = new CompoundTag();
|
||||
+ CarpetRules.write(data);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class CarpetRules {
|
||||
+
|
||||
+ private static final Map<String, CarpetRule> rules = new HashMap<>();
|
||||
+
|
||||
+ public static void write(@NotNull CompoundTag tag) {
|
||||
+ CompoundTag rulesNbt = new CompoundTag();
|
||||
+ rules.values().forEach(rule -> rule.writeNBT(rulesNbt));
|
||||
+
|
||||
+ tag.put("Rules", rulesNbt);
|
||||
+ }
|
||||
+
|
||||
+ public static void register(CarpetRule rule) {
|
||||
+ rules.put(rule.name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record CarpetRule(String identifier, String name, String value) {
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Contract("_, _, _ -> new")
|
||||
+ public static CarpetRule of(String identifier, String name, Enum<?> value) {
|
||||
+ return new CarpetRule(identifier, name, value.name().toLowerCase(Locale.ROOT));
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Contract("_, _, _ -> new")
|
||||
+ public static CarpetRule of(String identifier, String name, boolean value) {
|
||||
+ return new CarpetRule(identifier, name, Boolean.toString(value));
|
||||
+ }
|
||||
+
|
||||
+ public void writeNBT(@NotNull CompoundTag rules) {
|
||||
+ CompoundTag rule = new CompoundTag();
|
||||
+ rule.putString("Value", value);
|
||||
+ rule.putString("Manager", identifier);
|
||||
+ rule.putString("Rule", name);
|
||||
+ rules.put(name, rule);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record CarpetPayload(CompoundTag nbt) implements CustomPacketPayload {
|
||||
+
|
||||
+ public CarpetPayload(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
+ this(buf.readNbt());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(FriendlyByteBuf buf) {
|
||||
+ buf.writeNbt(nbt);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public ResourceLocation id() {
|
||||
+ return HELLO_ID;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 9 Feb 2024 03:32:05 +0000
|
||||
Subject: [PATCH] Threaded region start tick and finished tick event
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
index 865044d40a95d201765435cbc14b0384980eebf6..ab5f832aafc479eca1c5da012e180d6374e32325 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
@@ -389,7 +389,7 @@ public final class TickRegionScheduler {
|
||||
|
||||
final long scheduledStart = this.getScheduledStart();
|
||||
final long scheduledEnd = scheduledStart + TIME_BETWEEN_TICKS;
|
||||
-
|
||||
+ new me.earthme.luminol.api.events.TickRegionStartTickEvent(this.region == null ? -1 : this.region.region.id,System.nanoTime()); //Luminol - Threaded regions API
|
||||
synchronized (this) {
|
||||
this.currentTickData = new TickTime(
|
||||
lastTickStart, scheduledStart, tickStart, cpuStart,
|
||||
@@ -424,6 +424,7 @@ public final class TickRegionScheduler {
|
||||
);
|
||||
|
||||
this.addTickTime(time);
|
||||
+ new me.earthme.luminol.api.events.TickRegionFinishedTickEvent(this.region == null ? -1 : this.region.region.id,System.nanoTime()); //Luminol - Threaded regions API
|
||||
TickRegionScheduler.setTickTask(null);
|
||||
if (this.region != null) {
|
||||
TickRegionScheduler.setTickingRegion(null);
|
||||
1633
patches/server/0061-Leaves-Replay-Mod-API.patch
Normal file
1633
patches/server/0061-Leaves-Replay-Mod-API.patch
Normal file
File diff suppressed because it is too large
Load Diff
55
patches/server/0062-Fix-MC-172047.patch
Normal file
55
patches/server/0062-Fix-MC-172047.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HaHaWTH <fsjk947@gmail.com>
|
||||
Date: Fri, 15 Mar 2024 03:16:22 +0800
|
||||
Subject: [PATCH] Fix-MC-172047
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
index 2d20b2c1f58beb1ad8c9012d8124e476899e6be6..4e06908ed9759abb61a5ef5abf774874d231a83e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -52,6 +52,7 @@ import net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal;
|
||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
||||
import net.minecraft.world.entity.animal.horse.Llama;
|
||||
+import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
import net.minecraft.world.entity.monster.AbstractSkeleton;
|
||||
import net.minecraft.world.entity.monster.Creeper;
|
||||
import net.minecraft.world.entity.monster.Ghast;
|
||||
@@ -529,13 +530,34 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean wantsToAttack(LivingEntity target, LivingEntity owner) {
|
||||
- if (!(target instanceof Creeper) && !(target instanceof Ghast)) {
|
||||
+ if (!(target instanceof Creeper) && !(target instanceof Ghast) && !(target instanceof ArmorStand)) { // Luminol - Fix MC-172047
|
||||
if (target instanceof Wolf) {
|
||||
Wolf entitywolf = (Wolf) target;
|
||||
|
||||
return !entitywolf.isTame() || entitywolf.getOwner() != owner;
|
||||
} else {
|
||||
- return target instanceof Player && owner instanceof Player && !((Player) owner).canHarmPlayer((Player) target) ? false : (target instanceof AbstractHorse && ((AbstractHorse) target).isTamed() ? false : !(target instanceof TamableAnimal) || !((TamableAnimal) target).isTame());
|
||||
+ // Luminol start
|
||||
+ if (target instanceof Player) {
|
||||
+ Player targetPlayer = (Player) target;
|
||||
+ if (owner instanceof Player) {
|
||||
+ Player ownerPlayer = (Player) owner;
|
||||
+ if (!ownerPlayer.canHarmPlayer(targetPlayer)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (target instanceof AbstractHorse) {
|
||||
+ AbstractHorse targetHorse = (AbstractHorse) target;
|
||||
+ if (targetHorse.isTamed()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ if (target instanceof TamableAnimal) {
|
||||
+ TamableAnimal tamableAnimalTarget = (TamableAnimal) target;
|
||||
+ return !tamableAnimalTarget.isTame();
|
||||
+ }
|
||||
+ return true;
|
||||
+ // Luminol end
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
41
patches/server/0063-Fix-MC-2025.patch
Normal file
41
patches/server/0063-Fix-MC-2025.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HaHaWTH <fsjk947@gmail.com>
|
||||
Date: Fri, 15 Mar 2024 03:32:46 +0800
|
||||
Subject: [PATCH] Fix-MC-2025
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d78ad18ac3b69c893a23b6bb9a6837b6a82ebdc2..8f40db062159dea7761a5663edef997a113e828b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2551,6 +2551,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
nbttagcompound.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Luminol start - Fix MC-2025
|
||||
+ AABB boundingBox = getBoundingBox();
|
||||
+ ListTag boundingBoxList = new ListTag();
|
||||
+ for (double coord : new double[]{boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ}) {
|
||||
+ boundingBoxList.add(DoubleTag.valueOf(coord));
|
||||
+ }
|
||||
+ nbttagcompound.put("Luminol.BoundingBox", boundingBoxList);
|
||||
+ // Luminol end
|
||||
+
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2628,6 +2638,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
this.reapplyPosition();
|
||||
}
|
||||
|
||||
+ // Luminol start - Fix MC-2025
|
||||
+ if (nbt.contains("Luminol.BoundingBox", net.minecraft.nbt.Tag.TAG_LIST)) {
|
||||
+ ListTag boundingBoxList = nbt.getList("Luminol.BoundingBox", net.minecraft.nbt.Tag.TAG_DOUBLE);
|
||||
+ setBoundingBox(new AABB(boundingBoxList.getDouble(0), boundingBoxList.getDouble(1), boundingBoxList.getDouble(2), boundingBoxList.getDouble(3), boundingBoxList.getDouble(4), boundingBoxList.getDouble(5)));
|
||||
+ }
|
||||
+ // Luminol end
|
||||
+
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid rotation");
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 12 Apr 2024 13:48:09 +0000
|
||||
Subject: [PATCH] Rewrite linear region flush task dispatching
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||
index e40989889f3821bb7484fc0bae5d94b033013904..dc5a5f42c9ca7a50295c18424722568a3ad33fa5 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||
@@ -126,7 +126,7 @@ public class LinearRegionFile implements AbstractRegionFile, AutoCloseable {
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
- if (isMarkedToSave()) flushWrapper(); // sync
|
||||
+ if (getAndResetSaveMarker()) flushWrapper(); // sync
|
||||
}
|
||||
|
||||
private void markToSave() {
|
||||
@@ -134,10 +134,18 @@ public class LinearRegionFile implements AbstractRegionFile, AutoCloseable {
|
||||
markedToSave.set(true);
|
||||
}
|
||||
|
||||
- public boolean isMarkedToSave() {
|
||||
+ public boolean getAndResetSaveMarker() {
|
||||
return markedToSave.getAndSet(false);
|
||||
}
|
||||
|
||||
+ public boolean isMarkedToSave(){
|
||||
+ return this.markedToSave.get();
|
||||
+ }
|
||||
+
|
||||
+ public void resetSaveMarker(){
|
||||
+ this.markedToSave.set(false);
|
||||
+ }
|
||||
+
|
||||
public void flushWrapper() {
|
||||
try {
|
||||
save();
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
|
||||
index f06d7767c79e465f999b2032086cc224de95152a..65435eb666b2e1cabffc145e016faa5e3b373464 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
|
||||
@@ -1,17 +1,14 @@
|
||||
package dev.kaiijumc.kaiiju.region;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
-import java.util.Queue;
|
||||
+
|
||||
+import java.util.Set;
|
||||
import java.util.concurrent.*;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class LinearRegionFileFlusher {
|
||||
- private final Queue<LinearRegionFile> savingQueue = new LinkedBlockingQueue<>();
|
||||
- private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(
|
||||
- new ThreadFactoryBuilder()
|
||||
- .setNameFormat("linear-flush-scheduler")
|
||||
- .build()
|
||||
- );
|
||||
+ private final Set<LinearRegionFile> pendingSaving = ConcurrentHashMap.newKeySet();
|
||||
+
|
||||
private final ExecutorService executor = Executors.newFixedThreadPool(
|
||||
me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushThreads,
|
||||
new ThreadFactoryBuilder()
|
||||
@@ -19,26 +16,42 @@ public class LinearRegionFileFlusher {
|
||||
.build()
|
||||
);
|
||||
|
||||
+ private final Executor delayedFlusher = CompletableFuture.delayedExecutor(
|
||||
+ me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushFrequency,
|
||||
+ TimeUnit.SECONDS,
|
||||
+ executor
|
||||
+ );
|
||||
+
|
||||
public LinearRegionFileFlusher() {
|
||||
Bukkit.getLogger().info("Using " + me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushThreads + " threads for linear region flushing.");
|
||||
- scheduler.scheduleAtFixedRate(this::pollAndFlush, 0L, me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushFrequency, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void scheduleSave(LinearRegionFile regionFile) {
|
||||
- if (savingQueue.contains(regionFile)) return;
|
||||
- savingQueue.add(regionFile);
|
||||
- }
|
||||
-
|
||||
- private void pollAndFlush() {
|
||||
- while (!savingQueue.isEmpty()) {
|
||||
- LinearRegionFile regionFile = savingQueue.poll();
|
||||
- if (!regionFile.closed && regionFile.isMarkedToSave())
|
||||
- executor.execute(regionFile::flushWrapper);
|
||||
+ if (this.pendingSaving.contains(regionFile) || !regionFile.isMarkedToSave()){
|
||||
+ return;
|
||||
}
|
||||
+
|
||||
+ this.pendingSaving.add(regionFile);
|
||||
+ this.delayedFlusher.execute(()->{
|
||||
+ try {
|
||||
+ if (!regionFile.closed && regionFile.isMarkedToSave()){
|
||||
+ regionFile.flushWrapper();
|
||||
+ }
|
||||
+ }finally {
|
||||
+ regionFile.resetSaveMarker();
|
||||
+ this.pendingSaving.remove(regionFile);
|
||||
+ }
|
||||
+ });
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
- executor.shutdown();
|
||||
- scheduler.shutdown();
|
||||
+ this.executor.shutdown();
|
||||
+ for (;;) {
|
||||
+ try {
|
||||
+ if (this.executor.awaitTermination(5_00,TimeUnit.MILLISECONDS)) break;
|
||||
+ } catch (InterruptedException e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 9 Feb 2024 03:28:48 +0000
|
||||
Subject: [PATCH] Threaded region remove and create event
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/api/events/TickRegionCreateEvent.java b/src/main/java/me/earthme/luminol/api/events/TickRegionCreateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9f842aeb33e658f3db540b6195f848d2a56ce14f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/api/events/TickRegionCreateEvent.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package me.earthme.luminol.api.events;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * This event was called when a new threaded region was created.When the event called,it means this region was already added to the region list
|
||||
+ * Notice: It may be called when splitting or merging regions
|
||||
+ */
|
||||
+public class TickRegionCreateEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final long id;
|
||||
+
|
||||
+ public TickRegionCreateEvent(long id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the id of the threaded region which was created
|
||||
+ * @return The id of the threaded region
|
||||
+ */
|
||||
+ public long getId() {
|
||||
+ return this.id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/api/events/TickRegionRemoveEvent.java b/src/main/java/me/earthme/luminol/api/events/TickRegionRemoveEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aa3d3868f9d0c3353380960db36ee60a6b4aeb03
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/api/events/TickRegionRemoveEvent.java
|
||||
@@ -0,0 +1,28 @@
|
||||
+package me.earthme.luminol.api.events;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * This event was called when a new threaded region was removed.When the event called,it means this region was already removed from the region list
|
||||
+ * Notice: It may be called when splitting or merging regions
|
||||
+ */
|
||||
+public class TickRegionRemoveEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final long id;
|
||||
+
|
||||
+ public TickRegionRemoveEvent(long id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+
|
||||
+ public long getId() {
|
||||
+ return this.id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Fri, 9 Feb 2024 03:28:48 +0000
|
||||
Subject: [PATCH] Threaded region remove and create event
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
index 531aa50f2c84e13358e8918bb0c15ea3cd036cb5..26183f979e24de369fd8f5e72a26a6a9ba44f601 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
@@ -805,6 +805,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
|
||||
private void onCreate() {
|
||||
this.regioniser.onRegionCreate(this);
|
||||
this.regioniser.callbacks.onRegionCreate(this);
|
||||
+ new me.earthme.luminol.api.events.TickRegionCreateEvent(this.id).callEvent(); //Luminol - Threaded regions API
|
||||
}
|
||||
|
||||
private void onRemove(final boolean wasActive) {
|
||||
@@ -813,6 +814,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
|
||||
}
|
||||
this.regioniser.callbacks.onRegionDestroy(this);
|
||||
this.regioniser.onRegionDestroy(this);
|
||||
+ new me.earthme.luminol.api.events.TickRegionRemoveEvent(this.id).callEvent(); //Luminol - Threaded regions API
|
||||
}
|
||||
|
||||
private final boolean hasNoAliveSections() {
|
||||
47
scripts/PushToAPI.sh
Normal file
47
scripts/PushToAPI.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
sha256() {
|
||||
sha256sum $1 | awk '{print $1}'
|
||||
}
|
||||
|
||||
prop() {
|
||||
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
|
||||
}
|
||||
|
||||
project_id="luminol"
|
||||
mcversion_group=$(prop GroupMCV)
|
||||
mcversion=$(prop mcVersion)
|
||||
pre=$(prop preVersion)
|
||||
|
||||
if [ $pre = "true" ]; then
|
||||
channel="experimental"
|
||||
else
|
||||
channel="default"
|
||||
fi
|
||||
changes=$(git log -1 --pretty="[{\\\"commit\\\": \\\"%H\\\", \\\"message\\\": \\\"%s\\\", \\\"summary\\\": \\\"%s\\\"}]")
|
||||
jar_sha256=`sha256 build/libs/luminol-1.20.4-paperclip.jar`
|
||||
jar_name="luminol-1.20.4-paperclip.jar"
|
||||
ctime=$(date -u +"%s")"000"
|
||||
|
||||
# v2
|
||||
echo "Authentication: $secret_v2"
|
||||
#echo "{\"version_group\":\"$mcversion_group\",\"channel\":\"$channel\",\"changes\":\"$changes\",\"jar_name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"release_tag\":\"$tag\",\"time\":\"$ctime\"}" > data.json
|
||||
json=$(printf "{\\\"channel\\\":\\\"%s\\\", \\\"jar_name\\\":\\\"%s\\\", \\\"sha256\\\":\\\"%s\\\", \\\"tag\\\":\\\"%s\\\", \\\"time\\\":\\\"%s\\\", \\\"changes\\\":\\\"%s\\\"}" \
|
||||
"$channel" "$jar_name" "$jar_sha256" "$tag" "$ctime" "$changes")
|
||||
echo "[DEBUG] $json"
|
||||
echo "[DEBUG] curl --location --request POST \"https://api.luminolmc.com/v2/projects/$project_id/$mcversion/build/commit\" \
|
||||
-H \"Content-Type: application/x-www-form-urlencoded\" \
|
||||
-H \"Authorization: $secret_v2\" \
|
||||
--data-urlencode \"channel=$channel\" \
|
||||
--data-urlencode \"jar_name=$jar_name\" \
|
||||
--data-urlencode \"sha256=$jar_sha256\" \
|
||||
--data-urlencode \"release_tag=$tag\" \
|
||||
--data-urlencode \"time=$ctime\" \
|
||||
--data-urlencode \"changes=$changes\""
|
||||
curl -L --request POST "https://api.luminolmc.com/v2/projects/$project_id/$mcversion/build/commit" \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-H "Authorization: $secret_v2" \
|
||||
--data-urlencode "channel=$channel" \
|
||||
--data-urlencode "jar_name=$jar_name" \
|
||||
--data-urlencode "sha256=$jar_sha256" \
|
||||
--data-urlencode "release_tag=$tag" \
|
||||
--data-urlencode "time=$ctime" \
|
||||
--data-urlencode "changes=$changes"
|
||||
18
scripts/SetENV.sh
Normal file
18
scripts/SetENV.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
prop() {
|
||||
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
|
||||
}
|
||||
|
||||
commitid=$(git log --pretty='%h' -1)
|
||||
mcversion=$(prop mcVersion)
|
||||
preVersion=$(prop preVersion)
|
||||
release_tag="$mcversion-$commitid"
|
||||
jarName="build/libs/luminol-1.20.4-paperclip.jar"
|
||||
make_latest=$([ $preVersion = "true" ] && echo "false" || echo "true")
|
||||
|
||||
echo "commitid=$commitid" >> $GITHUB_ENV
|
||||
echo "mcversion=$mcversion" >> $GITHUB_ENV
|
||||
echo "$mcversion"
|
||||
echo "tag=$release_tag" >> $GITHUB_ENV
|
||||
echo "jar=$jarName" >> $GITHUB_ENV
|
||||
echo "pre=$preVersion" >> $GITHUB_ENV
|
||||
echo "make_latest=$make_latest" >> $GITHUB_ENV
|
||||
@@ -7,7 +7,7 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Luminol"
|
||||
rootProject.name = "luminol"
|
||||
for (name in listOf("Luminol-API", "Luminol-Server")) {
|
||||
val projName = name.toLowerCase(Locale.ENGLISH)
|
||||
include(projName)
|
||||
|
||||
Reference in New Issue
Block a user