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 co.fantabos.bscv.modules.*;
import co.fantabos.bscv.modules.hud.*;
// The value here should match an entry in the META-INF/mods.toml file
@Mod("bscv")
@ -41,6 +42,8 @@ public class BoSCoVicino {
private final CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<>();
public static ForgeConfigSpec spec;
public BoSCoVicino() {
// Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
@ -53,11 +56,21 @@ public class BoSCoVicino {
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
BoSCoVicino.mods.add(new Hud(builder, this.dispatcher));
BoSCoVicino.mods.add(new Fullbright(builder, this.dispatcher));
BoSCoVicino.mods.add(new VanillaFlight(builder, this.dispatcher));
// TODO also push!
// modules cannot easily pop from their builder, but here we can't easily get
// 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
ModLoadingContext.get().registerConfig(Type.CLIENT, spec, "bscv.toml");