Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ private static class Client implements BotaniaConfig.ClientConfigAccess {
public final PropertyMirror<Boolean> referencesEnabled = PropertyMirror.create(BOOLEAN);
public final PropertyMirror<Boolean> splashesEnabled = PropertyMirror.create(BOOLEAN);
public final PropertyMirror<Boolean> useShaders = PropertyMirror.create(BOOLEAN);
public final PropertyMirror<Boolean> opaqueParticles = PropertyMirror.create(BOOLEAN);

public ConfigTree configure(ConfigTreeBuilder builder) {
builder.fork("rendering")
.beginValue("shaders", BOOLEAN, true)
.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)
Expand Down Expand Up @@ -252,6 +257,12 @@ public boolean splashesEnabled() {
public boolean useShaders() {
return this.useShaders.getValue();
}

@Override
public boolean opaqueParticles() {
return this.useShaders.getValue();
}

}

private static final Client CLIENT = new Client();
Expand Down
11 changes: 11 additions & 0 deletions Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 15 additions & 3 deletions Xplat/src/main/java/vazkii/botania/client/fx/FXSparkle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down
22 changes: 19 additions & 3 deletions Xplat/src/main/java/vazkii/botania/client/fx/FXWisp.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
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;

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 {
Expand Down Expand Up @@ -104,14 +106,28 @@ 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);

//---
// RenderSystem.disableBlend();
// RenderSystem.depthMask(true);
// RenderSystem.setShader(GameRenderer::getParticleShader);
// RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES);
// $$0.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
}

private static void endRenderCommon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public interface ClientConfigAccess {
boolean referencesEnabled();
boolean splashesEnabled();
boolean useShaders();
boolean opaqueParticles();
}

private static ConfigAccess config = null;
Expand Down