From 5a5d7b0bc2c35a88241f088193a33c3b25def1ea Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Wed, 1 May 2024 11:51:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8A=E6=B8=B8paper?= =?UTF-8?q?=E5=88=86=E6=94=AF=20=E5=AE=8C=E5=96=84readme=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yml | 10 ++-- README.md | 27 ++++++----- build.gradle.kts | 2 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- patches/server/0001-Rebranding.patch | 12 ++--- patches/server/0002-Allow-void-trading.patch | 4 +- patches/server/0003-Sand-duplication.patch | 51 +++----------------- settings.gradle.kts | 2 +- 9 files changed, 36 insertions(+), 76 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index ee0ef9d..4668998 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -2,13 +2,8 @@ name: Java CI-CD with Gradle on: push: - paths: - - 'patches/**' - - 'gradle.properties' - - 'gradle/wrapper/gradle-wrapper.properties' - - 'build.gradle.kts' - - 'settings.gradle.kts' - - '.gitea/**' + tags: + - '*' jobs: build: @@ -43,6 +38,7 @@ jobs: - name: "Release" uses: https://ssl.lunadeer.cn:14446/zhangyuheng/release-action@main with: + note: "请下载 `DeerFolia-paperclip-xxx.jar` 前缀的版本。" files: |- staging/*.jar api_key: '${{secrets.RELEASE_TOKEN}}' \ No newline at end of file diff --git a/README.md b/README.md index b63dc51..4ef5b5a 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,6 @@ DeerFolia 是一个基于 [Folia](https://papermc.io/software/folia) 的 Minecra - 还原了 [虚空交易](patches/server/0002-Allow-void-trading.patch); - 还原了 [刷沙机制](patches/server/0003-Sand-duplication.patch); -## 更新上游 Folia 修改 - -1. 在终端执行 `./gradlew updateFoliaRef` 更新上游 Folia 修改; - ## 将补丁应用到 Folia 源码 1. 在终端执行 `./gradlew applyPatches` 应用补丁; @@ -49,11 +45,11 @@ DeerFolia 是一个基于 [Folia](https://papermc.io/software/folia) 的 Minecra 1. 在 `deer-folia-server` 或 `deer-folia-api` 目录中执行 `git rebase -i base` ,应该会输出 [这样的](https://gist.github.com/zachbr/21e92993cb99f62ffd7905d7b02f3159) 内容。 2. 将你需要修改的补丁由 `pick` 替换为 `edit` 然后保存退出; - - 一次只能修改 **一个** 文件! + - 一次只能修改 **一个** 文件! 3. 对你需要修改的补丁作出新的修改; 4. 使用 `git add .` 添加补丁,再使用 `git commit --amend` 提交; - - **确保添加了 `--amend` 选项** 否则将会创建一个新补丁而不是修改原补丁。 - - 此处提交时也可以修改补丁信息。 + - **确保添加了 `--amend` 选项** 否则将会创建一个新补丁而不是修改原补丁。 + - 此处提交时也可以修改补丁信息。 5. 终端执行 `git rebase --continue` 应用更新; 6. 再在跟项目目录执行 `./gradlew rebuildPatches` 生成新的补丁; @@ -69,16 +65,23 @@ DeerFolia 是一个基于 [Folia](https://papermc.io/software/folia) 的 Minecra 2. 提交修改(可以不写提交内容); 3. 在 `deer-folia-server` 或 `deer-folia-api` 目录中执行 `git rebase -i base` ,将刚才的提交移动到你想要修改的补丁提交下方; 4. 将新提交的 `pick` 修改为如下内容: - - `f`/`fixup`:将你的新修改合并到补丁内,但不改变补丁信息; - - `s`/`squash`:将你的新修改合并到补丁内,并用新的补丁信息替换原补丁信息; + - `f`/`fixup`:将你的新修改合并到补丁内,但不改变补丁信息; + - `s`/`squash`:将你的新修改合并到补丁内,并用新的补丁信息替换原补丁信息; 5. 在跟项目目录执行 `./gradlew rebuildPatches` 应用补丁更新; #### 自动 1. 修改相应位置源码; 2. 提交修改内容 `git commit -a --fixup <要修改的补丁 hash 值>`; - - 如果希望更新补丁信息,你可以使用 `--squash` 替换 `--fixup`; - - 如果你不知道要修改的补丁 hash 值,你可以使用 `git log` 查看; - - 如果你只知道补丁的名称,你可以使用 `git log --grep=<补丁名称>` 查看; + - 如果希望更新补丁信息,你可以使用 `--squash` 替换 `--fixup`; + - 如果你不知道要修改的补丁 hash 值,你可以使用 `git log` 查看; + - 如果你只知道补丁的名称,你可以使用 `git log --grep=<补丁名称>` 查看; 3. 执行 `git rebase -i --autosquash base` ,这将会自动将你的修改移动到对应的补丁下方; 4. 在跟项目目录执行 `./gradlew rebuildPatches` 应用补丁更新; + +## 更新上游 Folia 修改 + +1. 在终端执行 `./gradlew updateFoliaRef` 更新上游 Folia 修改; +2. 应用更新的补丁:`./gradlew applyPatches`。 +3. 如果存在冲突,解决冲突,然后运行 `git am --continue` 继续应用补丁; +4. 全部补丁应用完成后,更新补丁:`./gradlew rebuildPatches`。 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d0c5ed8..979cc97 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.util.* plugins { java id("com.github.johnrengelman.shadow") version "8.1.1" apply false - id("io.papermc.paperweight.patcher") version "1.5.11" + id("io.papermc.paperweight.patcher") version "1.5.12" } allprojects { diff --git a/gradle.properties b/gradle.properties index 9ead663..460e86c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group = cn.lunadeer version = 1.20.4-R0.1-SNAPSHOT mcVersion = 1.20.4 -foliaRef = e97b1eee63b802568447d344bac5a66bf90c6c71 +foliaRef = 25ee657a8290530812f5f93f62d48df541a02ccf org.gradle.caching=true org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 55e7a81..5abfb99 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Feb 26 15:32:38 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.5-bin.zip +distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/patches/server/0001-Rebranding.patch b/patches/server/0001-Rebranding.patch index f089d08..e7fdb5d 100644 --- a/patches/server/0001-Rebranding.patch +++ b/patches/server/0001-Rebranding.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Rebranding diff --git a/build.gradle.kts b/build.gradle.kts -index 08d434023226af0d2c469055a3b2188fe8a4ed38..0e9e28445f0673f39120e50fd9c80ad0d75f4eac 100644 +index 12f9f9d46c098c5c88058cb1f73ae39a7d1debd5..caf0bb80ab3b694d9a80a6044d2c43c4245a574a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating @@ -17,7 +17,7 @@ index 08d434023226af0d2c469055a3b2188fe8a4ed38..0e9e28445f0673f39120e50fd9c80ad0 implementation("io.papermc.paper:paper-mojangapi:${project.version}") { exclude("io.papermc.paper", "paper-api") } -@@ -74,7 +74,7 @@ tasks.jar { +@@ -75,7 +75,7 @@ tasks.jar { attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", @@ -117,7 +117,7 @@ index 99c5038672b09d0874125e3df280174c1e8151e6..f44fbef4372b3c6ba3e1e6f81de469b2 stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now())); stringbuilder.append("\n"); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3ec07e77748ee9bb21f9d09230f935bca2217e4d..ef7f77b4643a83ae241f8bb91e2b41bbd4fa6470 100644 +index 453bb595d31c6dea1cfb135f43ffe71e4ae44112..d7340fe97da3e0b0f1b8e83ba102047497d6676b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1025,7 +1025,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { @@ -36,7 +36,7 @@ index 0725386d7ef47171012671725ceddfe92b43b203..2ac4b3e55be9aa6d6a6e717d887bcb06 ); } ); -@@ -4324,6 +4330,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4343,6 +4349,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return false; } @@ -49,7 +49,7 @@ index 0725386d7ef47171012671725ceddfe92b43b203..2ac4b3e55be9aa6d6a6e717d887bcb06 Vec3 initialPosition = this.position(); ChunkPos initialPositionChunk = new ChunkPos( io.papermc.paper.util.CoordinateUtils.getChunkX(initialPosition), -@@ -4381,7 +4393,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4400,7 +4412,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), @@ -58,47 +58,8 @@ index 0725386d7ef47171012671725ceddfe92b43b203..2ac4b3e55be9aa6d6a6e717d887bcb06 ); }); -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 05b77bf1af82397c542fde19b54ee545448ce12e..86ebd1de78ffe31959035beadb41c802abd94107 100644 ---- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -132,11 +132,13 @@ public class FallingBlockEntity extends Entity { - - @Override - public void tick() { -+ // DeerFolia start - Sand duplication - // Paper start - fix sand duping -- if (this.isRemoved()) { -- return; -- } -+ // if (this.isRemoved()) { -+ // return; -+ // } - // Paper end - fix sand duping -+ // DeerFolia end - Sand duplication - if (this.blockState.isAir()) { - this.discard(); - } else { -@@ -148,12 +150,14 @@ public class FallingBlockEntity extends Entity { - } - - this.move(MoverType.SELF, this.getDeltaMovement()); -+ // DeerFolia Sand duplication - // Paper start - fix sand duping -- if (this.isRemoved()) { -- return; -- } -+ // if (this.isRemoved()) { -+ // return; -+ // } - // Paper end - fix sand duping - // Paper start - Configurable falling blocks height nerf -+ // DeerFolia end - Sand duplication - if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) { - if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { - this.spawnAtLocation(block); 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..fc9abf46b9da83255c6a30fc4e38cf09e297ee2f 100644 +index afc9445941b984cc1122839e4a8a17cf27aa966e..d81fbb3a7911b06d8726c7aa2ddbb276fe541023 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 { diff --git a/settings.gradle.kts b/settings.gradle.kts index 452814d..35f3f80 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } rootProject.name = "DeerFolia"