Fixed config reload event not being subscribed.

This commit is contained in:
2025-05-24 18:50:44 +01:00
parent 4425974fe1
commit b5ddcc9e22

View File

@ -41,12 +41,27 @@ public final class Config {
XpTools.getFMLJavaModLoadingContext().registerConfig(ModConfig.Type.SERVER, SERVER_SPEC);
}
@SubscribeEvent
public static void onConfigReloadEvent(ModConfigEvent event) {
if (event.getConfig().getSpec() == CLIENT_SPEC) {
Client.onConfigReload();
} else if (event.getConfig().getSpec() == COMMON_SPEC) {
Common.onConfigReload();
} else if (event.getConfig().getSpec() == SERVER_SPEC) {
Server.onConfigReload();
}
}
public static class Client {
Client(ForgeConfigSpec.Builder builder) {}
private static void onConfigReload() {}
}
public static class Common {
Common(ForgeConfigSpec.Builder builder) {}
private static void onConfigReload() {}
}
public static class Server {
@ -70,9 +85,7 @@ public final class Config {
builder.pop();
}
@SubscribeEvent
public static void onServerConfigReload(ModConfigEvent event) {
if (event.getConfig().getSpec() == SERVER_SPEC) {
private static void onConfigReload() {
blockBreakOperationItems = new ArrayList<>();
for (String s : blockBreakOperationsRaw.get()) {
blockBreakOperationItems.add(new OperationItem(s));
@ -80,4 +93,3 @@ public final class Config {
}
}
}
}