~williewillus/violet-moon

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH botania] Reintroduce useShaders option

Details
Message ID
<87wn12qdon.fsf@vincent-lee.net>
DKIM signature
missing
Download raw message
Patch: +61 -9
Shaders are still loaded for error-checking, but Botania shaders will be replaced with the
vanilla shader they were based on if useShaders is off.

Starfield is exempt since its whole effect relies on the shader.

diff --git a/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java b/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java
--- a/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java
+++ b/Fabric/src/main/java/vazkii/botania/fabric/FiberBotaniaConfig.java
@@ -86,9 +86,14 @@
		public final PropertyMirror<Boolean> debugInfo = PropertyMirror.create(BOOLEAN);
		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 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("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)
@@ -242,6 +247,11 @@
		public boolean splashesEnabled() {
			return splashesEnabled.getValue();
		}

		@Override
		public boolean useShaders() {
			return this.useShaders.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
--- a/Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java
+++ b/Forge/src/main/java/vazkii/botania/forge/ForgeBotaniaConfig.java
@@ -193,6 +193,11 @@
		public boolean splashesEnabled() {
			return splashesEnabled.get();
		}

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

	public static final Client CLIENT;
diff --git a/Xplat/src/main/java/vazkii/botania/client/core/helper/CoreShaders.java b/Xplat/src/main/java/vazkii/botania/client/core/helper/CoreShaders.java
--- a/Xplat/src/main/java/vazkii/botania/client/core/helper/CoreShaders.java
+++ b/Xplat/src/main/java/vazkii/botania/client/core/helper/CoreShaders.java
@@ -11,9 +11,12 @@
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.datafixers.util.Pair;

import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceManager;

import vazkii.botania.xplat.BotaniaConfig;

import java.io.IOException;
import java.util.function.Consumer;

@@ -69,38 +72,72 @@
	}

	public static ShaderInstance starfield() {
		// Intended to not respect useShaders config. The render kind of relies entirely
		// on the shader, like the end portal.
		return starfieldShaderInstance;
	}

	public static ShaderInstance doppleganger() {
		return doppleganger;
		if (BotaniaConfig.client().useShaders()) {
			return doppleganger;
		} else {
			return GameRenderer.getRendertypeEntityTranslucentShader();
		}
	}

	public static ShaderInstance manaPool() {
		return manaPool;
		if (BotaniaConfig.client().useShaders()) {
			return manaPool;
		} else {
			return GameRenderer.getPositionColorTexLightmapShader();
		}
	}

	public static ShaderInstance terraPlate() {
		return terraPlate;
		if (BotaniaConfig.client().useShaders()) {
			return terraPlate;
		} else {
			return GameRenderer.getPositionColorTexLightmapShader();
		}
	}

	public static ShaderInstance enchanter() {
		return enchanter;
		if (BotaniaConfig.client().useShaders()) {
			return enchanter;
		} else {
			return GameRenderer.getPositionColorTexLightmapShader();
		}
	}

	public static ShaderInstance pylon() {
		return pylon;
		if (BotaniaConfig.client().useShaders()) {
			return pylon;
		} else {
			return GameRenderer.getRendertypeEntityTranslucentShader();
		}
	}

	public static ShaderInstance halo() {
		return halo;
		if (BotaniaConfig.client().useShaders()) {
			return halo;
		} else {
			return GameRenderer.getPositionColorTexShader();
		}
	}

	public static ShaderInstance filmGrainParticle() {
		return filmGrainParticle;
		if (BotaniaConfig.client().useShaders()) {
			return filmGrainParticle;
		} else {
			return GameRenderer.getParticleShader();
		}
	}

	public static ShaderInstance dopplegangerBar() {
		return dopplegangerBar;
		if (BotaniaConfig.client().useShaders()) {
			return dopplegangerBar;
		} else {
			return GameRenderer.getPositionTexShader();
		}
	}
}
diff --git a/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java b/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java
--- a/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java
+++ b/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java
@@ -11,7 +11,6 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.CustomRecipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
diff --git a/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java b/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java
--- a/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java
+++ b/Xplat/src/main/java/vazkii/botania/xplat/BotaniaConfig.java
@@ -41,6 +41,7 @@
		boolean debugInfo();
		boolean referencesEnabled();
		boolean splashesEnabled();
		boolean useShaders();
	}

	private static ConfigAccess config = null;

[botania/patches/linux.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CSRTN6VMF2HP.36M4XNTFA867P@cirno2>
In-Reply-To
<87wn12qdon.fsf@vincent-lee.net> (view parent)
DKIM signature
missing
Download raw message
botania/patches/linux.yml: FAILED in 2m13s

[Reintroduce useShaders option][0] from [Vincent Lee][1]

[0]: https://lists.sr.ht/~williewillus/violet-moon/patches/41310
[1]: vincent@vincent-lee.net

✗ #993293 FAILED botania/patches/linux.yml https://builds.sr.ht/~williewillus/job/993293
Details
Message ID
<sdz7pzl2pismihioabmjxylreprzjlnu3hm7kb446rbbznvwev@phbr4xzfccpi>
In-Reply-To
<87wn12qdon.fsf@vincent-lee.net> (view parent)
DKIM signature
missing
Download raw message
See inline comment, looks like an unrelated change got in.
Otherwise lgtm

On Sun, May 21, 2023 at 01:39:55AM -0700, Vincent Lee wrote:
> diff --git a/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java b/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java
> --- a/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java
> +++ b/Xplat/src/main/java/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java
> @@ -11,7 +11,6 @@
>  import net.minecraft.resources.ResourceLocation;
>  import net.minecraft.world.inventory.CraftingContainer;
>  import net.minecraft.world.item.ItemStack;
> -import net.minecraft.world.item.Items;

Stray spotless fix that belonged in another commit?
Reply to thread Export thread (mbox)