diff --git a/common/src/main/java/net/irisshaders/iris/NeoLambdas.java b/common/src/main/java/net/irisshaders/iris/NeoLambdas.java index 609c1cea43..1e7bf2c23b 100644 --- a/common/src/main/java/net/irisshaders/iris/NeoLambdas.java +++ b/common/src/main/java/net/irisshaders/iris/NeoLambdas.java @@ -6,4 +6,5 @@ public class NeoLambdas { public static final String NEO_RENDER_WEATHER = "lambda$addWeatherPass$5"; public static final String NEO_RENDER_CLOUDS = "lambda$addCloudsPass$4"; public static final String NEO_PARTICLE = "lambda$static$26"; + public static final String NEO_WEATHER_TYPE = "lambda$createWeather$35"; } diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderType.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderType.java index eb4aafcdaa..41a72b6919 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderType.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderType.java @@ -13,9 +13,15 @@ public class MixinRenderType { @Unique private static final RenderStateShard.ShaderStateShard TRANSLUCENT_PARTICLE_SHADER = new RenderStateShard.ShaderStateShard(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER); + private static final RenderStateShard.ShaderStateShard WEATHER_SHADER = new RenderStateShard.ShaderStateShard(ShaderAccess.WEATHER_SHADER); @Redirect(method = {"method_65225", NeoLambdas.NEO_PARTICLE }, require = 1, at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderType;PARTICLE_SHADER:Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;")) private static RenderStateShard.ShaderStateShard getTranslucentParticleShader() { return TRANSLUCENT_PARTICLE_SHADER; } + + @Redirect(method = {"method_65228", NeoLambdas.NEO_WEATHER_TYPE }, require = 1, at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderType;PARTICLE_SHADER:Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;")) + private static RenderStateShard.ShaderStateShard getWeatherShader() { + return WEATHER_SHADER; + } } diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinShaderManager_Overrides.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinShaderManager_Overrides.java index 662d061684..053326288b 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinShaderManager_Overrides.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinShaderManager_Overrides.java @@ -50,8 +50,9 @@ public abstract class MixinShaderManager_Overrides { coreShaderMap.put(CoreShaders.POSITION_TEX, p -> ShaderOverrides.getSkyTexShader((IrisRenderingPipeline) p)); coreShaderMap.put(CoreShaders.POSITION_TEX_COLOR, p -> ShaderOverrides.getSkyTexColorShader((IrisRenderingPipeline) p)); coreShaderMap.put(CoreShaders.POSITION_COLOR, p -> ShaderOverrides.getSkyColorShader((IrisRenderingPipeline) p)); - coreShaderMap.put(CoreShaders.PARTICLE, p -> ShaderOverrides.isPhase((IrisRenderingPipeline) p, WorldRenderingPhase.RAIN_SNOW) ? ShaderKey.WEATHER : ShaderKey.PARTICLES); - coreShaderMap.put(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER, p -> ShaderOverrides.isPhase((IrisRenderingPipeline) p, WorldRenderingPhase.RAIN_SNOW) ? ShaderKey.WEATHER : ShaderKey.PARTICLES_TRANS); + coreShaderMap.put(CoreShaders.PARTICLE, p -> ShaderKey.PARTICLES); + coreShaderMap.put(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER, p -> ShaderKey.PARTICLES_TRANS); + coreShaderMap.put(ShaderAccess.WEATHER_SHADER, p -> ShaderKey.WEATHER); coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT, p -> getCutout(p)); coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_SOLID, p -> getSolid(p)); coreShaderMap.put(CoreShaders.RENDERTYPE_ARMOR_CUTOUT_NO_CULL, p -> getCutout(p)); @@ -102,6 +103,7 @@ public abstract class MixinShaderManager_Overrides { coreShaderMapShadow.put(CoreShaders.POSITION_COLOR, p -> ShaderKey.SHADOW_BASIC_COLOR); coreShaderMapShadow.put(CoreShaders.PARTICLE, p -> ShaderKey.SHADOW_PARTICLES); coreShaderMapShadow.put(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER, p -> ShaderKey.SHADOW_PARTICLES); + coreShaderMapShadow.put(ShaderAccess.WEATHER_SHADER, p -> ShaderKey.SHADOW_PARTICLES); coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT); coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_SOLID, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT); coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ARMOR_CUTOUT_NO_CULL, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT); @@ -223,6 +225,8 @@ private void redirectIrisProgram(ShaderProgram shaderProgram, CallbackInfoReturn // TODO when IE updates } else if (shaderProgram == ShaderAccess.TRANSLUCENT_PARTICLE_SHADER) { cir.setReturnValue(getProgram(CoreShaders.PARTICLE)); + } else if (shaderProgram == ShaderAccess.WEATHER_SHADER) { + cir.setReturnValue(getProgram(CoreShaders.PARTICLE)); } } } diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderAccess.java b/common/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderAccess.java index 6f31c25b63..cda203f766 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderAccess.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderAccess.java @@ -24,6 +24,7 @@ public class ShaderAccess { .padding(1) .build(); public static final ShaderProgram TRANSLUCENT_PARTICLE_SHADER = new ShaderProgram(ResourceLocation.fromNamespaceAndPath("iris", "translucent_particle"), DefaultVertexFormat.PARTICLE, ShaderDefines.EMPTY); + public static final ShaderProgram WEATHER_SHADER = new ShaderProgram(ResourceLocation.fromNamespaceAndPath("iris", "weather"), DefaultVertexFormat.PARTICLE, ShaderDefines.EMPTY); public static CompiledShaderProgram getParticleTranslucentShader() { WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable(); diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 61b8a1b760..96d30c2fd7 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -64,7 +64,7 @@ dependencies { addRuntimeFabricModule("fabric-rendering-fluids-v1") addRuntimeFabricModule("fabric-resource-loader-v0") - modImplementation("maven.modrinth", "sodium", "mc1.21.4-0.6.2-fabric") + modImplementation("maven.modrinth", "sodium", "mc1.21.4-0.6.3-fabric") implementAndInclude("org.antlr:antlr4-runtime:4.13.1") implementAndInclude("io.github.douira:glsl-transformer:2.0.1") implementAndInclude("org.anarres:jcpp:1.4.14")