diff options
-rw-r--r-- | src/main/java/ftbsc/bscv/BoSCoVicino.java | 36 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/module/Module.java | 5 |
2 files changed, 18 insertions, 23 deletions
diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java index 5ea29b1..9a69620 100644 --- a/src/main/java/ftbsc/bscv/BoSCoVicino.java +++ b/src/main/java/ftbsc/bscv/BoSCoVicino.java @@ -59,29 +59,19 @@ public class BoSCoVicino { // load and register mods BoSCoVicino.mods = new ArrayList<Module>(); - ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder(); - - // 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. - - BoSCoVicino.mods.add(new Fullbright(builder, this.dispatcher)); - builder.pop(); - BoSCoVicino.mods.add(new VanillaFlight(builder, this.dispatcher)); - builder.pop(); - BoSCoVicino.mods.add(new FastInteract(builder, this.dispatcher)); - builder.pop(); - BoSCoVicino.mods.add(new InfoDisplay(builder, this.dispatcher)); - builder.pop(); - BoSCoVicino.mods.add(new Coordinates(builder, this.dispatcher)); - builder.pop(); - BoSCoVicino.mods.add(new EntityList(builder, this.dispatcher)); - builder.pop(); - BoSCoVicino.mods.add(new ActiveModules(builder, this.dispatcher)); - builder.pop(); - - BoSCoVicino.spec = builder.build(); + ForgeConfigSpec.Builder cfg = new ForgeConfigSpec.Builder(); + CommandDispatcher<CommandSource> dp = this.dispatcher; + + BoSCoVicino.mods.add(new ActiveModules(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new VanillaFlight(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new FastInteract(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new InfoDisplay(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new Coordinates(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new EntityList(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new Fullbright(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new Freecam(cfg, dp).done(cfg)); + + BoSCoVicino.spec = cfg.build(); // register config handler ModLoadingContext.get().registerConfig(Type.CLIENT, spec, "bscv.toml"); diff --git a/src/main/java/ftbsc/bscv/module/Module.java b/src/main/java/ftbsc/bscv/module/Module.java index d5ba285..84153a7 100644 --- a/src/main/java/ftbsc/bscv/module/Module.java +++ b/src/main/java/ftbsc/bscv/module/Module.java @@ -51,6 +51,11 @@ public abstract class Module { ); } + public Module done(ForgeConfigSpec.Builder builder) { + builder.pop(); + return this; + } + // TODO can I merge these two option into one? Maybe redo with builder pattern? |