Compare commits

..

18 Commits

Author SHA1 Message Date
ShintoKosei
49be774d83 rebase 2024-04-13 19:03:09 +08:00
ShintoKosei
06dcc037df Update CI 2024-04-06 15:17:19 +08:00
MrHua269
9247a01058 Added some optimizations from Gale 2024-04-06 05:19:02 +00:00
MrHua269
856ddfe7cc Merge remote-tracking branch 'origin/ver/1.20.4' into ver/1.20.4 2024-04-06 02:38:37 +00:00
MrHua269
4013d9dc3b Add warn to region format config 2024-04-06 02:38:27 +00:00
ShintoKosei
ce8a2afb0f Create FUNDING.yml 2024-04-05 23:03:10 +08:00
ShintoKosei
ea3efdb597 [ci skip]Update README.md 2024-04-05 19:59:05 +08:00
ShintoKosei
678c3faeea [ci skpi]Update README.md 2024-04-05 19:47:26 +08:00
ShintoKosei
815adcc00e [ci skip]Update README 2024-04-05 16:48:49 +08:00
MrHua269
c0d766fd07 Fix my stupid rebrand 2024-04-05 04:33:53 +00:00
MrHua269
a9cd09f900 Merge remote-tracking branch 'origin/ver/1.20.4' into ver/1.20.4 2024-04-05 01:19:11 +00:00
MrHua269
1452008bbe Fix non-working tripwire incorrect updating fix 2024-04-05 01:19:00 +00:00
Klop233
e71abbd761 fix CI 2024-04-04 19:37:52 +08:00
Klop233
6db86f10e7 Revert "update CI"
This reverts commit e1afa32f90.
2024-04-04 11:29:15 +08:00
Klop233
f134186657 Revert "Update build_1_20_4.yml"
This reverts commit 9551755b0d.
2024-04-04 11:29:13 +08:00
Klop233
ef1b7ce6f7 Revert "update CI"
This reverts commit 3c1be89214.
2024-04-04 11:29:11 +08:00
Klop233
f16e5c1064 Revert "update CI"
This reverts commit 6317a5399b.
2024-04-04 11:29:08 +08:00
Klop233
0b9a436044 Revert incorrect CI changes
This reverts commit 76f2aa58e1.
2024-04-04 11:28:58 +08:00
31 changed files with 593 additions and 193 deletions

14
.github/FUNDING.yml vendored Normal file
View 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
View 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.

View 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.

View File

@@ -1,104 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: LuminolCI - Ver/1.20.4
on:
push:
branches: [ "ver/1.20.4" ]
pull_request:
branches: [ "ver/1.20.4" ]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Get repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- name: Setup Git Config
run: |
git config --global user.email "ci@leavesmc.top"
git config --global user.name "Leaves CI"
- name: Apply Patches
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: applyPatches
- name: Create Paperclip Jar
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: createReobfPaperclipJar
- name: Publish API
continue-on-error: true
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: publish -PleavesUsername=${{ secrets.REPO_USERNAME }} -PleavesPassword=${{ secrets.REPO_PASSWORD }}
- name: Create Configuration
continue-on-error: true
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: createLeavesConfig
- name: Push Configuration
continue-on-error: true
run: |
mkdir --parents "$HOME/.ssh"
ssh-keyscan -H "github.com" > "$HOME/.ssh/known_hosts"
echo "${{ secrets.CONFIG_DEPLOY_KEY }}" > "$HOME/.ssh/deploy.key"
chmod 400 "$HOME/.ssh/deploy.key"
export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/deploy.key"
git clone git@github.com:LeavesMC/Configuration.git configuration -b Leaves
cp run/leaves.yml configuration/leaves.yml -f
cd configuration
git add leaves.yml
git commit leaves.yml -m "$(date -u +"%Y-%m-%dT%H:%M:%SZ")
https://github.com/LeavesMC/Leaves/commit/$(cd .. && git rev-parse HEAD)"
git push origin HEAD:Leaves
- name: Get Release Info
run: sh scripts/GetReleaseInfo.sh
- name: Create Release
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
uses: ncipollo/release-action@v1.12.0
with:
artifacts: ${{ env.jar }}
bodyFile: ${{ env.info }}
tag: ${{ env.tag }}
name: ${{ env.name }}
prerelease: ${{ env.pre }}
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: ${{ env.make_latest }}
- name: Delete Draft Releases
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Github Releases To Discord
# continue-on-error: true
# uses: tsickert/discord-webhook@v5.3.0
# with:
# webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
# raw-data: ${{ env.discordmes }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.jar }}
path: ${{ env.jar }}
- name: Push to Api
continue-on-error: true
if: "!contains(github.event.commits[0].message, '[release-skip]')"
env:
secret: ${{ secrets.API_PUSH_TOKEN }}
secret_v2: ${{ secrets.API_V2_PUSH_TOKEN }}
tag: ${{ env.tag }}
run: sh scripts/PushToAPI.sh

63
.github/workflows/build_1_20_4.yml_dis vendored Normal file
View File

@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: LuminolCI - Ver/1.20.4
on:
push:
branches: [ "ver/1.20.4" ]
pull_request:
branches: [ "ver/1.20.4" ]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up git
run: git config --global user.email "noreply@github.com" && git config --global user.name "ci"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod 777 ./gradlew
- name: Setup project
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: applyPatches
- name: Build project to paperclip jar
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: createReobfBundlerJar createReobfPaperclipJar
- name: Capture build artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
- 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 -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
- name: Release Artifacts
uses: svenstaro/upload-release-action@v2
with:
release_name: "Luminol MC1.20.4 - ${{ github.event.repository.updated_at}}"
tag: "1.20.4-${{ github.run_id }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
file: "build/libs/luminol-1.20.4-paperclip.jar"
file_glob: true
prerelease: true

64
.github/workflows/build_1_20_4_v2.yml vendored Normal file
View 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 }} [![download](https://img.shields.io/github/downloads/LuminolMC/Luminol/${{ env.tag }}/total?color=0)](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

View File

@@ -50,8 +50,13 @@ dependencies {
## 联系方式
> 如果您对这个项目感兴趣或有任何问题,请随时向我们提问。
QQ群`368632360` | QQ频道[点击加入](https://pd.qq.com/s/eq9krf9j) | Telegram[点击加入](https://t.me/LuminolMC)
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)
> [!WARNING]
> **此项目与Leaves无关。不要向Leaves报告任何有关协议支持的错误因为协议支持已经重构**
## 关于 Issue
当您遇到任何问题时,请向我们提问,我们将尽力解决,但请记得清楚地描述您的问题并提供足够的日志等信息。
## 贡献代码
可[查看 Contributing](./docs/CONTRIBUTING.md)
@@ -70,6 +75,3 @@ QQ群`368632360` | QQ频道[点击加入](https://pd.qq.com/s/eq9krf9j)
</picture>
</a>
> [!WARNING]
> **此项目与Leaves无关。不要向Leaves报告任何有关协议支持的错误因为协议支持已经重构**
>

View File

@@ -50,7 +50,7 @@ For maven
## Contact
> If you are interested in this project or have any issue, feel free to ask us.
QQ Group: `368632360` | QQ Channel: [Click To Join](https://pd.qq.com/s/eq9krf9j) | Telegram: [Click To Join](https://t.me/LuminolMC)
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.**

View File

@@ -8,8 +8,6 @@ org.gradle.parallel = true
org.gradle.vfs.watch = false
org.gradle.jvmargs = -Xmx3G
# adapt Leaves API Push
mcVersion=1.20.4
packageVersion=1_20_R3
preVersion=false
updatingMinecraft=false
GroupMCV=1.20
preVersion=false

View File

@@ -35,7 +35,7 @@ index e2f704c115fd6e00960bb56bb0779f1100c89c17..72b9343979de5aa8bb399cbe7cb8a795
private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
private static final String GITHUB_BRANCH_NAME = "master";
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
+ private static final String DOWNLOAD_PAGE = "https://github.com/Era4FunMC/Luminol"; //Luminol
+ private static final String DOWNLOAD_PAGE = "https://github.com/LuminolMC/Luminol"; //Luminol
private static @Nullable String mcVer;
@Override
@@ -46,7 +46,7 @@ index e2f704c115fd6e00960bb56bb0779f1100c89c17..72b9343979de5aa8bb399cbe7cb8a795
- String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
+ String[] parts = serverVersion.substring("git-Luminol-".length()).split("[-\\s]"); // Folia //Luminol
+ final Component updateMessage = getUpdateStatusMessage("Era4FunMC/Luminol", GITHUB_BRANCH_NAME, parts[0]); // Folia //Luminol
+ final Component updateMessage = getUpdateStatusMessage("LuminolMC/Luminol", GITHUB_BRANCH_NAME, parts[0]); // Folia //Luminol
final Component history = getHistory();
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;

View File

@@ -31,15 +31,21 @@ index 0000000000000000000000000000000000000000..79ce93a1e97f176c7b0e5b00d7f0880f
+ }
+}
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..a286d6cd2c371c135cb708f2bee9c5afa7532a92 100644
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,7 +201,7 @@ public class TripWireHookBlock extends Block {
@@ -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 (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE) || me.earthme.luminol.config.modules.fixes.IncorrectTripwireFixConfig.enabled) { // Paper - Fix tripwire disarming not working as intended //Luminol - Add config for this
+ 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
}
}
}

View File

@@ -573,7 +573,7 @@ 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..7c034f65bac5aab4c46a8506efa5befe7891bc99
index 0000000000000000000000000000000000000000..5d594b606178bd26180caad49de17c0e67e89747
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RegionFormatConfig.java
@@ -0,0 +1,58 @@
@@ -591,7 +591,7 @@ index 0000000000000000000000000000000000000000..7c034f65bac5aab4c46a8506efa5befe
+ @ConfigInfo(baseName = "formatName")
+ private static String formatName = "ANVIL";
+ @HotReloadUnsupported
+ @ConfigInfo(baseName = "linear_compression_level")
+ @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")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,58 +0,0 @@
sha1() {
sha1sum $1 | awk '{print $1}'
}
md5() {
md5sum $1 | awk '{print $1}'
}
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
commitid=$(git log --pretty='%h' -1)
mcversion=$(prop mcVersion)
gradleVersion=$(prop version)
preVersion=$(prop preVersion)
tagid="$mcversion-$commitid"
jarName="luminol-$mcversion.jar"
luminolid="Luminol-$commitid"
releaseinfo="releaseinfo.md"
#discordmes="discordmes.json"
make_latest=$([ $preVersion = "true" ] && echo "false" || echo "true")
rm -f $discordmes
rm -f $releaseinfo
mv build/libs/Luminol-paperclip-$gradleVersion-reobf.jar $jarName
echo "name=$luminolid" >> $GITHUB_ENV
echo "tag=$tagid" >> $GITHUB_ENV
echo "jar=$jarName" >> $GITHUB_ENV
echo "info=$releaseinfo" >> $GITHUB_ENV
#echo "discordmes=$discordmes" >> $GITHUB_ENV
echo "pre=$preVersion" >> $GITHUB_ENV
echo "make_latest=$make_latest" >> $GITHUB_ENV
echo "$luminolid [![download](https://img.shields.io/github/downloads/LuminolMC/Luminol/$tagid/total?color=0)](https://github.com/LuminolMC/Luminol/releases/download/$tagid/$jarName)" >> $releaseinfo
echo "=====" >> $releaseinfo
echo "" >> $releaseinfo
if [ $preVersion = "true" ]; then
echo "> This is an early, experimental build. It is only recommended for usage on test servers and should be used with caution." >> $releaseinfo
echo "> **Backups are mandatory!**" >> $releaseinfo
echo "" >> $releaseinfo
fi
echo "### Commit Message" >> $releaseinfo
number=$(git log --oneline master ^`git describe --tags --abbrev=0` | wc -l)
echo "$(git log --pretty='> [%h] %s' -$number)" >> $releaseinfo
echo "" >> $releaseinfo
echo "### Checksum" >> $releaseinfo
echo "| File | $jarName |" >> $releaseinfo
echo "| ---- | ---- |" >> $releaseinfo
echo "| MD5 | `md5 $jarName` |" >> $releaseinfo
echo "| SHA1 | `sha1 $jarName` |" >> $releaseinfo
#echo -n "{\"content\":\"Leaves New Release\",\"embeds\":[{\"title\":\"$leavesid\",\"url\":\"https://github.com/LeavesMC/Leaves/releases/tag/$tagid\",\"fields\":[{\"name\":\"Changelog\",\"value\":\"" >> $discordmes
#echo -n $(git log --oneline --pretty='> [%h] %s\\n' -$number) >> $discordmes
#echo "\",\"inline\":true}]}]}" >> $discordmes

View File

@@ -5,28 +5,44 @@ sha256() {
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
echo "$tag"
project_id="luminol"
project_name="luminol"
mcversion_group=$(prop GroupMCV)
mcversion=$(prop mcVersion)
ctime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
pre=$(prop preVersion)
if [ $pre = "true" ]; then
channel="experimental"
else
channel="default"
fi
promoted=false
# shellcheck disable=SC2046
number=$(git log --oneline master ^`git describe --tags --abbrev=0` | wc -l)
changes=$(git log --pretty='%H<<<%s>>>' -"$number" | sed ':a;N;$!ba;s/\n//g')
jar_name="leaves-$mcversion.jar"
jar_sha256=`sha256 $jar_name`
# v1
#curl --location --request POST "https://api.leavesmc.org/new_release" --header "Content-Type: application/json" --data-raw "{\"project_id\":\"$project_id\",\"project_name\":\"$project_name\",\"version\":\"$mcversion\",\"time\":\"$ctime\",\"channel\":\"$channel\",\"promoted\":$promoted,\"changes\":\"$changes\",\"downloads\":{\"application\":{\"name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"url\":\"https://github.com/LeavesMC/Leaves/releases/download/$tag/$jar_name\"}},\"secret\":\"$secret\"}"
#curl --location --request POST "https://api.leavesmc.org/upload_file" -F "file=@$jar_name" -F "filename=$jar_name" -F "filehash=$jar_sha256" -F "secret=$secret"
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
curl --location --request POST "https://api.luminolmc.com/v2/commit/build" --header "Content-Type: application/json" --header "Authentication: Bearer $secret_v2" --data-raw "{\"project_id\":\"$project_id\",\"version\":\"$mcversion\",\"channel\":\"$channel\",\"changes\":\"$changes\",\"jar_name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"tag\":\"$tag\"}"
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] $changes"
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
View 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