Created base config class.
This commit is contained in:
49
src/main/java/dev/micle/xptools/config/Config.java
Normal file
49
src/main/java/dev/micle/xptools/config/Config.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package dev.micle.xptools.config;
|
||||||
|
|
||||||
|
import dev.micle.xptools.XpTools;
|
||||||
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(modid = XpTools.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
|
public final class Config {
|
||||||
|
public static final Client CLIENT;
|
||||||
|
public static final ForgeConfigSpec CLIENT_SPEC;
|
||||||
|
public static final Common COMMON;
|
||||||
|
public static final ForgeConfigSpec COMMON_SPEC;
|
||||||
|
public static final Server SERVER;
|
||||||
|
public static final ForgeConfigSpec SERVER_SPEC;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Pair<Client, ForgeConfigSpec> clientSpecPair = new ForgeConfigSpec.Builder().configure(Client::new);
|
||||||
|
CLIENT = clientSpecPair.getLeft();
|
||||||
|
CLIENT_SPEC = clientSpecPair.getRight();
|
||||||
|
|
||||||
|
Pair<Common, ForgeConfigSpec> commonSpecPair = new ForgeConfigSpec.Builder().configure(Common::new);
|
||||||
|
COMMON = commonSpecPair.getLeft();
|
||||||
|
COMMON_SPEC = commonSpecPair.getRight();
|
||||||
|
|
||||||
|
Pair<Server, ForgeConfigSpec> serverSpecPair = new ForgeConfigSpec.Builder().configure(Server::new);
|
||||||
|
SERVER = serverSpecPair.getLeft();
|
||||||
|
SERVER_SPEC = serverSpecPair.getRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
XpTools.getFMLJavaModLoadingContext().registerConfig(ModConfig.Type.CLIENT, CLIENT_SPEC);
|
||||||
|
XpTools.getFMLJavaModLoadingContext().registerConfig(ModConfig.Type.COMMON, COMMON_SPEC);
|
||||||
|
XpTools.getFMLJavaModLoadingContext().registerConfig(ModConfig.Type.SERVER, SERVER_SPEC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Client {
|
||||||
|
Client(ForgeConfigSpec.Builder builder) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Common {
|
||||||
|
Common(ForgeConfigSpec.Builder builder) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Server {
|
||||||
|
Server(ForgeConfigSpec.Builder builder) {}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package dev.micle.xptools.proxy;
|
package dev.micle.xptools.proxy;
|
||||||
|
|
||||||
import dev.micle.xptools.XpTools;
|
import dev.micle.xptools.XpTools;
|
||||||
|
import dev.micle.xptools.config.Config;
|
||||||
import dev.micle.xptools.events.common.OnBlockBreakEventHandler;
|
import dev.micle.xptools.events.common.OnBlockBreakEventHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@ -18,6 +19,8 @@ public class Proxy implements IProxy {
|
|||||||
|
|
||||||
// Common setup
|
// Common setup
|
||||||
public Proxy() {
|
public Proxy() {
|
||||||
|
Config.register();
|
||||||
|
|
||||||
// Register mod event bus listeners
|
// Register mod event bus listeners
|
||||||
IEventBus modEventBus = XpTools.getFMLJavaModLoadingContext().getModEventBus();
|
IEventBus modEventBus = XpTools.getFMLJavaModLoadingContext().getModEventBus();
|
||||||
modEventBus.addListener(Proxy::setup);
|
modEventBus.addListener(Proxy::setup);
|
||||||
|
Reference in New Issue
Block a user