From 14ee4f7e9aefaec86d2189fc1c5367b830256f67 Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:44:49 +0100 Subject: [PATCH 01/14] Add changelog publication (#204) --- build.gradle | 1 + projects/neoforge/build.gradle | 1 + 2 files changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 75db125891..1dd15e3420 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ gradleutils.version { changelog { from "20.2" + disableAutomaticPublicationRegistration() } allprojects { diff --git a/projects/neoforge/build.gradle b/projects/neoforge/build.gradle index ad29de91df..5688d82f1f 100644 --- a/projects/neoforge/build.gradle +++ b/projects/neoforge/build.gradle @@ -246,6 +246,7 @@ publishing { } } + changelog.publish(it) versionMapping { usage('java-api') { From aa9acad13051141747071fad7a0cd0f87f3b6b01 Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Tue, 31 Oct 2023 16:45:37 +0800 Subject: [PATCH 02/14] Suffix branch in version (#212) This makes installer and other artifacts from non-main branches distinguishable from artifacts of the main branches (e.g., 1.20.x). --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 1dd15e3420..18f8b37e9f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,10 +7,15 @@ plugins { apply plugin: 'net.neoforged.gradleutils' gradleutils.version { + minecraftVersion project.minecraft_version + versionPrefix = null // Reset version prefix, which is set by prev. line tags { label = "beta" cleanMarkerLabel = "stable" } + branches { + suffixBranch = true + } } changelog { From 222186209fb2ab39ade632d4e79c224b078ac0cc Mon Sep 17 00:00:00 2001 From: Dennis C Date: Tue, 31 Oct 2023 09:49:09 +0100 Subject: [PATCH 03/14] Fix duplicate sprite expansion in FaceBakery (#207) --- .../client/renderer/block/model/FaceBakery.java.patch | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/patches/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index fccfa3a7b8..6664160ba0 100644 --- a/patches/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -16,14 +16,3 @@ } public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_, ResourceLocation p_111585_) { -@@ -154,8 +161,8 @@ - p_111615_[i + 1] = Float.floatToRawIntBits(p_254291_.y()); - p_111615_[i + 2] = Float.floatToRawIntBits(p_254291_.z()); - p_111615_[i + 3] = -1; -- p_111615_[i + 4] = Float.floatToRawIntBits(p_111618_.getU(p_111619_.getU(p_111616_) / 16.0F)); -- p_111615_[i + 4 + 1] = Float.floatToRawIntBits(p_111618_.getV(p_111619_.getV(p_111616_) / 16.0F)); -+ p_111615_[i + 4] = Float.floatToRawIntBits(p_111618_.getU(p_111619_.getU(p_111616_) / 16.0F * .999F + p_111619_.getU((p_111616_ + 2) % 4) / 16.0F * .001F)); -+ p_111615_[i + 4 + 1] = Float.floatToRawIntBits(p_111618_.getV(p_111619_.getV(p_111616_) / 16.0F * .999F + p_111619_.getV((p_111616_ + 2) % 4) / 16.0F * .001F)); - } - - private void applyElementRotation(Vector3f p_254412_, @Nullable BlockElementRotation p_254150_) { From 3e5d9b00241fdff90afbcc6580e0d8cd630a5421 Mon Sep 17 00:00:00 2001 From: Dennis C Date: Tue, 31 Oct 2023 09:50:04 +0100 Subject: [PATCH 04/14] Convert RenderTypes from BakedModel to their corresponding "moving render type" in the FallingBlockRenderer (#206) --- .../client/renderer/entity/FallingBlockRenderer.java.patch | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/patches/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch index 09a785a6ca..2ed287a6bf 100644 --- a/patches/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch @@ -9,7 +9,12 @@ this.dispatcher .getModelRenderer() .tesselateBlock( -@@ -46,7 +48,9 @@ +@@ -42,11 +44,13 @@ + blockstate, + blockpos, + p_114637_, +- p_114638_.getBuffer(ItemBlockRenderTypes.getMovingBlockRenderType(blockstate)), ++ p_114638_.getBuffer(net.neoforged.neoforge.client.RenderTypeHelper.getMovingBlockRenderType(renderType)), false, RandomSource.create(), blockstate.getSeed(p_114634_.getStartPos()), From a223480f33b4a6a547405ce7d2ac1cb295f9989a Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:25:31 +0100 Subject: [PATCH 05/14] Use GitHub Actions for CI on PRs (#214) --- .github/workflows/build-prs.yml | 39 +++++++++++++++++++ .github/workflows/comments.yml | 16 -------- .github/workflows/issues.yml | 16 -------- .github/workflows/pull_request_review.yml | 13 ------- .../workflows/pull_request_review_comment.yml | 13 ------- .../pull_request_review_comment_run.yml | 20 ---------- .github/workflows/pull_request_review_run.yml | 20 ---------- .github/workflows/pull_requests.yml | 18 --------- .github/workflows/push.yml | 16 -------- settings.gradle | 2 +- 10 files changed, 40 insertions(+), 133 deletions(-) create mode 100644 .github/workflows/build-prs.yml delete mode 100644 .github/workflows/comments.yml delete mode 100644 .github/workflows/issues.yml delete mode 100644 .github/workflows/pull_request_review.yml delete mode 100644 .github/workflows/pull_request_review_comment.yml delete mode 100644 .github/workflows/pull_request_review_comment_run.yml delete mode 100644 .github/workflows/pull_request_review_run.yml delete mode 100644 .github/workflows/pull_requests.yml delete mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/build-prs.yml b/.github/workflows/build-prs.yml new file mode 100644 index 0000000000..f9fe19adda --- /dev/null +++ b/.github/workflows/build-prs.yml @@ -0,0 +1,39 @@ +name: Build and test PRs + +on: + pull_request: + types: + - synchronize + - opened + - ready_for_review + - reopened + +jobs: + jdk17: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 1000 + fetch-tags: true + + - name: Setup JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: setup + cache-read-only: false + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: build + cache-read-only: false diff --git a/.github/workflows/comments.yml b/.github/workflows/comments.yml deleted file mode 100644 index 721653a26d..0000000000 --- a/.github/workflows/comments.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Comment actions' - -on: issue_comment - -permissions: - contents: read - issues: write - pull-requests: write - discussions: write - -jobs: - labels: - uses: MinecraftForge/SharedActions/.github/workflows/comment_actions.yml@main - secrets: - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - GH_APP_NAME: ${{ secrets.GH_APP_NAME }} \ No newline at end of file diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml deleted file mode 100644 index b141d9938e..0000000000 --- a/.github/workflows/issues.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Issue actions' - -on: issues - -permissions: - contents: read - issues: write - pull-requests: write - discussions: write - -jobs: - labels: - uses: MinecraftForge/SharedActions/.github/workflows/issue_actions.yml@main - secrets: - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - GH_APP_NAME: ${{ secrets.GH_APP_NAME }} \ No newline at end of file diff --git a/.github/workflows/pull_request_review.yml b/.github/workflows/pull_request_review.yml deleted file mode 100644 index 7f44cbdb09..0000000000 --- a/.github/workflows/pull_request_review.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: 'PR Review' - -on: pull_request_review - -jobs: - upload_payload: - name: Upload payload - runs-on: ubuntu-latest - steps: - - uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable - with: - name: payload - path: ${{ github.event_path }} \ No newline at end of file diff --git a/.github/workflows/pull_request_review_comment.yml b/.github/workflows/pull_request_review_comment.yml deleted file mode 100644 index 2c3e5bc54b..0000000000 --- a/.github/workflows/pull_request_review_comment.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: 'PR Review Comment' - -on: pull_request_review_comment - -jobs: - upload_payload: - name: Upload payload - runs-on: ubuntu-latest - steps: - - uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable - with: - name: payload - path: ${{ github.event_path }} \ No newline at end of file diff --git a/.github/workflows/pull_request_review_comment_run.yml b/.github/workflows/pull_request_review_comment_run.yml deleted file mode 100644 index a2e8f66d5c..0000000000 --- a/.github/workflows/pull_request_review_comment_run.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: 'Pull Request Review Comment actions' - -on: - workflow_run: - workflows: [PR Review Comment] - types: - - completed - -permissions: - contents: read - issues: write - pull-requests: write - discussions: write - -jobs: - labels: - uses: MinecraftForge/SharedActions/.github/workflows/pr_review_comment_actions.yml@main - secrets: - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - GH_APP_NAME: ${{ secrets.GH_APP_NAME }} \ No newline at end of file diff --git a/.github/workflows/pull_request_review_run.yml b/.github/workflows/pull_request_review_run.yml deleted file mode 100644 index 8860c782f8..0000000000 --- a/.github/workflows/pull_request_review_run.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: 'Pull Request Review actions' - -on: - workflow_run: - workflows: [PR Review] - types: - - completed - -permissions: - contents: read - issues: write - pull-requests: write - discussions: write - -jobs: - labels: - uses: MinecraftForge/SharedActions/.github/workflows/pr_review_actions.yml@main - secrets: - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - GH_APP_NAME: ${{ secrets.GH_APP_NAME }} \ No newline at end of file diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml deleted file mode 100644 index 80ac5ea74e..0000000000 --- a/.github/workflows/pull_requests.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: 'Pull Request actions' - -on: - pull_request_target: - types: [assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, converted_to_draft, ready_for_review, locked, unlocked, review_requested, review_request_removed, auto_merge_enabled, auto_merge_disabled] - -permissions: - contents: read - issues: write - pull-requests: write - discussions: write - -jobs: - labels: - uses: MinecraftForge/SharedActions/.github/workflows/pr_actions.yml@main - secrets: - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - GH_APP_NAME: ${{ secrets.GH_APP_NAME }} \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index b71c8499c9..0000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Push actions' - -on: push - -permissions: - contents: read - issues: write - pull-requests: write - discussions: write - -jobs: - labels: - uses: MinecraftForge/SharedActions/.github/workflows/push_actions.yml@main - secrets: - GH_APP_KEY: ${{ secrets.GH_APP_KEY }} - GH_APP_NAME: ${{ secrets.GH_APP_NAME }} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 1df0623428..99e46528cc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,7 @@ pluginManagement { } plugins { - id 'net.neoforged.gradle.platform' version '7.0.5' + id 'net.neoforged.gradle.platform' version '7.0.8' } rootProject.name = rootDir.name From 78681badc6611d0d2c7cf7e343abeda2af8b98c8 Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:07:25 +0100 Subject: [PATCH 06/14] Remove TC PR checks (#216) --- .teamcity/settings.kts | 90 ------------------------------------------ 1 file changed, 90 deletions(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index abba35d29b..e555e2a65b 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -108,93 +108,3 @@ object BuildSecondaryBranches : BuildType({ """.trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true) } }) - -object PullRequests : BuildType({ - templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle")) - id("MinecraftForge_MinecraftForge__PullRequests") - name = "Pull Requests" - description = "Builds pull requests for the project" - - params { - param("git_branch_spec", "") - } - - params { - checkbox("should_execute_build", "true", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN, - checked = "true", unchecked = "false") - text( - "gradle_build_task", - "assemble", - label = "Gradle build task to execute during build", - description = "Determines the build task that is executed to build the project.", - display = ParameterDisplay.HIDDEN, - allowEmpty = false - ) - } -}) - -object PullRequestChecks : BuildType({ - templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle")) - id("MinecraftForge_MinecraftForge__PullRequestChecks") - name = "Pull Requests (Checks)" - description = "Checks pull requests for the project" - - params { - param("git_branch_spec", "") - } - - steps { - gradle { - name = "Check" - id = "RUNNER_10_Check" - - tasks = "checkAll" - gradleParams = "--continue %gradle_custom_args%" - enableStacktrace = true - } - } -}) - -object PullRequestCompatibility : BuildType({ - templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle")) - id("MinecraftForge_MinecraftForge__PullRequestCompatibility") - name = "Pull Requests (Compatibility)" - description = "Validates binary compatibility for pull requests made to the project" - - params { - param("git_branch_spec", "") - } - - steps { - gradle { - name = "Validate" - id = "RUNNER_10_Compatibility" - - tasks = "checkJarCompatibility" - gradleParams = "--continue %gradle_custom_args%" - enableStacktrace = true - } - } -}) - -object PullRequestPatchModifications : BuildType({ - templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle")) - id("MinecraftForge_MinecraftForge__PullRequestPatchModifications") - name = "Pull Requests (Patch Correctness)" - description = "Validates initial patch correctness" - - params { - param("git_branch_spec", "") - } - - steps { - gradle { - name = "Validate" - id = "RUNNER_10_Compatibility" - - tasks = ":forge:genPatches failGitChanges" - gradleParams = "--continue %gradle_custom_args%" - enableStacktrace = true - } - } -}) From b893ffd8ebe140493ef3e05abdebf3b661a4fca2 Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:57:54 +0100 Subject: [PATCH 07/14] Remove deleted build types from TC config (#221) --- .teamcity/settings.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index e555e2a65b..58c4090757 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -31,10 +31,6 @@ project { buildType(Build) buildType(BuildSecondaryBranches) - buildType(PullRequests) - buildType(PullRequestChecks) - buildType(PullRequestCompatibility) - buildType(PullRequestPatchModifications) params { text("docker_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false) From 9a8dc606a571be4ecef05deb94a8393864f709c3 Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:30:12 +0100 Subject: [PATCH 08/14] Tweak actions for PRs (#217) --- .github/workflows/build-prs.yml | 10 +++++++--- build.gradle | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-prs.yml b/.github/workflows/build-prs.yml index f9fe19adda..059069a5b6 100644 --- a/.github/workflows/build-prs.yml +++ b/.github/workflows/build-prs.yml @@ -9,17 +9,21 @@ on: - reopened jobs: - jdk17: + build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 1000 fetch-tags: true + # GradleUtils will append the branch name to the version, + # but for that we need a properly checked out branch + - name: Create branch for commit + run: + git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }} + - name: Setup JDK 17 uses: actions/setup-java@v2 with: diff --git a/build.gradle b/build.gradle index 18f8b37e9f..a7f22b2de0 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,9 @@ changelog { disableAutomaticPublicationRegistration() } +// Print version, generally useful to know - also appears on CI +System.out.println("NeoForge version ${gradleutils.version.toString()}") + allprojects { version gradleutils.version.toString() group 'net.neoforged' From a378a03a3dd724a49a3edd98b3d70c9f24ef6ecc Mon Sep 17 00:00:00 2001 From: AterAnimAvis Date: Tue, 31 Oct 2023 13:59:31 +0000 Subject: [PATCH 09/14] Fix switched air graphics in breathing bar (#219) --- .../net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java index 30862b0e37..68ff2fbddf 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java @@ -205,7 +205,7 @@ protected void renderAir(int width, int height, GuiGraphics guiGraphics) { int partial = Mth.ceil((double) air * 10.0D / 300.0D) - full; for (int i = 0; i < full + partial; ++i) { - guiGraphics.blitSprite(i < full ? AIR_BURSTING_SPRITE : AIR_SPRITE, left - i * 8 - 9, top, 9, 9); + guiGraphics.blitSprite(i < full ? AIR_SPRITE : AIR_BURSTING_SPRITE, left - i * 8 - 9, top, 9, 9); } rightHeight += 10; } From 3cc9041bc1d5b6c636133136329db7da90eeac6c Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Tue, 31 Oct 2023 22:19:27 +0800 Subject: [PATCH 10/14] Fix shields being instantly broken (#213) A misapplied patch caused a call to stopUsingItem(), which blanks out the currently-using item, even if the shield didn't break. Fixes #211 --- .../world/entity/player/Player.java.patch | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/patches/net/minecraft/world/entity/player/Player.java.patch b/patches/net/minecraft/world/entity/player/Player.java.patch index 034f68c58d..f77be25295 100644 --- a/patches/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/net/minecraft/world/entity/player/Player.java.patch @@ -139,16 +139,20 @@ if (!this.level().isClientSide) { this.awardStat(Stats.ITEM_USED.get(this.useItem.getItem())); } -@@ -906,6 +920,8 @@ +@@ -905,7 +919,11 @@ + if (p_36383_ >= 3.0F) { int i = 1 + Mth.floor(p_36383_); InteractionHand interactionhand = this.getUsedItemHand(); - this.useItem.hurtAndBreak(i, this, p_219739_ -> p_219739_.broadcastBreakEvent(interactionhand)); +- this.useItem.hurtAndBreak(i, this, p_219739_ -> p_219739_.broadcastBreakEvent(interactionhand)); ++ this.useItem.hurtAndBreak(i, this, p_219739_ -> { ++ p_219739_.broadcastBreakEvent(interactionhand); + net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, this.useItem, interactionhand); -+ stopUsingItem(); // Forge: fix MC-168573 ++ stopUsingItem(); // Neo: Fix MC-168573 ("After breaking a shield, the player's off-hand can't finish using some items") ++ }); if (this.useItem.isEmpty()) { if (interactionhand == InteractionHand.MAIN_HAND) { this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); -@@ -923,10 +939,13 @@ +@@ -923,10 +941,13 @@ @Override protected void actuallyHurt(DamageSource p_36312_, float p_36313_) { if (!this.isInvulnerableTo(p_36312_)) { @@ -162,7 +166,7 @@ float f = p_36313_ - f1; if (f > 0.0F && f < 3.4028235E37F) { this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f * 10.0F)); -@@ -990,6 +1009,8 @@ +@@ -990,6 +1011,8 @@ return InteractionResult.PASS; } else { @@ -171,7 +175,7 @@ ItemStack itemstack = this.getItemInHand(p_36159_); ItemStack itemstack1 = itemstack.copy(); InteractionResult interactionresult = p_36158_.interact(this, p_36159_); -@@ -998,6 +1019,9 @@ +@@ -998,6 +1021,9 @@ itemstack.setCount(itemstack1.getCount()); } @@ -181,7 +185,7 @@ return interactionresult; } else { if (!itemstack.isEmpty() && p_36158_ instanceof LivingEntity) { -@@ -1009,6 +1033,7 @@ +@@ -1009,6 +1035,7 @@ if (interactionresult1.consumesAction()) { this.level().gameEvent(GameEvent.ENTITY_INTERACT, p_36158_.position(), GameEvent.Context.of(this)); if (itemstack.isEmpty() && !this.abilities.instabuild) { @@ -189,7 +193,7 @@ this.setItemInHand(p_36159_, ItemStack.EMPTY); } -@@ -1043,6 +1068,7 @@ +@@ -1043,6 +1070,7 @@ } @Override @@ -197,7 +201,7 @@ protected Vec3 maybeBackOffFromEdge(Vec3 p_36201_, MoverType p_36202_) { if (!this.abilities.flying && p_36201_.y <= 0.0 -@@ -1097,6 +1123,7 @@ +@@ -1097,6 +1125,7 @@ return p_36201_; } @@ -205,7 +209,7 @@ private boolean isAboveGround() { return this.onGround() || this.fallDistance < this.maxUpStep() -@@ -1104,6 +1131,7 @@ +@@ -1104,6 +1133,7 @@ } public void attack(Entity p_36347_) { @@ -213,7 +217,7 @@ if (p_36347_.isAttackable()) { if (!p_36347_.skipAttackInteraction(this)) { float f = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); -@@ -1117,11 +1145,10 @@ +@@ -1117,11 +1147,10 @@ float f2 = this.getAttackStrengthScale(0.5F); f *= 0.2F + f2 * f2 * 0.8F; f1 *= f2; @@ -226,7 +230,7 @@ i += EnchantmentHelper.getKnockbackBonus(this); if (this.isSprinting() && flag) { this.level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); -@@ -1138,8 +1165,10 @@ +@@ -1138,8 +1167,10 @@ && !this.isPassenger() && p_36347_ instanceof LivingEntity; flag2 = flag2 && !this.isSprinting(); @@ -238,7 +242,7 @@ } f += f1; -@@ -1147,9 +1176,7 @@ +@@ -1147,9 +1178,7 @@ double d0 = (double)(this.walkDist - this.walkDistO); if (flag && !flag2 && !flag1 && this.onGround() && d0 < (double)this.getSpeed()) { ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); @@ -249,7 +253,7 @@ } float f4 = 0.0F; -@@ -1190,11 +1217,13 @@ +@@ -1190,11 +1219,13 @@ float f3 = 1.0F + EnchantmentHelper.getSweepingDamageRatio(this) * f; for(LivingEntity livingentity : this.level().getEntitiesOfClass(LivingEntity.class, p_36347_.getBoundingBox().inflate(1.0, 0.25, 1.0))) { @@ -264,7 +268,7 @@ livingentity.knockback( 0.4F, (double)Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), (double)(-Mth.cos(this.getYRot() * (float) (Math.PI / 180.0))) ); -@@ -1238,13 +1267,15 @@ +@@ -1238,13 +1269,15 @@ EnchantmentHelper.doPostDamageEffects(this, p_36347_); ItemStack itemstack1 = this.getMainHandItem(); Entity entity = p_36347_; @@ -282,7 +286,7 @@ this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); } } -@@ -1271,6 +1302,7 @@ +@@ -1271,6 +1304,7 @@ } } } @@ -290,7 +294,7 @@ } } } -@@ -1287,7 +1319,7 @@ +@@ -1287,7 +1321,7 @@ } if (this.random.nextFloat() < f) { @@ -299,7 +303,7 @@ this.stopUsingItem(); this.level().broadcastEntityEvent(this, (byte)30); } -@@ -1349,6 +1381,7 @@ +@@ -1349,6 +1383,7 @@ } public void stopSleepInBed(boolean p_36226_, boolean p_36227_) { @@ -307,7 +311,7 @@ super.stopSleeping(); if (this.level() instanceof ServerLevel && p_36227_) { ((ServerLevel)this.level()).updateSleepingPlayerList(); -@@ -1375,7 +1408,7 @@ +@@ -1375,7 +1410,7 @@ } else if (block instanceof BedBlock && BedBlock.canSetSpawn(p_36131_)) { return BedBlock.findStandUpPosition(EntityType.PLAYER, p_36131_, p_36132_, blockstate.getValue(BedBlock.FACING), p_36133_); } else if (!p_36134_) { @@ -316,7 +320,7 @@ } else { boolean flag = block.isPossibleToRespawnInThis(blockstate); BlockState blockstate1 = p_36131_.getBlockState(p_36132_.above()); -@@ -1561,6 +1594,7 @@ +@@ -1561,6 +1596,7 @@ @Override public boolean causeFallDamage(float p_150093_, float p_150094_, DamageSource p_150095_) { if (this.abilities.mayfly) { @@ -324,7 +328,7 @@ return false; } else { if (p_150093_ >= 2.0F) { -@@ -1574,7 +1608,7 @@ +@@ -1574,7 +1610,7 @@ public boolean tryToStartFallFlying() { if (!this.onGround() && !this.isFallFlying() && !this.isInWater() && !this.hasEffect(MobEffects.LEVITATION)) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); @@ -333,7 +337,7 @@ this.startFallFlying(); return true; } -@@ -1603,13 +1637,13 @@ +@@ -1603,13 +1639,13 @@ protected void playStepSound(BlockPos p_282121_, BlockState p_282194_) { if (this.isInWater()) { this.waterSwimSound(); @@ -349,7 +353,7 @@ } else { super.playStepSound(blockpos, blockstate); } -@@ -1638,6 +1672,10 @@ +@@ -1638,6 +1674,10 @@ } public void giveExperiencePoints(int p_36291_) { @@ -360,7 +364,7 @@ this.increaseScore(p_36291_); this.experienceProgress += (float)p_36291_ / (float)this.getXpNeededForNextLevel(); this.totalExperience = Mth.clamp(this.totalExperience + p_36291_, 0, Integer.MAX_VALUE); -@@ -1665,7 +1703,7 @@ +@@ -1665,7 +1705,7 @@ } public void onEnchantmentPerformed(ItemStack p_36172_, int p_36173_) { @@ -369,7 +373,7 @@ if (this.experienceLevel < 0) { this.experienceLevel = 0; this.experienceProgress = 0.0F; -@@ -1676,6 +1714,10 @@ +@@ -1676,6 +1716,10 @@ } public void giveExperienceLevels(int p_36276_) { @@ -380,7 +384,7 @@ this.experienceLevel += p_36276_; if (this.experienceLevel < 0) { this.experienceLevel = 0; -@@ -1879,7 +1921,11 @@ +@@ -1879,7 +1923,11 @@ @Override public Component getDisplayName() { @@ -393,7 +397,7 @@ return this.decorateDisplayNameComponent(mutablecomponent); } -@@ -2026,25 +2072,25 @@ +@@ -2026,25 +2074,25 @@ Predicate predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getSupportedHeldProjectiles(); ItemStack itemstack = ProjectileWeaponItem.getHeldProjectile(this, predicate); if (!itemstack.isEmpty()) { @@ -423,7 +427,7 @@ this.awardStat(Stats.ITEM_USED.get(p_36186_.getItem())); p_36185_.playSound( null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, p_36185_.random.nextFloat() * 0.1F + 0.9F -@@ -2160,5 +2206,63 @@ +@@ -2160,5 +2208,63 @@ public Component getMessage() { return this.message; } From e425cf7f63ac4ca793d8e29802564226f50e562c Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Wed, 1 Nov 2023 01:15:22 +0800 Subject: [PATCH 11/14] Fix switched armor points icons in HUD (#225) Fixes #224 --- .../neoforged/neoforge/client/gui/overlay/ExtendedGui.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java index 68ff2fbddf..69cef4e0df 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java @@ -171,11 +171,11 @@ protected void renderArmor(GuiGraphics guiGraphics, int width, int height) { int level = minecraft.player.getArmorValue(); for (int i = 1; level > 0 && i < 20; i += 2) { if (i < level) { - guiGraphics.blitSprite(ARMOR_EMPTY_SPRITE, left, top, 9, 9); + guiGraphics.blitSprite(ARMOR_FULL_SPRITE, left, top, 9, 9); } else if (i == level) { guiGraphics.blitSprite(ARMOR_HALF_SPRITE, left, top, 9, 9); - } else if (i > level) { - guiGraphics.blitSprite(ARMOR_FULL_SPRITE, left, top, 9, 9); + } else { + guiGraphics.blitSprite(ARMOR_EMPTY_SPRITE, left, top, 9, 9); } left += 8; } From 3594d1f078a7b7ec0540da350b29ed6915ecf787 Mon Sep 17 00:00:00 2001 From: Dennis C Date: Tue, 31 Oct 2023 18:32:31 +0100 Subject: [PATCH 12/14] Collapse TextureStitchEvent into a single post-stitch event (#208) --- .../renderer/texture/TextureAtlas.java.patch | 2 +- .../neoforge/client/ClientHooks.java | 6 +- .../event/TextureAtlasStitchedEvent.java | 40 +++++++++ .../client/event/TextureStitchEvent.java | 85 ------------------- 4 files changed, 44 insertions(+), 89 deletions(-) create mode 100644 src/main/java/net/neoforged/neoforge/client/event/TextureAtlasStitchedEvent.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/event/TextureStitchEvent.java diff --git a/patches/net/minecraft/client/renderer/texture/TextureAtlas.java.patch b/patches/net/minecraft/client/renderer/texture/TextureAtlas.java.patch index 97efb1c279..cc880b6619 100644 --- a/patches/net/minecraft/client/renderer/texture/TextureAtlas.java.patch +++ b/patches/net/minecraft/client/renderer/texture/TextureAtlas.java.patch @@ -5,7 +5,7 @@ this.animatedTextures = List.copyOf(list1); } + -+ net.neoforged.neoforge.client.ClientHooks.onTextureStitchedPost(this); ++ net.neoforged.neoforge.client.ClientHooks.onTextureAtlasStitched(this); } @Override diff --git a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java index 0d55bbd334..955e2bfb27 100644 --- a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java +++ b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java @@ -154,7 +154,7 @@ import net.neoforged.neoforge.client.event.RenderTooltipEvent; import net.neoforged.neoforge.client.event.ScreenEvent; import net.neoforged.neoforge.client.event.ScreenshotEvent; -import net.neoforged.neoforge.client.event.TextureStitchEvent; +import net.neoforged.neoforge.client.event.TextureAtlasStitchedEvent; import net.neoforged.neoforge.client.event.ToastAddEvent; import net.neoforged.neoforge.client.event.ViewportEvent; import net.neoforged.neoforge.client.event.sound.PlaySoundEvent; @@ -283,8 +283,8 @@ public static boolean renderSpecificFirstPersonArm(PoseStack poseStack, MultiBuf return NeoForge.EVENT_BUS.post(new RenderArmEvent(poseStack, multiBufferSource, packedLight, player, arm)).isCanceled(); } - public static void onTextureStitchedPost(TextureAtlas map) { - ModLoader.get().postEvent(new TextureStitchEvent.Post(map)); + public static void onTextureAtlasStitched(TextureAtlas atlas) { + ModLoader.get().postEvent(new TextureAtlasStitchedEvent(atlas)); } public static void onBlockColorsInit(BlockColors blockColors) { diff --git a/src/main/java/net/neoforged/neoforge/client/event/TextureAtlasStitchedEvent.java b/src/main/java/net/neoforged/neoforge/client/event/TextureAtlasStitchedEvent.java new file mode 100644 index 0000000000..be85c732ae --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/event/TextureAtlasStitchedEvent.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.event; + +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.neoforged.bus.api.Event; +import net.neoforged.bus.api.ICancellableEvent; +import net.neoforged.fml.LogicalSide; +import net.neoforged.fml.event.IModBusEvent; +import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext; +import org.jetbrains.annotations.ApiStatus; + +/** + * Fired after a texture atlas is stitched together and all textures therein have been loaded. + * + *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see TextureAtlas + */ +public class TextureAtlasStitchedEvent extends Event implements IModBusEvent { + private final TextureAtlas atlas; + + @ApiStatus.Internal + public TextureAtlasStitchedEvent(TextureAtlas atlas) { + this.atlas = atlas; + } + + /** + * {@return the texture atlas} + */ + public TextureAtlas getAtlas() { + return atlas; + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/event/TextureStitchEvent.java b/src/main/java/net/neoforged/neoforge/client/event/TextureStitchEvent.java deleted file mode 100644 index 214dca759e..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/event/TextureStitchEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.event; - -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.neoforged.bus.api.Event; -import net.neoforged.fml.LogicalSide; -import net.neoforged.fml.event.IModBusEvent; -import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext; -import org.jetbrains.annotations.ApiStatus; - -/** - * Fired after a texture atlas is stitched together. - * - * @see TextureStitchEvent.Post - * @see TextureAtlas - */ -public abstract class TextureStitchEvent extends Event implements IModBusEvent { - private final TextureAtlas atlas; - - @ApiStatus.Internal - public TextureStitchEvent(TextureAtlas atlas) { - this.atlas = atlas; - } - - /** - * {@return the texture atlas} - */ - public TextureAtlas getAtlas() { - return atlas; - } - - // Use atlas info JSON files instead - // /** - // *

Fired before a texture atlas is stitched together. - // * This can be used to add custom sprites to be stitched into the atlas.

- // * - // *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.

- // * - // *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus}, - // * only on the {@linkplain LogicalSide#CLIENT logical client}.

- // */ - // public static class Pre extends TextureStitchEvent - // { - // private final Set sprites; - // - // @ApiStatus.Internal - // public Pre(TextureAtlas map, Set sprites) - // { - // super(map); - // this.sprites = sprites; - // } - // - // /** - // * Adds a sprite to be stitched into the texture atlas. - // * - // *

Callers should check that the atlas which the event is fired for is the atlas they wish to stitch the - // * sprite into, as otherwise they would be stitching the sprite into all atlases.

- // * - // * @param sprite the location of the sprite - // */ - // public boolean addSprite(ResourceLocation sprite) - // { - // return this.sprites.add(sprite); - // } - // } - - /** - * Fired after a texture atlas is stitched together and all textures therein has been loaded. - * - *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.

- * - *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus}, - * only on the {@linkplain LogicalSide#CLIENT logical client}.

- */ - public static class Post extends TextureStitchEvent { - @ApiStatus.Internal - public Post(TextureAtlas map) { - super(map); - } - } -} From 00679460a967e47a03a87bd233ee9d983178db7d Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 1 Nov 2023 01:57:19 -0400 Subject: [PATCH 13/14] Fix DebugLevelSource being off-by-one on grid height (#226) --- .../minecraft/world/level/levelgen/DebugLevelSource.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch b/patches/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch index d5625c5650..73827fcef2 100644 --- a/patches/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch +++ b/patches/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch @@ -7,7 +7,7 @@ + public static void initValidStates() { + ALL_BLOCKS = StreamSupport.stream(BuiltInRegistries.BLOCK.spliterator(), false).flatMap(block -> block.getStateDefinition().getPossibleStates().stream()).collect(Collectors.toList()); + GRID_WIDTH = Mth.ceil(Mth.sqrt(ALL_BLOCKS.size())); -+ GRID_HEIGHT = Mth.ceil((float) (ALL_BLOCKS.size() / GRID_WIDTH)); ++ GRID_HEIGHT = Mth.ceil((float)ALL_BLOCKS.size() / (float)GRID_WIDTH); + } + @Override From c2229a33be84d30e1ce3fc857c226cb9267aceee Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:14:22 -0700 Subject: [PATCH 14/14] Use updated translation keys in commands/command arguments (#227) --- .../neoforge/server/command/EnumArgument.java | 2 +- .../server/command/ModListCommand.java | 2 +- .../neoforge/server/command/TPSCommand.java | 4 +-- .../neoforge/server/command/TagsCommand.java | 26 +++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/server/command/EnumArgument.java b/src/main/java/net/neoforged/neoforge/server/command/EnumArgument.java index 2b76a4f289..1b263feb2c 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/EnumArgument.java +++ b/src/main/java/net/neoforged/neoforge/server/command/EnumArgument.java @@ -26,7 +26,7 @@ public class EnumArgument> implements ArgumentType { private static final Dynamic2CommandExceptionType INVALID_ENUM = new Dynamic2CommandExceptionType( - (found, constants) -> Component.translatable("commands.forge.arguments.enum.invalid", constants, found)); + (found, constants) -> Component.translatable("commands.neoforge.arguments.enum.invalid", constants, found)); private final Class enumClass; public static > EnumArgument enumArgument(Class enumClass) { diff --git a/src/main/java/net/neoforged/neoforge/server/command/ModListCommand.java b/src/main/java/net/neoforged/neoforge/server/command/ModListCommand.java index 217394d671..49a7f5b603 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/ModListCommand.java +++ b/src/main/java/net/neoforged/neoforge/server/command/ModListCommand.java @@ -18,7 +18,7 @@ class ModListCommand { return Commands.literal("mods") .requires(cs -> cs.hasPermission(0)) //permission .executes(ctx -> { - ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.mods.list", + ctx.getSource().sendSuccess(() -> Component.translatable("commands.neoforge.mods.list", ModList.get().applyForEachModFile(modFile -> // locator - filename : firstmod (version) - numberofmods\n String.format(Locale.ROOT, "%s %s : %s (%s) - %d", diff --git a/src/main/java/net/neoforged/neoforge/server/command/TPSCommand.java b/src/main/java/net/neoforged/neoforge/server/command/TPSCommand.java index d1078b07dd..9f8e8e1981 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/TPSCommand.java +++ b/src/main/java/net/neoforged/neoforge/server/command/TPSCommand.java @@ -33,7 +33,7 @@ class TPSCommand { @SuppressWarnings("resource") double meanTickTime = mean(ctx.getSource().getServer().tickTimes) * 1.0E-6D; double meanTPS = Math.min(1000.0 / meanTickTime, 20); - ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.neoforge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false); return 0; }); @@ -48,7 +48,7 @@ private static int sendTime(CommandSourceStack cs, ServerLevel dim) throws Comma final Registry reg = cs.registryAccess().registryOrThrow(Registries.DIMENSION_TYPE); double worldTickTime = mean(times) * 1.0E-6D; double worldTPS = Math.min(1000.0 / worldTickTime, 20); - cs.sendSuccess(() -> Component.translatable("commands.forge.tps.summary.named", dim.dimension().location().toString(), reg.getKey(dim.dimensionType()), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); + cs.sendSuccess(() -> Component.translatable("commands.neoforge.tps.summary.named", dim.dimension().location().toString(), reg.getKey(dim.dimensionType()), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); return 1; } diff --git a/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java b/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java index ea5c9c1db9..06fd55f35a 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java +++ b/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java @@ -58,9 +58,9 @@ class TagsCommand { private static final long PAGE_SIZE = 8; private static final ResourceKey>> ROOT_REGISTRY_KEY = ResourceKey.createRegistryKey(new ResourceLocation("root")); - private static final DynamicCommandExceptionType UNKNOWN_REGISTRY = new DynamicCommandExceptionType(key -> Component.translatable("commands.forge.tags.error.unknown_registry", key)); - private static final Dynamic2CommandExceptionType UNKNOWN_TAG = new Dynamic2CommandExceptionType((tag, registry) -> Component.translatable("commands.forge.tags.error.unknown_tag", tag, registry)); - private static final Dynamic2CommandExceptionType UNKNOWN_ELEMENT = new Dynamic2CommandExceptionType((tag, registry) -> Component.translatable("commands.forge.tags.error.unknown_element", tag, registry)); + private static final DynamicCommandExceptionType UNKNOWN_REGISTRY = new DynamicCommandExceptionType(key -> Component.translatable("commands.neoforge.tags.error.unknown_registry", key)); + private static final Dynamic2CommandExceptionType UNKNOWN_TAG = new Dynamic2CommandExceptionType((tag, registry) -> Component.translatable("commands.neoforge.tags.error.unknown_tag", tag, registry)); + private static final Dynamic2CommandExceptionType UNKNOWN_ELEMENT = new Dynamic2CommandExceptionType((tag, registry) -> Component.translatable("commands.neoforge.tags.error.unknown_element", tag, registry)); public static ArgumentBuilder register() { /* @@ -99,9 +99,9 @@ private static int listTags(final CommandContext ctx, final final long tagCount = registry.getTags().count(); ctx.getSource().sendSuccess(() -> createMessage( - Component.translatable("commands.forge.tags.registry_key", Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD)), - "commands.forge.tags.tag_count", - "commands.forge.tags.copy_tag_names", + Component.translatable("commands.neoforge.tags.registry_key", Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD)), + "commands.neoforge.tags.tag_count", + "commands.neoforge.tags.copy_tag_names", tagCount, page, ChatFormatting.DARK_GREEN, @@ -126,11 +126,11 @@ private static int listTagElements(final CommandContext ctx, .orElseThrow(() -> UNKNOWN_TAG.create(tagKey.location(), registryKey.location())); ctx.getSource().sendSuccess(() -> createMessage( - Component.translatable("commands.forge.tags.tag_key", + Component.translatable("commands.neoforge.tags.tag_key", Component.literal(tagKey.registry().location().toString()).withStyle(ChatFormatting.GOLD), Component.literal(tagKey.location().toString()).withStyle(ChatFormatting.DARK_GREEN)), - "commands.forge.tags.element_count", - "commands.forge.tags.copy_element_names", + "commands.neoforge.tags.element_count", + "commands.neoforge.tags.copy_element_names", tag.size(), page, ChatFormatting.YELLOW, @@ -154,11 +154,11 @@ private static int queryElementTags(final CommandContext ctx final long containingTagsCount = elementHolder.tags().count(); ctx.getSource().sendSuccess(() -> createMessage( - Component.translatable("commands.forge.tags.element", + Component.translatable("commands.neoforge.tags.element", Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD), Component.literal(elementLocation.toString()).withStyle(ChatFormatting.YELLOW)), - "commands.forge.tags.containing_tag_count", - "commands.forge.tags.copy_tag_names", + "commands.neoforge.tags.containing_tag_count", + "commands.neoforge.tags.copy_tag_names", containingTagsCount, page, ChatFormatting.DARK_GREEN, @@ -186,7 +186,7 @@ private static MutableComponent createMessage(final MutableComponent header, .withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, allElementNames)) .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable(copyHoverText))))); - containsComponent = Component.translatable("commands.forge.tags.page_info", + containsComponent = Component.translatable("commands.neoforge.tags.page_info", containsComponent, actualPage, totalPages); }