diff --git a/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java b/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java index 2f447d77e0..1836feec21 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java @@ -87,6 +87,7 @@ private static class Client implements BotaniaConfig.ClientConfigAccess { public final PropertyMirror referencesEnabled = PropertyMirror.create(BOOLEAN); public final PropertyMirror splashesEnabled = PropertyMirror.create(BOOLEAN); public final PropertyMirror useShaders = PropertyMirror.create(BOOLEAN); + public final PropertyMirror opaqueParticles = PropertyMirror.create(BOOLEAN); public ConfigTree configure(ConfigTreeBuilder builder) { builder.fork("rendering") @@ -94,6 +95,10 @@ public ConfigTree configure(ConfigTreeBuilder builder) { .withComment("Set this to false to disable the use of shaders for some of the mod's renders. (Requires game restart)") .finishValue(useShaders::mirror) + .beginValue("opaqueParticles", BOOLEAN, false) + .withComment("Set this to true to disable translucent particles, for shader compatibility with some shaders which implement a deferred lighting pass. (Enabling without shaders may impact aesthetics)") + .finishValue(opaqueParticles::mirror) + .beginValue("boundBlockWireframe", BOOLEAN, true) .withComment("Set this to false to disable the wireframe when looking a block bound to something (spreaders, flowers, etc).") .finishValue(boundBlockWireframe::mirror) @@ -252,6 +257,12 @@ public boolean splashesEnabled() { public boolean useShaders() { return this.useShaders.getValue(); } + + @Override + public boolean opaqueParticles() { + return this.opaqueParticles.getValue(); + } + } private static final Client CLIENT = new Client(); diff --git a/Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java b/Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java index 38ceacfcbb..c25efed991 100644 --- a/Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java +++ b/Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java @@ -30,6 +30,7 @@ public final class ForgeBotaniaConfig { private static class Client implements BotaniaConfig.ClientConfigAccess { public final ForgeConfigSpec.BooleanValue useShaders; + public final ForgeConfigSpec.BooleanValue opaqueParticles; public final ForgeConfigSpec.BooleanValue lexiconRotatingItems; public final ForgeConfigSpec.BooleanValue subtlePowerSystem; public final ForgeConfigSpec.BooleanValue staticWandBeam; @@ -54,6 +55,9 @@ public Client(ForgeConfigSpec.Builder builder) { useShaders = builder .comment("Set this to false to disable the use of shaders for some of the mod's renders. (Requires game restart)") .define("shaders", true); + opaqueParticles = builder + .comment("Set this to true to disable translucent particles, for shader compatibility with some shaders which implement a deferred lighting pass. (Enabling without shaders may impact aesthetics)") + .define("opaqueParticles", false); boundBlockWireframe = builder .comment("Set this to false to disable the wireframe when looking a block bound to something (spreaders, flowers, etc).") .define("boundBlockWireframe", true); @@ -198,6 +202,13 @@ public boolean splashesEnabled() { public boolean useShaders() { return this.useShaders.get(); } + + @Override + public boolean opaqueParticles() { + return this.opaqueParticles.get(); + } + + } public static final Client CLIENT; diff --git a/Xplat/src/main/java/vazkii/botania/client/fx/FXSparkle.java b/Xplat/src/main/java/vazkii/botania/client/fx/FXSparkle.java index 4adec4f3f4..97232ffe37 100644 --- a/Xplat/src/main/java/vazkii/botania/client/fx/FXSparkle.java +++ b/Xplat/src/main/java/vazkii/botania/client/fx/FXSparkle.java @@ -19,6 +19,7 @@ import net.minecraft.client.particle.ParticleRenderType; import net.minecraft.client.particle.SpriteSet; import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; @@ -30,6 +31,7 @@ import org.lwjgl.opengl.GL11; import vazkii.botania.client.core.helper.CoreShaders; +import vazkii.botania.xplat.BotaniaConfig; import vazkii.botania.xplat.ClientXplatAbstractions; public class FXSparkle extends TextureSheetParticle { @@ -156,13 +158,23 @@ private void wiggleAround(double x, double y, double z) { private static void beginRenderCommon(BufferBuilder buffer, TextureManager textureManager) { Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer(); RenderSystem.enableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + + if (BotaniaConfig.client().opaqueParticles()) { + RenderSystem.disableBlend(); + RenderSystem.depthMask(true); + RenderSystem.setShader(GameRenderer::getParticleShader); + } else { + RenderSystem.depthMask(false); + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.7f); + } + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); AbstractTexture tex = textureManager.getTexture(TextureAtlas.LOCATION_PARTICLES); ClientXplatAbstractions.INSTANCE.setFilterSave(tex, true, false); buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); + } private static void endRenderCommon() { diff --git a/Xplat/src/main/java/vazkii/botania/client/fx/FXWisp.java b/Xplat/src/main/java/vazkii/botania/client/fx/FXWisp.java index 8cb3768d47..4fb3836b53 100644 --- a/Xplat/src/main/java/vazkii/botania/client/fx/FXWisp.java +++ b/Xplat/src/main/java/vazkii/botania/client/fx/FXWisp.java @@ -18,6 +18,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.ParticleRenderType; import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; @@ -25,6 +26,7 @@ import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL11; +import vazkii.botania.xplat.BotaniaConfig; import vazkii.botania.xplat.ClientXplatAbstractions; public class FXWisp extends TextureSheetParticle { @@ -104,14 +106,22 @@ public void setGravity(float value) { private static void beginRenderCommon(BufferBuilder bufferBuilder, TextureManager textureManager) { Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer(); - RenderSystem.depthMask(false); - RenderSystem.enableBlend(); - RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + if (BotaniaConfig.client().opaqueParticles()) { + RenderSystem.disableBlend(); + RenderSystem.depthMask(true); + RenderSystem.setShader(GameRenderer::getParticleShader); + } else { + RenderSystem.depthMask(false); + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.7f); + } RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); AbstractTexture tex = textureManager.getTexture(TextureAtlas.LOCATION_PARTICLES); ClientXplatAbstractions.INSTANCE.setFilterSave(tex, true, false); bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); + } private static void endRenderCommon() { diff --git a/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java b/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java index 1cbfdbcfae..cfee0d30df 100644 --- a/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java +++ b/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java @@ -42,6 +42,7 @@ public interface ClientConfigAccess { boolean referencesEnabled(); boolean splashesEnabled(); boolean useShaders(); + boolean opaqueParticles(); } private static ConfigAccess config = null;