From 943eb36e2d7868bdab4d243d4243c48d94c3e98d Mon Sep 17 00:00:00 2001 From: TudbuT Date: Tue, 25 Jun 2024 09:56:55 +0200 Subject: [PATCH] fix a crash --- .../src/main/java/de/com/baseband/client/DevStub.java | 2 ++ .../java/de/com/baseband/client/feature/Feature.java | 1 - .../java/de/com/baseband/client/feature/Features.java | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Client/src/main/java/de/com/baseband/client/DevStub.java b/Client/src/main/java/de/com/baseband/client/DevStub.java index 5744afb..f45d2ed 100644 --- a/Client/src/main/java/de/com/baseband/client/DevStub.java +++ b/Client/src/main/java/de/com/baseband/client/DevStub.java @@ -1,6 +1,7 @@ package de.com.baseband.client; import de.com.baseband.prod.LoadHandler; +import de.tudbut.parsing.TCNArray; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; @@ -32,6 +33,7 @@ public class DevStub implements IFMLLoadingPlugin { LoadHandler.data.set("release-branch", false); LoadHandler.data.set("branch", "[dev]"); LoadHandler.data.set("username", "root"); + LoadHandler.data.set("disabledModules", new TCNArray()); } @Override diff --git a/Client/src/main/java/de/com/baseband/client/feature/Feature.java b/Client/src/main/java/de/com/baseband/client/feature/Feature.java index 8183fca..eeaa4eb 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/Feature.java +++ b/Client/src/main/java/de/com/baseband/client/feature/Feature.java @@ -107,7 +107,6 @@ public abstract class Feature extends ToggleButton implements SetCommand { } public final void register(Minecraft mc) { - Setup = de.com.baseband.client.Setup.get(); this.mc = mc; this.text = toString(); diff --git a/Client/src/main/java/de/com/baseband/client/feature/Features.java b/Client/src/main/java/de/com/baseband/client/feature/Features.java index 38313b5..04b20b4 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/Features.java +++ b/Client/src/main/java/de/com/baseband/client/feature/Features.java @@ -15,8 +15,14 @@ public class Features { ArrayList filteredFeatures = new ArrayList<>(Arrays.asList(Setup.get().Features)); for (int i = 0; i < filteredFeatures.size(); i++) { Feature value = filteredFeatures.get(i); - if(!value.canExist()) { - filteredFeatures.remove(i--); + value.Setup = de.com.baseband.client.Setup.get(); + try { + if (!value.canExist()) { + filteredFeatures.remove(i--); + } + } catch (Exception e) { + e.printStackTrace(); + BaseBand.LOGGER.error("Unable to check feature {}", value.toString()); } } features = filteredFeatures.toArray(new Feature[0]);