fix: pop configspec!

This commit is contained in:
əlemi 2023-01-30 02:20:05 +01:00
parent 2aa64795f5
commit b7808b7938
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import co.fantabos.bscv.modules.*; import co.fantabos.bscv.modules.*;
import co.fantabos.bscv.modules.hud.*;
// The value here should match an entry in the META-INF/mods.toml file // The value here should match an entry in the META-INF/mods.toml file
@Mod("bscv") @Mod("bscv")
@ -41,6 +42,8 @@ public class BoSCoVicino {
private final CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<>(); private final CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<>();
public static ForgeConfigSpec spec;
public BoSCoVicino() { public BoSCoVicino() {
// Register the setup method for modloading // Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
@ -53,11 +56,21 @@ public class BoSCoVicino {
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder(); ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
BoSCoVicino.mods.add(new Hud(builder, this.dispatcher)); // TODO also push!
BoSCoVicino.mods.add(new Fullbright(builder, this.dispatcher)); // modules cannot easily pop from their builder, but here we can't easily get
BoSCoVicino.mods.add(new VanillaFlight(builder, this.dispatcher)); // the module name yet. We should push and pop the builder ourselves and not
// bother the modules themselves.
ForgeConfigSpec spec = builder.build(); BoSCoVicino.mods.add(new Fullbright(builder, this.dispatcher));
builder.pop();
BoSCoVicino.mods.add(new VanillaFlight(builder, this.dispatcher));
builder.pop();
BoSCoVicino.mods.add(new Coordinates(builder, this.dispatcher));
builder.pop();
BoSCoVicino.mods.add(new ActiveModules(builder, this.dispatcher));
builder.pop();
BoSCoVicino.spec = builder.build();
// register config handler // register config handler
ModLoadingContext.get().registerConfig(Type.CLIENT, spec, "bscv.toml"); ModLoadingContext.get().registerConfig(Type.CLIENT, spec, "bscv.toml");