Prevent mixins from crashing the game when there are missing mods (#9916)

1.20.1 backport of 49.0.14
This commit is contained in:
Paint_Ninja authored and GitHub committed 2024-05-08 22:06:39 +01:00
1 parent 1b0360928f
commit a6f5057840
4 files changed
+39 -12

No files matched your search

@@ -512,7 +512,7 @@ public class ForgeHooksClient
public static void fillNormal(int[] faceData, Direction facing, boolean calculateNormals)
{
Vector3f v2;
if (calculateNormals || ForgeConfig.CLIENT.calculateAllNormals.get()) {
if (calculateNormals || ForgeConfig.CLIENT.calculateAllNormals()) {
Vector3f v1 = getVertexPos(faceData, 3);
Vector3f t1 = getVertexPos(faceData, 1);
v2 = getVertexPos(faceData, 2);
@@ -5,7 +5,6 @@
package net.minecraftforge.client.loading;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -119,12 +118,8 @@ public class ClientModLoader
public static boolean completeModLoading()
{
var warnings = ModLoader.get().getWarnings();
boolean showWarnings = true;
try {
showWarnings = ForgeConfig.CLIENT.showLoadWarnings.get();
} catch (NullPointerException | IllegalStateException e) {
// We're in an early error state, config is not available. Assume true.
}
boolean showWarnings = ForgeConfig.CLIENT.showLoadWarnings();
if (!showWarnings) {
//User disabled warning screen, as least log them
if (!warnings.isEmpty()) {
@@ -158,6 +158,16 @@ public class ForgeConfig {
builder.pop();
}
// Allow these to be called before the config is loaded because its used before loading the error screens.
// Prevents a ton of spam when an error screen is displayed.
public final boolean calculateAllNormals() {
return clientSpec.isLoaded() ? calculateAllNormals.get() : calculateAllNormals.getDefault();
}
public final boolean showLoadWarnings() {
return clientSpec.isLoaded() ? showLoadWarnings.get() : showLoadWarnings.getDefault();
}
}
static final ForgeConfigSpec clientSpec;