Skip to content

Commit

Permalink
Implemented for fabric, and created seperate config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
blagdorfinguy committed Dec 29, 2023
1 parent e08c015 commit 4a7e873
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
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
13 changes: 12 additions & 1 deletion 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 @@ -52,8 +53,11 @@ private static class Client implements BotaniaConfig.ClientConfigAccess {
public Client(ForgeConfigSpec.Builder builder) {
builder.push("rendering");
useShaders = builder
.comment("Set this to false to disable the use of shaders for some of the mod's renders and render translucent particles as opaque, for shader compatibility with some shaders which implement a deferred lighting pass. (Requires game restart, and enabling without shaders may impact aesthetics)")
.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
4 changes: 2 additions & 2 deletions Xplat/src/main/java/vazkii/botania/client/fx/FXSparkle.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ private static void beginRenderCommon(BufferBuilder buffer, TextureManager textu
Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer();
RenderSystem.enableDepthTest();

if (!BotaniaConfig.client().useShaders()) { //Shader compatibility mode enabled
if (BotaniaConfig.client().opaqueParticles()) {
RenderSystem.disableBlend();
RenderSystem.depthMask(true);
RenderSystem.setShader(GameRenderer::getParticleShader);
} else { //Shader compatibility mode disabled
} else {
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
Expand Down
4 changes: 2 additions & 2 deletions Xplat/src/main/java/vazkii/botania/client/fx/FXWisp.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ public void setGravity(float value) {

private static void beginRenderCommon(BufferBuilder bufferBuilder, TextureManager textureManager) {
Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer();
if (!BotaniaConfig.client().useShaders()) { //Shader compatibility mode enabled
if (BotaniaConfig.client().opaqueParticles()) {
RenderSystem.disableBlend();
RenderSystem.depthMask(true);
RenderSystem.setShader(GameRenderer::getParticleShader);
} else { //Shader compatibility mode disabled
} else {
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
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

0 comments on commit 4a7e873

Please sign in to comment.