From 1eecd9cc426901a2428cd226358849b2a1ff936b Mon Sep 17 00:00:00 2001 From: bao7-CMD <807774825@qq.com> Date: Wed, 10 Sep 2025 21:12:16 +0800 Subject: [PATCH 1/3] Add files via upload --- .../mixin/DecoratedPotBlockEntityMixin.java | 140 +++++++++--------- 1 file changed, 73 insertions(+), 67 deletions(-) diff --git a/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java b/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java index aecc91d..5cff5fc 100644 --- a/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java +++ b/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java @@ -1,67 +1,73 @@ -package foundationgames.enhancedblockentities.mixin; - -import foundationgames.enhancedblockentities.util.WorldUtil; -import foundationgames.enhancedblockentities.util.duck.AppearanceStateHolder; -import net.minecraft.block.entity.DecoratedPotBlockEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(DecoratedPotBlockEntity.class) -public class DecoratedPotBlockEntityMixin implements AppearanceStateHolder { - @Unique private int enhanced_bes$modelState = 0; - @Unique private int enhanced_bes$renderState = 0; - - @Inject(method = "readNbt", at = @At("TAIL")) - private void enhanced_bes$updateChunkOnPatternsLoaded(NbtCompound nbt, RegistryWrapper.WrapperLookup rwl, CallbackInfo ci) { - var self = (DecoratedPotBlockEntity)(Object)this; - - if (self.getWorld() != null && self.getWorld().isClient()) { - WorldUtil.rebuildChunk(self.getWorld(), self.getPos()); - } - } - - @Inject(method = "onSyncedBlockEvent", at = @At(value = "RETURN", shift = At.Shift.BEFORE, ordinal = 0)) - private void enhanced_bes$updateOnWobble(int type, int data, CallbackInfoReturnable cir) { - var self = (DecoratedPotBlockEntity)(Object)this; - var world = self.getWorld(); - - if (self.lastWobbleType == null) { - return; - } - - this.updateAppearanceState(1, world, self.getPos()); - - WorldUtil.scheduleTimed(world, self.lastWobbleTime + self.lastWobbleType.lengthInTicks, - () -> { - if (self.getWorld().getTime() >= self.lastWobbleTime + self.lastWobbleType.lengthInTicks) { - this.updateAppearanceState(0, world, self.getPos()); - } - }); - } - - @Override - public int getModelState() { - return enhanced_bes$modelState; - } - - @Override - public void setModelState(int state) { - this.enhanced_bes$modelState = state; - } - - @Override - public int getRenderState() { - return enhanced_bes$renderState; - } - - @Override - public void setRenderState(int state) { - this.enhanced_bes$renderState = state; - } -} +/* */ package foundationgames.enhancedblockentities.mixin; +/* */ import foundationgames.enhancedblockentities.util.WorldUtil; +/* */ import foundationgames.enhancedblockentities.util.duck.AppearanceStateHolder; +/* */ import net.minecraft.class_1937; +/* */ import net.minecraft.class_2487; +/* */ import net.minecraft.class_8172; +/* */ import org.spongepowered.asm.mixin.Mixin; +/* */ import org.spongepowered.asm.mixin.Unique; +/* */ import org.spongepowered.asm.mixin.injection.At; +/* */ import org.spongepowered.asm.mixin.injection.Inject; +/* */ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +/* */ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +/* */ +/* */ @Mixin({class_8172.class}) +/* */ public class DecoratedPotBlockEntityMixin implements AppearanceStateHolder { +/* */ @Unique +/* 17 */ private int enhanced_bes$modelState = 0; @Unique +/* 18 */ private int enhanced_bes$renderState = 0; +/* */ +/* */ @Inject(method = {"readNbt"}, at = {@At("TAIL")}) +/* */ private void enhanced_bes$updateChunkOnPatternsLoaded(class_2487 nbt, class_8541 registryAccess, CallbackInfo ci) { +/* 22 */ class_8172 self = (class_8172)this; +/* */ +/* 24 */ if (self.method_10997() != null && self.method_10997().method_8608()) { +/* 25 */ WorldUtil.rebuildChunk(self.method_10997(), self.method_11016()); +/* */ } +/* */ } +/* */ +/* */ @Inject(method = {"onSyncedBlockEvent"}, at = {@At(value = "RETURN", shift = At.Shift.BEFORE, ordinal = 0)}) +/* */ private void enhanced_bes$updateOnWobble(int type, int data, CallbackInfoReturnable cir) { +/* 31 */ class_8172 self = (class_8172)this; +/* 32 */ class_1937 world = self.method_10997(); +/* */ +/* 34 */ if (self.field_46662 == null) { +/* */ return; +/* */ } +/* */ +/* 38 */ updateAppearanceState(1, world, self.method_11016()); +/* */ +/* 40 */ WorldUtil.scheduleTimed(world, self.field_46661 + self.field_46662.field_46666, () -> { +/* */ if (self.method_10997().method_8510() >= self.field_46661 + self.field_46662.field_46666) { +/* */ updateAppearanceState(0, world, self.method_11016()); +/* */ } +/* */ }); +/* */ } +/* */ +/* */ +/* */ +/* */ public int getModelState() { +/* 50 */ return this.enhanced_bes$modelState; +/* */ } +/* */ +/* */ +/* */ public void setModelState(int state) { +/* 55 */ this.enhanced_bes$modelState = state; +/* */ } +/* */ +/* */ +/* */ public int getRenderState() { +/* 60 */ return this.enhanced_bes$renderState; +/* */ } +/* */ +/* */ +/* */ public void setRenderState(int state) { +/* 65 */ this.enhanced_bes$renderState = state; +/* */ } +/* */ } + + +/* Location: D:\我的世界\.minecraft\versions\1.21.8生电包\mods\enhancedblockentities-0.11.3 1.21.4.jar!\foundationgames\enhancedblockentities\mixin\DecoratedPotBlockEntityMixin.class + * Java compiler version: 21 (65.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file From 6631d28060ee22f2de103ad89d1b8ea3e55aaa3e Mon Sep 17 00:00:00 2001 From: bao7-CMD <807774825@qq.com> Date: Wed, 10 Sep 2025 21:23:36 +0800 Subject: [PATCH 2/3] Create gradle.yml --- .github/workflows/gradle.yml | 95 ++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..3ba5df8 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,95 @@ +# 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: Java CI with Gradle + +on: + push: + branches: [ "1.21.4" ] + pull_request: + branches: [ "1.21.4" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + + - name: Build with Gradle Wrapper + run: ./gradlew build + + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. + # + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + # with: + # gradle-version: '8.9' + # + # - name: Build with Gradle 8.9 + # run: gradle build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4.6.2 + with: + # Artifact name + name: # optional, default is artifact + # A file, directory or wildcard pattern that describes what to upload + path: + # The desired behavior if no files are found using the provided path. +Available Options: + warn: Output a warning but do not fail the action + error: Fail the action with an error message + ignore: Do not output any warnings or errors, the action does not fail + + if-no-files-found: # optional, default is warn + # Duration after which artifact will expire in days. 0 means using default retention. +Minimum 1 day. Maximum 90 days unless changed from the repository settings page. + + retention-days: # optional + # The level of compression for Zlib to be applied to the artifact archive. The value can range from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same as GNU Gzip) - 9: Best compression Higher levels will result in better compression, but will take longer to complete. For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads. + + compression-level: # optional, default is 6 + # If true, an artifact with a matching name will be deleted before a new one is uploaded. If false, the action will fail if an artifact for the given name already exists. Does not fail if the artifact does not exist. + + overwrite: # optional, default is false + # If true, hidden files will be included in the artifact. If false, hidden files will be excluded from the artifact. + + include-hidden-files: # optional, default is false + From 136c850b256cf06d27820af5c557febaaa894d45 Mon Sep 17 00:00:00 2001 From: bao7-CMD <807774825@qq.com> Date: Wed, 10 Sep 2025 21:27:36 +0800 Subject: [PATCH 3/3] Delete .github/workflows/gradle.yml --- .github/workflows/gradle.yml | 95 ------------------------------------ 1 file changed, 95 deletions(-) delete mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 3ba5df8..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,95 +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: Java CI with Gradle - -on: - push: - branches: [ "1.21.4" ] - pull_request: - branches: [ "1.21.4" ] - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - - - name: Build with Gradle Wrapper - run: ./gradlew build - - # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). - # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. - # - # - name: Setup Gradle - # uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - # with: - # gradle-version: '8.9' - # - # - name: Build with Gradle 8.9 - # run: gradle build - - dependency-submission: - - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. - # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - - name: Upload a Build Artifact - uses: actions/upload-artifact@v4.6.2 - with: - # Artifact name - name: # optional, default is artifact - # A file, directory or wildcard pattern that describes what to upload - path: - # The desired behavior if no files are found using the provided path. -Available Options: - warn: Output a warning but do not fail the action - error: Fail the action with an error message - ignore: Do not output any warnings or errors, the action does not fail - - if-no-files-found: # optional, default is warn - # Duration after which artifact will expire in days. 0 means using default retention. -Minimum 1 day. Maximum 90 days unless changed from the repository settings page. - - retention-days: # optional - # The level of compression for Zlib to be applied to the artifact archive. The value can range from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same as GNU Gzip) - 9: Best compression Higher levels will result in better compression, but will take longer to complete. For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads. - - compression-level: # optional, default is 6 - # If true, an artifact with a matching name will be deleted before a new one is uploaded. If false, the action will fail if an artifact for the given name already exists. Does not fail if the artifact does not exist. - - overwrite: # optional, default is false - # If true, hidden files will be included in the artifact. If false, hidden files will be excluded from the artifact. - - include-hidden-files: # optional, default is false -