Skip to content

Commit c97811c

Browse files
committed
Add option to enable/disable the sodium workaround
1 parent 5c7c83a commit c97811c

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

3dSkinLayers-Versionless/src/main/java/dev/tr7zw/skinlayers/versionless/config/Config.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class Config {
2323
public boolean fastRender = true;
2424
public boolean compatibilityMode = true;
2525
public boolean irisCompatibilityMode = false;
26+
public boolean applySodiumWorkaround = false;
2627

2728
public float firstPersonPixelScaling = 1.1f;
2829

src/main/java/dev/tr7zw/skinlayers/config/ConfigScreenProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public CustomConfigScreen(Screen previous) {
123123
options.add(getOnOffOption("text.skinlayers.irisCompatibilityMode.enable",
124124
() -> SkinLayersModBase.config.irisCompatibilityMode,
125125
(b) -> SkinLayersModBase.config.irisCompatibilityMode = b));
126+
options.add(getOnOffOption("text.skinlayers.applySodiumWorkaround.enable",
127+
() -> SkinLayersModBase.config.applySodiumWorkaround,
128+
(b) -> SkinLayersModBase.config.applySodiumWorkaround = b));
126129
//? }
127130
options.add(getDoubleOption("text.skinlayers.firstperson.voxelsize", 1.02f, 1.3f, 0.001f,
128131
() -> (double) SkinLayersModBase.config.firstPersonPixelScaling, (i) -> {

src/main/java/dev/tr7zw/skinlayers/render/CustomizableCubeListBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ public ModelBuilder addBox(float x, float y, float z, float pixelSize, Direction
111111
case NORTH:
112112
yield net.minecraft.core.Direction.NORTH;
113113
case EAST:
114-
yield SodiumWorkaround.IS_SODIUM_LOADED ? net.minecraft.core.Direction.WEST
114+
yield SodiumWorkaround.applySodiumWorkaround() ? net.minecraft.core.Direction.WEST
115115
: net.minecraft.core.Direction.EAST;
116116
case WEST:
117-
yield SodiumWorkaround.IS_SODIUM_LOADED ? net.minecraft.core.Direction.EAST
117+
yield SodiumWorkaround.applySodiumWorkaround() ? net.minecraft.core.Direction.EAST
118118
: net.minecraft.core.Direction.WEST;
119119
case SOUTH:
120120
yield net.minecraft.core.Direction.SOUTH;

src/main/java/dev/tr7zw/skinlayers/util/SodiumWorkaround.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package dev.tr7zw.skinlayers.util;
22

3+
import dev.tr7zw.skinlayers.*;
4+
35
public class SodiumWorkaround {
46

57
public static final boolean IS_SODIUM_WORKAROUND_NEEDED = isSodiumWorkaroundNeeded(); // This is a workaround to ensure the ModelPartData is loaded
6-
public static final boolean IS_SODIUM_LOADED = isSodiumLoaded();
8+
private static final boolean IS_SODIUM_LOADED = isSodiumLoaded();
79

810
private static boolean isSodiumWorkaroundNeeded() {
911
try {
@@ -23,4 +25,8 @@ private static boolean isSodiumLoaded() {
2325
}
2426
}
2527

28+
public static boolean applySodiumWorkaround() {
29+
return IS_SODIUM_LOADED && SkinLayersMod.config.applySodiumWorkaround;
30+
}
31+
2632
}

src/main/resources/assets/skinlayers3d/lang/en_us.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@
4040
"text.skinlayers.compatibilityMode.enable": "Compatibility Mode",
4141
"text.skinlayers.compatibilityMode.enable.tooltip": "Alternative way to render the layers, might fix some compatibility issues with other mods",
4242
"text.skinlayers.irisCompatibilityMode.enable": "Iris Compatibility Mode",
43-
"text.skinlayers.irisCompatibilityMode.enable.tooltip": "Alternative way to render the layers, fixes weird shadows/colors when using Iris shaders. Only turn this setting on when needed. Will break the corner connections."
43+
"text.skinlayers.irisCompatibilityMode.enable.tooltip": "Alternative way to render the layers, fixes weird shadows/colors when using Iris shaders. Only turn this setting on when needed. Will break the corner connections.",
44+
"text.skinlayers.applySodiumWorkaround.enable": "Sodium Workaround",
45+
"text.skinlayers.applySodiumWorkaround.enable.tooltip": "Workaround for Sodium having flipped Cube sides in some versions(?). Only enable this if you are using Sodium and notice visual issues with the skin layers sides missing."
4446
}

0 commit comments

Comments
 (0)