From 1e155fdbba524d660c0fe7d609cac4b75adfa35a Mon Sep 17 00:00:00 2001 From: Rimo <113169310+Rivmun@users.noreply.github.com> Date: Thu, 7 Aug 2025 14:32:55 +0800 Subject: [PATCH 1/2] 0.5.4 #89 & update denpendencies --- build.gradle | 2 +- .../config/ConfigScreen.java | 10 ++++ .../footprintparticle/config/FPPConfig.java | 3 ++ .../mixin/LivingEntityMixin.java | 54 ++++++++++--------- .../particle/FootprintParticle.java | 8 ++- .../assets/footprintparticle/lang/en_us.json | 4 +- .../assets/footprintparticle/lang/zh_cn.json | 2 + fabric/build.gradle | 8 +-- forge/build.gradle | 8 +-- gradle.properties | 8 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- 11 files changed, 67 insertions(+), 42 deletions(-) diff --git a/build.gradle b/build.gradle index e8e990a1..e529166c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false id "io.github.pacifistmc.forgix" version "1.2.6" } diff --git a/common/src/main/java/com/rimo/footprintparticle/config/ConfigScreen.java b/common/src/main/java/com/rimo/footprintparticle/config/ConfigScreen.java index 5a217b46..65f63495 100644 --- a/common/src/main/java/com/rimo/footprintparticle/config/ConfigScreen.java +++ b/common/src/main/java/com/rimo/footprintparticle/config/ConfigScreen.java @@ -88,6 +88,16 @@ private void buildCategory() { .setSaveConsumer(config::setWatermarkLifetime) .build() ); + general.addEntry(entryBuilder + .startIntSlider(new TranslatableText("text.footprintparticle.option.lifeTimeAcc") + ,config.getLifeTimeAcc() + ,0 + ,10) + .setDefaultValue(0) + .setTooltip(new TranslatableText("text.footprintparticle.option.lifeTimeAcc.@Tooltip")) + .setSaveConsumer(config::setLifeTimeAcc) + .build() + ); general.addEntry(entryBuilder .startIntSlider(new TranslatableText("text.footprintparticle.option.footprintAlpha") ,(int) (config.getFootprintAlpha() * 10) diff --git a/common/src/main/java/com/rimo/footprintparticle/config/FPPConfig.java b/common/src/main/java/com/rimo/footprintparticle/config/FPPConfig.java index d2f236eb..7553b2c7 100644 --- a/common/src/main/java/com/rimo/footprintparticle/config/FPPConfig.java +++ b/common/src/main/java/com/rimo/footprintparticle/config/FPPConfig.java @@ -103,6 +103,7 @@ public class FPPConfig implements ConfigData { private int waterSplashLevel = 1; private List customPrint = DEF_CUSTOM_PRINT; private float hardnessGate = 0.7f; + private int lifeTimeAcc = 0; public int isEnable() {return enableMod;} public float getSecPerPrint() {return secPerPrint;} @@ -129,6 +130,7 @@ public class FPPConfig implements ConfigData { public int getFootprintSize() {return footprintSize;} public List getCustomPrint() {return customPrint;} public float getHardnessGate() {return hardnessGate;} + public int getLifeTimeAcc() {return lifeTimeAcc;} public void setEnableMod(int isEnable) {enableMod = isEnable;} public void setSecPerPrint(float sec) {secPerPrint = sec;} @@ -155,4 +157,5 @@ public class FPPConfig implements ConfigData { public void setFootprintSize(int footprintSize) {this.footprintSize = footprintSize;} public void setCustomPrint(List customPrint) {this.customPrint = customPrint;} public void setHardnessGate(float gate) {this.hardnessGate = gate;} + public void setLifeTimeAcc(int lifeTimeAcc) {this.lifeTimeAcc = lifeTimeAcc;} } diff --git a/common/src/main/java/com/rimo/footprintparticle/mixin/LivingEntityMixin.java b/common/src/main/java/com/rimo/footprintparticle/mixin/LivingEntityMixin.java index fffe48f0..5490454c 100644 --- a/common/src/main/java/com/rimo/footprintparticle/mixin/LivingEntityMixin.java +++ b/common/src/main/java/com/rimo/footprintparticle/mixin/LivingEntityMixin.java @@ -21,6 +21,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static com.rimo.footprintparticle.FPPClient.CONFIG; + @Mixin(LivingEntity.class) public abstract class LivingEntityMixin extends Entity { public LivingEntityMixin(EntityType type, World world) { @@ -32,7 +34,7 @@ public LivingEntityMixin(EntityType type, World world) { @Unique private boolean fpp$wasOnGround = true; @Unique - private int fpp$wetTimer = FPPClient.CONFIG.getWetDuration() * 20; + private int fpp$wetTimer = CONFIG.getWetDuration() * 20; @Inject(method = "jump", at = @At("TAIL")) protected void jump(CallbackInfo ci) { @@ -56,14 +58,14 @@ public void tick(CallbackInfo ci) { if (this.isTouchingWaterOrRain()) { fpp$wetTimer = 0; - } else if (fpp$wetTimer <= FPPClient.CONFIG.getWetDuration() * 20){ + } else if (fpp$wetTimer <= CONFIG.getWetDuration() * 20){ fpp$wetTimer++; } // Swim Pop if (this.isSwimming() && - (FPPClient.CONFIG.getSwimPopLevel() == 2 || - (FPPClient.CONFIG.getSwimPopLevel() == 1 && this.isPlayer()))) { + (CONFIG.getSwimPopLevel() == 2 || + (CONFIG.getSwimPopLevel() == 1 && this.isPlayer()))) { float range = Util.getEntityScale((LivingEntity) (Object) this); this.getWorld().addParticle( ParticleTypes.BUBBLE, @@ -79,17 +81,17 @@ public void tick(CallbackInfo ci) { @Unique public void fpp$footprintGenerator() { - if (FPPClient.CONFIG.isEnable() == 0 || - (FPPClient.CONFIG.isEnable() == 1 && !this.isPlayer())) + if (CONFIG.isEnable() == 0 || + (CONFIG.isEnable() == 1 && !this.isPlayer())) return; - if (FPPClient.CONFIG.getExcludedMobs().contains(EntityType.getId(this.getType()).toString())) + if (CONFIG.getExcludedMobs().contains(EntityType.getId(this.getType()).toString())) return; - if (!FPPClient.CONFIG.getCanGenWhenInvisible() && this.isInvisible()) + if (! CONFIG.getCanGenWhenInvisible() && this.isInvisible()) return; // Set Interval - fpp$timer = this.isSprinting() ? (int) (FPPClient.CONFIG.getSecPerPrint() * 13.33f) : (int) (FPPClient.CONFIG.getSecPerPrint() * 20); - for (String stream : FPPClient.CONFIG.getMobInterval()) { + fpp$timer = this.isSprinting() ? (int) (CONFIG.getSecPerPrint() * 13.33f) : (int) (CONFIG.getSecPerPrint() * 20); + for (String stream : CONFIG.getMobInterval()) { String[] str = stream.split(","); if (str[0].equals(EntityType.getId(this.getType()).toString())) { try { @@ -103,7 +105,7 @@ public void tick(CallbackInfo ci) { // Fix pos... var px = this.getX(); - var py = this.getY() + 0.01f + FPPClient.CONFIG.getPrintHeight(); + var py = this.getY() + 0.01f + CONFIG.getPrintHeight(); var pz = this.getZ(); var scale = Util.getEntityScale((LivingEntity) (Object) this); @@ -111,7 +113,7 @@ public void tick(CallbackInfo ci) { // Front and back var side = Math.random() > 0.5f ? 1 : -1; var hOffset = 0.0625f; - for (String stream : FPPClient.CONFIG.getHorseLikeMobs()) { + for (String stream : CONFIG.getHorseLikeMobs()) { String[] str = stream.split(","); if (str[0].equals(EntityType.getId(this.getType()).toString())) { hOffset = 0.75f; @@ -130,7 +132,7 @@ public void tick(CallbackInfo ci) { // Left and right side = Math.random() > 0.5f ? 1 : -1; hOffset = 0.125f; - for (String stream : FPPClient.CONFIG.getSpiderLikeMobs()) { + for (String stream : CONFIG.getSpiderLikeMobs()) { String[] str = stream.split(","); if (str[0].equals(EntityType.getId(this.getType()).toString())) { hOffset = 0.9f; @@ -156,7 +158,7 @@ public void tick(CallbackInfo ci) { // Fix height by blocks if in... try { var block = this.getWorld().getBlockState(pos); - for (String str : FPPClient.CONFIG.getBlockHeight()) { + for (String str : CONFIG.getBlockHeight()) { String[] str2 = str.split(","); if (str2[0].charAt(0) == '#') { for (TagKey tag : block.streamTags().toList()) { @@ -173,8 +175,8 @@ public void tick(CallbackInfo ci) { // Snow Dust if (block.isOf(Blocks.SNOW) && - (FPPClient.CONFIG.getSnowDustLevel() == 2 || - (FPPClient.CONFIG.getSnowDustLevel() == 1 && this.isPlayer()))) { + (CONFIG.getSnowDustLevel() == 2 || + (CONFIG.getSnowDustLevel() == 1 && this.isPlayer()))) { int i = this.isSprinting() ? 4 : 2; int v = this.isSprinting() ? 3 : 10; while (--i >= 0) { @@ -204,17 +206,17 @@ public void tick(CallbackInfo ci) { if (canGen) { // footprint FootprintParticleType footprint = FPPClient.FOOTPRINT.get(); this.getWorld().addParticle(footprint.setData((LivingEntity) (Object) this), px, py, pz, dx, 0, dz); - } else if (fpp$wetTimer <= FPPClient.CONFIG.getWetDuration() * 20) { // waterprint (gen when footprint not gen) + } else if (fpp$wetTimer <= CONFIG.getWetDuration() * 20) { // waterprint (gen when footprint not gen) WatermarkParticleType watermark = FPPClient.WATERMARK.get(); var i = Math.random() > 0.5f ? 1 : -1; this.getWorld().addParticle(watermark.setData((LivingEntity) (Object) this), px, py, pz, dx * i, fpp$wetTimer, dz * i); // push timer to calc alpha } // water splash (gen whatever print gen) - if (fpp$wetTimer <= FPPClient.CONFIG.getWetDuration() * 20 && - (FPPClient.CONFIG.getWaterSplashLevel() == 2 || - (FPPClient.CONFIG.getWaterSplashLevel() == 1 && this.isPlayer()))) { + if (fpp$wetTimer <= CONFIG.getWetDuration() * 20 && + (CONFIG.getWaterSplashLevel() == 2 || + (CONFIG.getWaterSplashLevel() == 1 && this.isPlayer()))) { float range = Util.getEntityScale((LivingEntity) (Object) this); - int i = (int)((this.isSprinting() ? 18 : 10) * Math.max((0.7f - (float) fpp$wetTimer / (FPPClient.CONFIG.getWetDuration() * 20)), 0)); + int i = (int)((this.isSprinting() ? 18 : 10) * Math.max((0.7f - (float) fpp$wetTimer / (CONFIG.getWetDuration() * 20)), 0)); int v = this.isSprinting() ? 3 : 6; while (--i > 0) { this.getWorld().addParticle( @@ -233,21 +235,21 @@ public void tick(CallbackInfo ci) { @Unique private boolean fpp$isPrintCanGen(BlockPos pos) { var block = this.getWorld().getBlockState(pos); - var canGen = FPPClient.CONFIG.getApplyBlocks().contains(block.getBlock().getRegistryEntry().getKey().get().getValue().toString()); + var canGen = CONFIG.getApplyBlocks().contains(block.getBlock().getRegistryEntry().getKey().get().getValue().toString()); if (!canGen) { for (TagKey tag : block.streamTags().toList()) { - canGen = FPPClient.CONFIG.getApplyBlocks().contains("#" + tag.id().toString()); + canGen = CONFIG.getApplyBlocks().contains("#" + tag.id().toString()); if (canGen) break; } if (!canGen) { // Hardness Filter. See on https://minecraft.fandom.com/wiki/Breaking#Blocks_by_hardness - canGen = MathHelper.abs(block.getBlock().getHardness()) < FPPClient.CONFIG.getHardnessGate(); + canGen = CONFIG.getLifeTimeAcc() > 0 && MathHelper.abs(block.getBlock().getHardness()) < CONFIG.getHardnessGate(); if (canGen) { - canGen = !FPPClient.CONFIG.getExcludedBlocks().contains(block.getBlock().getRegistryEntry().getKey().get().getValue().toString()); + canGen = ! CONFIG.getExcludedBlocks().contains(block.getBlock().getRegistryEntry().getKey().get().getValue().toString()); if (canGen) { for (TagKey tag : block.streamTags().toList()) { - canGen = !FPPClient.CONFIG.getExcludedBlocks().contains("#" + tag.id().toString()); + canGen = ! CONFIG.getExcludedBlocks().contains("#" + tag.id().toString()); if (!canGen) break; } diff --git a/common/src/main/java/com/rimo/footprintparticle/particle/FootprintParticle.java b/common/src/main/java/com/rimo/footprintparticle/particle/FootprintParticle.java index 404ea801..7f535fe4 100644 --- a/common/src/main/java/com/rimo/footprintparticle/particle/FootprintParticle.java +++ b/common/src/main/java/com/rimo/footprintparticle/particle/FootprintParticle.java @@ -12,14 +12,17 @@ import net.minecraft.entity.EntityType; import net.minecraft.particle.DefaultParticleType; import net.minecraft.util.math.*; +import net.minecraft.world.Heightmap; import java.util.List; public class FootprintParticle extends SpriteBillboardParticle { protected float startAlpha; + private final BlockPos pos; protected FootprintParticle(ClientWorld clientWorld, double x, double y, double z, double vx, double vy, double vz, SpriteProvider spriteProvider, FootprintParticleType parameters, String defName) { super(clientWorld, x, y, z, vx, vy, vz); + pos = new BlockPos(MathHelper.floor(this.x), MathHelper.floor(this.y - 0.02f), MathHelper.floor(this.z)); this.setVelocity(0, 0, 0); this.setAlpha(FPPClient.CONFIG.getFootprintAlpha()); @@ -57,7 +60,10 @@ public void tick() { if (this.age > this.maxAge / 2) this.alpha -= this.startAlpha / this.maxAge * 2; - if (this.age++ >= this.maxAge || this.world.isAir(new BlockPos(MathHelper.floor(this.x), MathHelper.floor(this.y - 0.02f), MathHelper.floor(this.z)))) + if (this.world.isRaining() && this.world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, pos).getY() <= this.y) + this.age += FPPClient.CONFIG.getLifeTimeAcc(); + + if (this.age++ >= this.maxAge || this.world.isAir(pos)) this.markDead(); } diff --git a/common/src/main/resources/assets/footprintparticle/lang/en_us.json b/common/src/main/resources/assets/footprintparticle/lang/en_us.json index 3ae5ad71..9b12ad3e 100644 --- a/common/src/main/resources/assets/footprintparticle/lang/en_us.json +++ b/common/src/main/resources/assets/footprintparticle/lang/en_us.json @@ -43,5 +43,7 @@ "text.footprintparticle.option.customPrint": "Custom Print Texture", "text.footprintparticle.option.customPrint.@Tooltip": "Set a specific texture for a specific mob.\nFormat: §9§omodid:mobid,fileName1,fileName2,...§r\n§5file§r must be a PNG and located at\n§oassets/footprintparticle/textures/particle§r\nin your resourcepack.\nMeanwhile, you need to register it at\n§oassets/footprintparticle/particles/footprint.json§r or\n§oassets/footprintparticle/particles/watermark.json§r\nif you want to replace watermark at same time.\nMore see in wiki.", "text.footprintparticle.option.hardnessGate": "Hardness Gate", - "text.footprintparticle.option.hardnessGate.@Tooltip": "Block which hardness smaller than gate will gen print.\nYou can set 0 to disable all blocks (whitelist), or 999 to allow all blocks (blacklist)\nDefault is 0.7" + "text.footprintparticle.option.hardnessGate.@Tooltip": "Block which hardness smaller than gate will gen print.\nYou can set 0 to disable all blocks (whitelist), or 999 to allow all blocks (blacklist)\nDefault is 0.7", + "text.footprintparticle.option.lifeTimeAcc": "Lifetime reduce when Rain", + "text.footprintparticle.option.lifeTimeAcc.@Tooltip": "How fast do particles disappear during rain compared to normal" } diff --git a/common/src/main/resources/assets/footprintparticle/lang/zh_cn.json b/common/src/main/resources/assets/footprintparticle/lang/zh_cn.json index 506c4c9d..cf505960 100644 --- a/common/src/main/resources/assets/footprintparticle/lang/zh_cn.json +++ b/common/src/main/resources/assets/footprintparticle/lang/zh_cn.json @@ -44,6 +44,8 @@ "text.footprintparticle.option.customPrint.@Tooltip": "为特定生物设置特定的脚印纹理。\n格式: §9§omodid:mobid,fileName1,fileName2,...§r\n§5file§r必须是一张PNG图片且放置于资源包中的\n§oassets/footprintparticle/textures/particle§r下。\n同时,你需要在\n§oassets/footprintparticle/particles/footprint.json§r或\n§oassets/footprintparticle/particles/watermark.json§r\n中注册你的纹理。\n更多信息请查阅wiki。", "text.footprintparticle.option.hardnessGate": "方块硬度门限", "text.footprintparticle.option.hardnessGate.@Tooltip": "硬度小于该值的方块将生成脚印。\n你可以将该值设为0来禁用所有方块,或者设为999来启用所有方块\n默认值为0.7", + "text.footprintparticle.option.lifeTimeAcc": "下雨时时间缩短", + "text.footprintparticle.option.lifeTimeAcc.@Tooltip": "下雨时粒子的消失速度会比正常快多少", "modmenu.descriptionTranslation.footprintparticle": "一个简单地为生物和玩家添加脚印粒子的模组。" } diff --git a/fabric/build.gradle b/fabric/build.gradle index 0083db31..4a2e2956 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" + id "com.github.johnrengelman.shadow" version "8.1.1" } architectury { @@ -53,18 +53,18 @@ shadowJar { exclude "architectury.common.json" configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set "dev-shadow" } remapJar { injectAccessWidener = true input.set shadowJar.archiveFile dependsOn shadowJar - classifier "fabric" + archiveClassifier.set "fabric" } jar { - classifier "dev" + archiveClassifier.set "dev" } sourcesJar { diff --git a/forge/build.gradle b/forge/build.gradle index 57a03a58..cdc15538 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" + id "com.github.johnrengelman.shadow" version "8.1.1" } architectury { @@ -51,17 +51,17 @@ shadowJar { exclude "architectury.common.json" configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set "dev-shadow" } remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "forge" + archiveClassifier.set "forge" } jar { - classifier "dev" + archiveClassifier.set "dev" } sourcesJar { diff --git a/gradle.properties b/gradle.properties index 7e20de28..e1523a2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,12 +4,12 @@ minecraft_version=1.18.2 enabled_platforms=fabric,forge archives_base_name=footprintparticle -mod_version=0.5.3-mc1.18.2 +mod_version=0.5.4-mc1.18.2 maven_group=com.rimo -architectury_version=4.11.93 -cloth_config_version=6.4.90 -pehkui_version=3.7.8 +architectury_version=4.12.94 +cloth_config_version=6.5.133 +pehkui_version=3.8.3 fabric_loader_version=0.14.11 fabric_api_version=0.67.1+1.18.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb879..0d184210 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 952539eb88efe67e4e27ff79d1f8080ac269b7b1 Mon Sep 17 00:00:00 2001 From: Rimo <113169310+Rivmun@users.noreply.github.com> Date: Thu, 7 Aug 2025 14:34:34 +0800 Subject: [PATCH 2/2] Create gradle.yml --- .github/workflows/gradle.yml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 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 00000000..a298372d --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,40 @@ +# Automatically build the project and run any configured tests for every push +# and submitted pull request. This can help catch issues that only occur on +# certain platforms or Java versions, and provides a first line of defence +# against bad commits. + +name: build +on: [pull_request, push] + +jobs: + build: + strategy: + matrix: + # Use these Java versions + java: [ + 17, # Current Java LTS & minimum supported by Minecraft + ] + # and run on both Linux and Windows + os: [ubuntu-22.04, windows-2022] + runs-on: ${{ matrix.os }} + steps: + - name: checkout repository + uses: actions/checkout@v3 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'microsoft' + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: build + run: ./gradlew buildMod + - name: capture build artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS + uses: actions/upload-artifact@v4 + with: + name: Artifacts + path: build/libs/Merged