From 5ce754f07c241b25154a13c4074cbf9a56c40ccf Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Jul 2024 14:23:37 -0700 Subject: [PATCH] Disable Rain Particles --- README.md | 1 + .../config/UTConfigTweaks.java | 5 ++++ .../universaltweaks/core/UTLoadingPlugin.java | 1 + .../mixin/UTEntityRendererMixin.java | 30 +++++++++++++++++++ ...ins.tweaks.performance.weathereffects.json | 7 +++++ 5 files changed, 44 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/performance/weathereffects/mixin/UTEntityRendererMixin.java create mode 100644 src/main/resources/mixins.tweaks.performance.weathereffects.json diff --git a/README.md b/README.md index ae55f1e8..4e3cdd1d 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ All changes are toggleable via config files. * **Disable Hotbar Scroll Wrapping:** Disables using the scroll wheel to change hotbar slots wrapping * **Disable Mob Spawner Entity Render:** Disables rendering an entity inside of Mob Spawners * **Disable Narrator:** Disables the narrator functionality entirely +* **Disable Rain Particles:** Prevents Rain and Snow Particles from rendering when Raining or Thundering * **Disable Glint Overlay on Enchantment Books:** Disables the glint overlay on enchantment books * **Disable Glint Overlay on Potions:** Disables the glint overlay on potions * **Disable Sleeping:** Disables skipping night by using a bed while making it still able to set spawn diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 306ad247..bce25ea6 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -2045,6 +2045,11 @@ public static class PerformanceCategory @Config.Comment("Improves rendering performance by disabling rendering the entity inside mob spawners") public boolean utDisableMobSpawnerRendering = false; + @Config.RequiresMcRestart + @Config.Name("Disable Rain Particles") + @Config.Comment("Prevents Rain and Snow Particles from rendering when Raining or Thundering") + public boolean utDisableRainParticles = false; + @Config.RequiresMcRestart @Config.Name("Faster Background Startup") @Config.Comment("Fixes slow background startup edge case caused by checking tooltips during the loading process") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index d600f208..5275d58f 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -218,6 +218,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.performance.mobspawnerrender.json", () -> UTConfigTweaks.PERFORMANCE.utDisableMobSpawnerRendering); put("mixins.tweaks.performance.resourcemanager.json", () -> UTConfigTweaks.PERFORMANCE.utCheckAnimatedModelsToggle); put("mixins.tweaks.performance.texturemapcheck.json", () -> UTConfigTweaks.PERFORMANCE.utTextureMapCheckToggle); + put("mixins.tweaks.performance.weathereffects.json", () -> UTConfigTweaks.PERFORMANCE.utDisableRainParticles); put("mixins.tweaks.world.loading.client.json", () -> UTConfigTweaks.PERFORMANCE.utWorldLoadingToggle); put("mixins.tweaks.world.voidfog.json", () -> UTConfigTweaks.WORLD.VOID_FOG.utVoidFogToggle); } diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/weathereffects/mixin/UTEntityRendererMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/weathereffects/mixin/UTEntityRendererMixin.java new file mode 100644 index 00000000..42041d24 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/weathereffects/mixin/UTEntityRendererMixin.java @@ -0,0 +1,30 @@ +package mod.acgaming.universaltweaks.tweaks.performance.weathereffects.mixin; + +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.util.EnumParticleTypes; + +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +@Mixin(EntityRenderer.class) +public abstract class UTEntityRendererMixin +{ + @WrapWithCondition(method = "addRainParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V")) + private boolean utDisableRainParticles(WorldClient world, EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters) + { + return !UTConfigTweaks.PERFORMANCE.utDisableRainParticles; + } + + @WrapOperation(method = "renderRainSnow", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;getRainStrength(F)F")) + private float utRemoveRainBounce(WorldClient world, float partialTicks, Operation original) + { + if (!UTConfigTweaks.PERFORMANCE.utDisableRainParticles) return original.call(world, partialTicks); + return 0f; + } +} diff --git a/src/main/resources/mixins.tweaks.performance.weathereffects.json b/src/main/resources/mixins.tweaks.performance.weathereffects.json new file mode 100644 index 00000000..a8d56812 --- /dev/null +++ b/src/main/resources/mixins.tweaks.performance.weathereffects.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.performance.weathereffects.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTEntityRendererMixin"] +} \ No newline at end of file