From a89756a7097479e277789f74bda68a7a2646da8e Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 5 Jan 2025 11:18:53 -0800 Subject: [PATCH] Nobody Else Shall Wonder - Allow materials to specify the cardinal lighting mode - Hard-code the cardinal lighting mode to be one of 3 - Off - Chunk - Entity (default) - This gives artists some control over how they want their models to appear in-game. Kryppers in particular noticed lighting discrepancies between a flywheel model and a block model - Remove "useLightDirections" config, command, and uniform - Remove "diffuse" flag from Material --- .../api/material/CardinalLightingMode.java | 24 ++++++++++++++++ .../flywheel/api/material/Material.java | 6 ++-- .../flywheel/backend/BackendConfig.java | 2 -- .../backend/engine/MaterialEncoder.java | 12 ++++---- .../backend/engine/uniform/LevelUniforms.java | 5 +--- .../flywheel/flywheel/internal/common.frag | 14 ++++------ .../flywheel/flywheel/internal/material.glsl | 6 +++- .../flywheel/internal/packed_material.glsl | 10 +++---- .../flywheel/internal/uniforms/level.glsl | 1 - .../flywheel/lib/material/SimpleMaterial.java | 25 ++++++++++------- docs/shader-api/material.glsl | 6 +++- .../flywheel/impl/FabricFlwConfig.java | 22 --------------- .../flywheel/impl/FlwCommands.java | 28 ------------------- .../flywheel/impl/FlwCommands.java | 23 --------------- .../flywheel/impl/ForgeFlwConfig.java | 9 ------ 15 files changed, 71 insertions(+), 122 deletions(-) create mode 100644 common/src/api/java/dev/engine_room/flywheel/api/material/CardinalLightingMode.java diff --git a/common/src/api/java/dev/engine_room/flywheel/api/material/CardinalLightingMode.java b/common/src/api/java/dev/engine_room/flywheel/api/material/CardinalLightingMode.java new file mode 100644 index 000000000..c55c82798 --- /dev/null +++ b/common/src/api/java/dev/engine_room/flywheel/api/material/CardinalLightingMode.java @@ -0,0 +1,24 @@ +package dev.engine_room.flywheel.api.material; + +public enum CardinalLightingMode { + /** + * No normal-based darkening will be applied. + */ + OFF, + + /** + * World-space normal based darkening will be applied. + * + *

This mode matches the appearance of chunk geometry. + */ + CHUNK, + + /** + * World-space normal based darkening will be applied in accordance to the "light directions" specified in RenderSystem. + * + *

This mode matches the appearance of entities. + * + * @see com.mojang.blaze3d.systems.RenderSystem#setShaderLights + */ + ENTITY, +} diff --git a/common/src/api/java/dev/engine_room/flywheel/api/material/Material.java b/common/src/api/java/dev/engine_room/flywheel/api/material/Material.java index f77e396e8..ae72a2fb3 100644 --- a/common/src/api/java/dev/engine_room/flywheel/api/material/Material.java +++ b/common/src/api/java/dev/engine_room/flywheel/api/material/Material.java @@ -47,9 +47,9 @@ public interface Material { boolean useLight(); /** - * Should this material be rendered with diffuse lighting? + * How should this material receive cardinal lighting? * - * @return {@code true} if this material should be rendered with diffuse lighting. + * @return The cardinal lighting mode. */ - boolean diffuse(); + CardinalLightingMode cardinalLightingMode(); } diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/BackendConfig.java b/common/src/backend/java/dev/engine_room/flywheel/backend/BackendConfig.java index c7632298e..b61b3bef5 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/BackendConfig.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/BackendConfig.java @@ -11,6 +11,4 @@ public interface BackendConfig { * @return The current light smoothness setting. */ LightSmoothness lightSmoothness(); - - boolean useLightDirections(); } diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/MaterialEncoder.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/MaterialEncoder.java index fc45d402e..52dab8ad2 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/MaterialEncoder.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/MaterialEncoder.java @@ -1,5 +1,6 @@ package dev.engine_room.flywheel.backend.engine; +import dev.engine_room.flywheel.api.material.CardinalLightingMode; import dev.engine_room.flywheel.api.material.DepthTest; import dev.engine_room.flywheel.api.material.Material; import dev.engine_room.flywheel.api.material.Transparency; @@ -19,7 +20,7 @@ public final class MaterialEncoder { private static final int WRITE_MASK_LENGTH = Mth.ceillog2(WriteMask.values().length); private static final int USE_OVERLAY_LENGTH = 1; private static final int USE_LIGHT_LENGTH = 1; - private static final int DIFFUSE_LENGTH = 1; + private static final int CARDINAL_LIGHTING_MODE_LENGTH = Mth.ceillog2(CardinalLightingMode.values().length); // The bit offset of each property private static final int BLUR_OFFSET = 0; @@ -31,7 +32,7 @@ public final class MaterialEncoder { private static final int WRITE_MASK_OFFSET = TRANSPARENCY_OFFSET + TRANSPARENCY_LENGTH; private static final int USE_OVERLAY_OFFSET = WRITE_MASK_OFFSET + WRITE_MASK_LENGTH; private static final int USE_LIGHT_OFFSET = USE_OVERLAY_OFFSET + USE_OVERLAY_LENGTH; - private static final int DIFFUSE_OFFSET = USE_LIGHT_OFFSET + USE_LIGHT_LENGTH; + private static final int CARDINAL_LIGHTING_MODE_OFFSET = USE_LIGHT_OFFSET + USE_LIGHT_LENGTH; // The bit mask for each property private static final int BLUR_MASK = bitMask(BLUR_LENGTH, BLUR_OFFSET); @@ -43,7 +44,7 @@ public final class MaterialEncoder { private static final int WRITE_MASK_MASK = bitMask(WRITE_MASK_LENGTH, WRITE_MASK_OFFSET); private static final int USE_OVERLAY_MASK = bitMask(USE_OVERLAY_LENGTH, USE_OVERLAY_OFFSET); private static final int USE_LIGHT_MASK = bitMask(USE_LIGHT_LENGTH, USE_LIGHT_OFFSET); - private static final int DIFFUSE_MASK = bitMask(DIFFUSE_LENGTH, DIFFUSE_OFFSET); + private static final int CARDINAL_LIGHTING_MODE_MASK = bitMask(CARDINAL_LIGHTING_MODE_LENGTH, CARDINAL_LIGHTING_MODE_OFFSET); private MaterialEncoder() { } @@ -59,7 +60,7 @@ public final class MaterialEncoder { } // Packed format: - // diffuse[1] | useLight[1] | useOverlay[1] | writeMask[2] | transparency[3] | depthTest[4] | polygonOffset[1] | backfaceCulling[1] | mipmap[1] | blur[1] + // cardinalLightingMode[2] | useLight[1] | useOverlay[1] | writeMask[2] | transparency[3] | depthTest[4] | polygonOffset[1] | backfaceCulling[1] | mipmap[1] | blur[1] public static int packProperties(Material material) { int bits = 0; @@ -72,7 +73,8 @@ public final class MaterialEncoder { bits |= (material.writeMask().ordinal() << WRITE_MASK_OFFSET) & WRITE_MASK_MASK; if (material.useOverlay()) bits |= USE_OVERLAY_MASK; if (material.useLight()) bits |= USE_LIGHT_MASK; - if (material.diffuse()) bits |= DIFFUSE_MASK; + bits |= (material.cardinalLightingMode() + .ordinal() << CARDINAL_LIGHTING_MODE_OFFSET) & CARDINAL_LIGHTING_MODE_MASK; return bits; } diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/LevelUniforms.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/LevelUniforms.java index 977fdd6f9..6dcdf7044 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/LevelUniforms.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/LevelUniforms.java @@ -3,14 +3,13 @@ package dev.engine_room.flywheel.backend.engine.uniform; import org.joml.Vector3f; import dev.engine_room.flywheel.api.RenderContext; -import dev.engine_room.flywheel.backend.BackendConfig; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; public final class LevelUniforms extends UniformWriter { - private static final int SIZE = 16 * 4 + 4 * 13; + private static final int SIZE = 16 * 4 + 4 * 12; static final UniformBuffer BUFFER = new UniformBuffer(Uniforms.LEVEL_INDEX, SIZE); public static final Vector3f LIGHT0_DIRECTION = new Vector3f(); @@ -55,8 +54,6 @@ public final class LevelUniforms extends UniformWriter { ptr = writeInt(ptr, level.effects().constantAmbientLight() ? 1 : 0); - ptr = writeInt(ptr, BackendConfig.INSTANCE.useLightDirections() ? 1 : 0); - // TODO: use defines for custom dimension ids int dimensionId; ResourceKey dimension = level.dimension(); diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag index 1037ec635..421370598 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag @@ -20,15 +20,13 @@ flat in uint _flw_instanceID; out vec4 _flw_outputColor; float _flw_diffuseFactor() { - if (flw_material.diffuse) { - if (flw_useLightDirections == 1u) { - return diffuseFromLightDirections(flw_vertexNormal); + if (flw_material.cardinalLightingMode == 2u) { + return diffuseFromLightDirections(flw_vertexNormal); + } else if (flw_material.cardinalLightingMode == 1u) { + if (flw_constantAmbientLight == 1u) { + return diffuseNether(flw_vertexNormal); } else { - if (flw_constantAmbientLight == 1u) { - return diffuseNether(flw_vertexNormal); - } else { - return diffuse(flw_vertexNormal); - } + return diffuse(flw_vertexNormal); } } else { return 1.; diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/material.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/material.glsl index 40af43e2f..990129b54 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/material.glsl +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/material.glsl @@ -19,6 +19,10 @@ const uint FLW_MAT_WRITE_MASK_COLOR_DEPTH = 0u; const uint FLW_MAT_WRITE_MASK_COLOR = 1u; const uint FLW_MAT_WRITE_MASK_DEPTH = 2u; +const uint FLW_MAT_CARDINAL_LIGHTING_MODE_OFF = 0u; +const uint FLW_MAT_CARDINAL_LIGHTING_MODE_CHUNK = 1u; +const uint FLW_MAT_CARDINAL_LIGHTING_MODE_ENTITY = 2u; + struct FlwMaterial { bool blur; bool mipmap; @@ -29,5 +33,5 @@ struct FlwMaterial { uint writeMask; bool useOverlay; bool useLight; - bool diffuse; + uint cardinalLightingMode; }; diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/packed_material.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/packed_material.glsl index b56828c1f..55c53a135 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/packed_material.glsl +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/packed_material.glsl @@ -8,7 +8,7 @@ const uint _FLW_TRANSPARENCY_LENGTH = 3u; const uint _FLW_WRITE_MASK_LENGTH = 2u; const uint _FLW_USE_OVERLAY_LENGTH = 1u; const uint _FLW_USE_LIGHT_LENGTH = 1u; -const uint _FLW_DIFFUSE_LENGTH = 1u; +const uint _FLW_CARDINAL_LIGHTING_MODE_LENGTH = 2u; // The bit offset of each property const uint _FLW_BLUR_OFFSET = 0u; @@ -20,7 +20,7 @@ const uint _FLW_TRANSPARENCY_OFFSET = _FLW_DEPTH_TEST_OFFSET + _FLW_DEPTH_TEST_L const uint _FLW_WRITE_MASK_OFFSET = _FLW_TRANSPARENCY_OFFSET + _FLW_TRANSPARENCY_LENGTH; const uint _FLW_USE_OVERLAY_OFFSET = _FLW_WRITE_MASK_OFFSET + _FLW_WRITE_MASK_LENGTH; const uint _FLW_USE_LIGHT_OFFSET = _FLW_USE_OVERLAY_OFFSET + _FLW_USE_OVERLAY_LENGTH; -const uint _FLW_DIFFUSE_OFFSET = _FLW_USE_LIGHT_OFFSET + _FLW_USE_LIGHT_LENGTH; +const uint _FLW_CARDINAL_LIGHTING_MODE_OFFSET = _FLW_USE_LIGHT_OFFSET + _FLW_USE_LIGHT_LENGTH; // The bit mask for each property const uint _FLW_BLUR_MASK = ((1u << _FLW_BLUR_LENGTH) - 1u) << _FLW_BLUR_OFFSET; @@ -32,10 +32,10 @@ const uint _FLW_TRANSPARENCY_MASK = ((1u << _FLW_TRANSPARENCY_LENGTH) - 1u) << _ const uint _FLW_WRITE_MASK_MASK = ((1u << _FLW_WRITE_MASK_LENGTH) - 1u) << _FLW_WRITE_MASK_OFFSET; const uint _FLW_USE_OVERLAY_MASK = ((1u << _FLW_USE_OVERLAY_LENGTH) - 1u) << _FLW_USE_OVERLAY_OFFSET; const uint _FLW_USE_LIGHT_MASK = ((1u << _FLW_USE_LIGHT_LENGTH) - 1u) << _FLW_USE_LIGHT_OFFSET; -const uint _FLW_DIFFUSE_MASK = ((1u << _FLW_DIFFUSE_LENGTH) - 1u) << _FLW_DIFFUSE_OFFSET; +const uint _FLW_CARDINAL_LIGHTING_MODE_MASK = ((1u << _FLW_CARDINAL_LIGHTING_MODE_LENGTH) - 1u) << _FLW_CARDINAL_LIGHTING_MODE_OFFSET; // Packed format: -// diffuse[1] | useLight[1] | useOverlay[1] | writeMask[2] | transparency[3] | depthTest[4] | polygonOffset[1] | backfaceCulling[1] | mipmap[1] | blur[1] +// cardinalLightingMode[2] | useLight[1] | useOverlay[1] | writeMask[2] | transparency[3] | depthTest[4] | polygonOffset[1] | backfaceCulling[1] | mipmap[1] | blur[1] void _flw_unpackMaterialProperties(uint p, out FlwMaterial m) { m.blur = (p & _FLW_BLUR_MASK) != 0u; m.mipmap = (p & _FLW_MIPMAP_MASK) != 0u; @@ -46,7 +46,7 @@ void _flw_unpackMaterialProperties(uint p, out FlwMaterial m) { m.writeMask = (p & _FLW_WRITE_MASK_MASK) >> _FLW_WRITE_MASK_OFFSET; m.useOverlay = (p & _FLW_USE_OVERLAY_MASK) != 0u; m.useLight = (p & _FLW_USE_LIGHT_MASK) != 0u; - m.diffuse = (p & _FLW_DIFFUSE_MASK) != 0u; + m.cardinalLightingMode = (p & _FLW_CARDINAL_LIGHTING_MODE_MASK) >> _FLW_CARDINAL_LIGHTING_MODE_OFFSET; } void _flw_unpackUint2x16(uint s, out uint hi, out uint lo) { diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl index f7f53f847..231196aac 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl @@ -26,7 +26,6 @@ layout(std140) uniform _FlwLevelUniforms { float flw_skyDarken; uint flw_constantAmbientLight; - uint flw_useLightDirections; /** Use FLW_DIMENSION_* ids to determine the dimension. May eventually be implemented for custom dimensions. */ uint flw_dimension; diff --git a/common/src/lib/java/dev/engine_room/flywheel/lib/material/SimpleMaterial.java b/common/src/lib/java/dev/engine_room/flywheel/lib/material/SimpleMaterial.java index 214712af4..627fbd2bb 100644 --- a/common/src/lib/java/dev/engine_room/flywheel/lib/material/SimpleMaterial.java +++ b/common/src/lib/java/dev/engine_room/flywheel/lib/material/SimpleMaterial.java @@ -1,5 +1,6 @@ package dev.engine_room.flywheel.lib.material; +import dev.engine_room.flywheel.api.material.CardinalLightingMode; import dev.engine_room.flywheel.api.material.CutoutShader; import dev.engine_room.flywheel.api.material.DepthTest; import dev.engine_room.flywheel.api.material.FogShader; @@ -29,7 +30,7 @@ public class SimpleMaterial implements Material { protected final boolean useOverlay; protected final boolean useLight; - protected final boolean diffuse; + protected final CardinalLightingMode cardinalLightingMode; protected SimpleMaterial(Builder builder) { shaders = builder.shaders(); @@ -46,7 +47,7 @@ public class SimpleMaterial implements Material { writeMask = builder.writeMask(); useOverlay = builder.useOverlay(); useLight = builder.useLight(); - diffuse = builder.diffuse(); + cardinalLightingMode = builder.cardinalLightingMode(); } public static Builder builder() { @@ -128,8 +129,8 @@ public class SimpleMaterial implements Material { } @Override - public boolean diffuse() { - return diffuse; + public CardinalLightingMode cardinalLightingMode() { + return cardinalLightingMode; } public static class Builder implements Material { @@ -150,7 +151,7 @@ public class SimpleMaterial implements Material { protected boolean useOverlay; protected boolean useLight; - protected boolean diffuse; + protected CardinalLightingMode cardinalLightingMode; public Builder() { shaders = StandardMaterialShaders.DEFAULT; @@ -167,7 +168,7 @@ public class SimpleMaterial implements Material { writeMask = WriteMask.COLOR_DEPTH; useOverlay = true; useLight = true; - diffuse = true; + cardinalLightingMode = CardinalLightingMode.ENTITY; } public Builder(Material material) { @@ -189,7 +190,7 @@ public class SimpleMaterial implements Material { writeMask = material.writeMask(); useOverlay = material.useOverlay(); useLight = material.useLight(); - diffuse = material.diffuse(); + cardinalLightingMode = material.cardinalLightingMode(); return this; } @@ -264,7 +265,11 @@ public class SimpleMaterial implements Material { } public Builder diffuse(boolean value) { - this.diffuse = value; + return cardinalLightingMode(value ? CardinalLightingMode.ENTITY : CardinalLightingMode.OFF); + } + + public Builder cardinalLightingMode(CardinalLightingMode value) { + this.cardinalLightingMode = value; return this; } @@ -339,8 +344,8 @@ public class SimpleMaterial implements Material { } @Override - public boolean diffuse() { - return diffuse; + public CardinalLightingMode cardinalLightingMode() { + return cardinalLightingMode; } public SimpleMaterial build() { diff --git a/docs/shader-api/material.glsl b/docs/shader-api/material.glsl index 40af43e2f..990129b54 100644 --- a/docs/shader-api/material.glsl +++ b/docs/shader-api/material.glsl @@ -19,6 +19,10 @@ const uint FLW_MAT_WRITE_MASK_COLOR_DEPTH = 0u; const uint FLW_MAT_WRITE_MASK_COLOR = 1u; const uint FLW_MAT_WRITE_MASK_DEPTH = 2u; +const uint FLW_MAT_CARDINAL_LIGHTING_MODE_OFF = 0u; +const uint FLW_MAT_CARDINAL_LIGHTING_MODE_CHUNK = 1u; +const uint FLW_MAT_CARDINAL_LIGHTING_MODE_ENTITY = 2u; + struct FlwMaterial { bool blur; bool mipmap; @@ -29,5 +33,5 @@ struct FlwMaterial { uint writeMask; bool useOverlay; bool useLight; - bool diffuse; + uint cardinalLightingMode; }; diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java index 6027df0a4..2763ae124 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java @@ -185,24 +185,16 @@ public class FabricFlwConfig implements FlwConfig { public static class FabricBackendConfig implements BackendConfig { public static final LightSmoothness LIGHT_SMOOTHNESS_DEFAULT = LightSmoothness.SMOOTH; - public static final boolean USE_LIGHT_DIRECTIONS_DEFAULT = true; public LightSmoothness lightSmoothness = LIGHT_SMOOTHNESS_DEFAULT; - public boolean useLightDirections = USE_LIGHT_DIRECTIONS_DEFAULT; @Override public LightSmoothness lightSmoothness() { return lightSmoothness; } - @Override - public boolean useLightDirections() { - return useLightDirections; - } - public void fromJson(JsonObject object) { readLightSmoothness(object); - readUseLightDirections(object); } private void readLightSmoothness(JsonObject object) { @@ -232,23 +224,9 @@ public class FabricFlwConfig implements FlwConfig { lightSmoothness = LIGHT_SMOOTHNESS_DEFAULT; } - private void readUseLightDirections(JsonObject object) { - var useLightDirectionsJson = object.get("useLightDirections"); - - if (useLightDirectionsJson instanceof JsonPrimitive primitive && primitive.isBoolean()) { - useLightDirections = primitive.getAsBoolean(); - return; - } else if (useLightDirectionsJson != null) { - FlwBackend.LOGGER.warn("'useLightDirections' value must be a boolean"); - } - - useLightDirections = USE_LIGHT_DIRECTIONS_DEFAULT; - } - public JsonObject toJson() { JsonObject object = new JsonObject(); object.addProperty("lightSmoothness", lightSmoothness.getSerializedName()); - object.addProperty("useLightDirections", useLightDirections); return object; } } diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java index f6fa12545..1cee65f24 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java @@ -100,34 +100,6 @@ public final class FlwCommands { return Command.SINGLE_SUCCESS; }))); - command.then(ClientCommandManager.literal("useLightDirections") - .executes(context -> { - if (FabricFlwConfig.INSTANCE.backendConfig.useLightDirections) { - context.getSource() - .sendFeedback(Component.translatable("command.flywheel.use_light_directions.get.on")); - } else { - context.getSource() - .sendFeedback(Component.translatable("command.flywheel.use_light_directions.get.off")); - } - return Command.SINGLE_SUCCESS; - }) - .then(ClientCommandManager.literal("on") - .executes(context -> { - FabricFlwConfig.INSTANCE.backendConfig.useLightDirections = true; - FabricFlwConfig.INSTANCE.save(); - context.getSource() - .sendFeedback(Component.translatable("command.flywheel.use_light_directions.set.on")); - return Command.SINGLE_SUCCESS; - })) - .then(ClientCommandManager.literal("off") - .executes(context -> { - FabricFlwConfig.INSTANCE.backendConfig.useLightDirections = false; - FabricFlwConfig.INSTANCE.save(); - context.getSource() - .sendFeedback(Component.translatable("command.flywheel.use_light_directions.set.off")); - return Command.SINGLE_SUCCESS; - }))); - command.then(createDebugCommand()); dispatcher.register(command); diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java index 8aeb9e45f..4dd8cd5a5 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java @@ -98,29 +98,6 @@ public final class FlwCommands { return Command.SINGLE_SUCCESS; }))); - var useLightDirectionsValue = ForgeFlwConfig.INSTANCE.client.backendConfig.useLightDirections; - command.then(Commands.literal("useLightDirections") - .executes(context -> { - if (useLightDirectionsValue.get()) { - sendMessage(context.getSource(), Component.translatable("command.flywheel.use_light_directions.get.on")); - } else { - sendMessage(context.getSource(), Component.translatable("command.flywheel.use_light_directions.get.off")); - } - return Command.SINGLE_SUCCESS; - }) - .then(Commands.literal("on") - .executes(context -> { - useLightDirectionsValue.set(true); - sendMessage(context.getSource(), Component.translatable("command.flywheel.use_light_directions.set.on")); - return Command.SINGLE_SUCCESS; - })) - .then(Commands.literal("off") - .executes(context -> { - useLightDirectionsValue.set(false); - sendMessage(context.getSource(), Component.translatable("command.flywheel.use_light_directions.set.off")); - return Command.SINGLE_SUCCESS; - }))); - command.then(createDebugCommand()); event.getDispatcher().register(command); diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java b/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java index 2b50aadb1..9f0cc4760 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java @@ -101,24 +101,15 @@ public class ForgeFlwConfig implements FlwConfig { public static class ForgeBackendConfig implements BackendConfig { public final ForgeConfigSpec.EnumValue lightSmoothness; - public final ForgeConfigSpec.BooleanValue useLightDirections; public ForgeBackendConfig(ForgeConfigSpec.Builder builder) { lightSmoothness = builder.comment("How smooth flywheel's shader-based lighting should be. May have a large performance impact.") .defineEnum("lightSmoothness", LightSmoothness.SMOOTH); - - useLightDirections = builder.comment("If true, diffuse lighting is accurate to vanilla entities and block entities. If false, diffuse lighting is accurate to vanilla chunks. Zero performance impact, just a matter of visual preference.") - .define("useLightDirections", true); } @Override public LightSmoothness lightSmoothness() { return lightSmoothness.get(); } - - @Override - public boolean useLightDirections() { - return useLightDirections.get(); - } } }