diff --git a/src/main/java/info/ata4/minecraft/dragon/DragonMounts.java b/src/main/java/info/ata4/minecraft/dragon/DragonMounts.java index 970eb40f..480400fc 100644 --- a/src/main/java/info/ata4/minecraft/dragon/DragonMounts.java +++ b/src/main/java/info/ata4/minecraft/dragon/DragonMounts.java @@ -19,6 +19,7 @@ import cpw.mods.fml.common.event.FMLServerStartedEvent; import cpw.mods.fml.common.event.FMLServerStoppedEvent; import info.ata4.minecraft.dragon.server.ServerProxy; +import net.minecraftforge.common.config.Configuration; /** * Main control class for Forge. @@ -45,11 +46,12 @@ public class DragonMounts { @Instance(ID) public static DragonMounts instance; - public static DragonMountsConfig getConfig() { - return proxy.getConfig(); - } - private ModMetadata metadata; + private DragonMountsConfig config; + + public DragonMountsConfig getConfig() { + return config; + } public ModMetadata getMetadata() { return metadata; @@ -57,8 +59,8 @@ public ModMetadata getMetadata() { @EventHandler public void onPreInit(FMLPreInitializationEvent evt) { + config = new DragonMountsConfig(new Configuration(evt.getSuggestedConfigurationFile())); metadata = evt.getModMetadata(); - proxy.onPreInit(evt); } @EventHandler diff --git a/src/main/java/info/ata4/minecraft/dragon/client/ClientProxy.java b/src/main/java/info/ata4/minecraft/dragon/client/ClientProxy.java index ca3a1b3c..567b0363 100644 --- a/src/main/java/info/ata4/minecraft/dragon/client/ClientProxy.java +++ b/src/main/java/info/ata4/minecraft/dragon/client/ClientProxy.java @@ -39,7 +39,7 @@ public void onInit(FMLInitializationEvent evt) { MinecraftForge.EVENT_BUS.register(new DragonSplash()); - if (DragonMounts.getConfig().isDebug()) { + if (DragonMounts.instance.getConfig().isDebug()) { MinecraftForge.EVENT_BUS.register(new GuiDragonDebug()); } } diff --git a/src/main/java/info/ata4/minecraft/dragon/server/ServerProxy.java b/src/main/java/info/ata4/minecraft/dragon/server/ServerProxy.java index feecbff6..58c05287 100644 --- a/src/main/java/info/ata4/minecraft/dragon/server/ServerProxy.java +++ b/src/main/java/info/ata4/minecraft/dragon/server/ServerProxy.java @@ -10,12 +10,10 @@ package info.ata4.minecraft.dragon.server; import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartedEvent; import cpw.mods.fml.common.event.FMLServerStoppedEvent; import cpw.mods.fml.common.registry.EntityRegistry; import info.ata4.minecraft.dragon.DragonMounts; -import info.ata4.minecraft.dragon.DragonMountsConfig; import info.ata4.minecraft.dragon.server.cmd.CommandDragon; import info.ata4.minecraft.dragon.server.entity.EntityTameableDragon; import info.ata4.minecraft.dragon.server.handler.DragonEggBlockHandler; @@ -27,7 +25,6 @@ import net.minecraft.util.WeightedRandomChestContent; import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.config.Configuration; /** * @@ -36,24 +33,16 @@ public class ServerProxy { private DragonControlChannelHandler controlChannel; - private DragonMountsConfig config; - - public DragonMountsConfig getConfig() { - return config; - } public DragonControlChannelHandler getControlChannel() { return controlChannel; } - public void onPreInit(FMLPreInitializationEvent evt) { - config = new DragonMountsConfig(new Configuration(evt.getSuggestedConfigurationFile())); - } public void onInit(FMLInitializationEvent evt) { registerEntities(); - if (DragonMounts.getConfig().isEggsInChests()) { + if (DragonMounts.instance.getConfig().isEggsInChests()) { registerChestItems(); } @@ -72,7 +61,7 @@ public void onServerStopped(FMLServerStoppedEvent evt) { } private void registerEntities() { - int dragonEntityID = getConfig().getDragonEntityID(); + int dragonEntityID = DragonMounts.instance.getConfig().getDragonEntityID(); if (dragonEntityID == -1) { dragonEntityID = EntityRegistry.findGlobalUniqueEntityId(); } diff --git a/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java b/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java index e41f8001..9f036699 100644 --- a/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java +++ b/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java @@ -169,7 +169,7 @@ protected void entityInit() { addHelper(new DragonReproductionHelper(this, INDEX_BREEDER, INDEX_REPRO_COUNT)); addHelper(new DragonParticleHelper(this)); - if (DragonMounts.getConfig().isDebug()) { + if (DragonMounts.instance.getConfig().isDebug()) { addHelper(new DragonDebug(this)); }