chore: default registration cleanup

This commit is contained in:
Timo Ley 2024-11-15 16:42:52 +01:00
parent 9029822118
commit b779c11977
3 changed files with 21 additions and 12 deletions
src/main/java/dev/tilera/cwg

View file

@ -96,26 +96,25 @@ public class ClassicWorldgen {
}
public void registerHooks() {
IHookProvider tempDef = new DefaultTemperatureHook();
CwgGlobals.getHookRegistry().registerHookProvider(tempDef);
CwgGlobals.getOptionRegistry().registerOption(new HookOption("cwg:temperature_hook", tempDef, CwgGlobals.getHookRegistry()));
IHookProvider caveDef = new DefaultCavegenHook();
CwgGlobals.getHookRegistry().registerHookProvider(caveDef);
CwgGlobals.getOptionRegistry().registerOption(
new HookOption("cwg:temperature_hook", new DefaultTemperatureHook(), CwgGlobals.getHookRegistry()).registerDefault()
);
CwgGlobals.getOptionRegistry().registerOption(
new HookOption("cwg:cavegen_hook", new DefaultCavegenHook(), CwgGlobals.getHookRegistry()).registerDefault()
);
CwgGlobals.getHookRegistry().registerHookProvider(new SwissCavegenHook());
CwgGlobals.getOptionRegistry().registerOption(new HookOption("cwg:cavegen_hook", caveDef, CwgGlobals.getHookRegistry()));
}
public void registerGenerators() {
VanillaChunkManagerFactory def = new VanillaChunkManagerFactory();
CwgGlobals.getGeneratorRegistry().registerChunkManager(def);
CwgGlobals.getGeneratorRegistry().registerChunkManager(new ClassicChunkManagerFactory());
CwgGlobals.getGeneratorRegistry().registerChunkManager(new SingleBiomeChunkManagerFactory());
CwgGlobals.getOptionRegistry().registerOption(new ChunkManagerOption(
"cwg:generator",
"Generator",
def,
new VanillaChunkManagerFactory(),
CwgGlobals.getGeneratorRegistry()
));
).registerDefault());
CwgGlobals.getGeneratorRegistry().registerChunkManager(new ClassicChunkManagerFactory());
CwgGlobals.getGeneratorRegistry().registerChunkManager(new SingleBiomeChunkManagerFactory());
}
@SubscribeEvent

View file

@ -62,5 +62,10 @@ public class HookOption implements IOption<IHookProvider> {
public String toRepresentation(IHookProvider obj) {
return obj.getID();
}
public HookOption registerDefault() {
registry.registerHookProvider(defaultProvider);
return this;
}
}

View file

@ -70,5 +70,10 @@ public class ChunkManagerOption implements IOption<IChunkManagerFactory> {
public Type getOptionType() {
return Type.ENUM;
}
public ChunkManagerOption registerDefault() {
registry.registerChunkManager(defaultValue);
return this;
}
}