Converted Resonant Induction settings to new Configuration System
This commit is contained in:
parent
802a49de23
commit
1a2165dea2
5 changed files with 20 additions and 33 deletions
|
@ -95,7 +95,6 @@ public class Archaic
|
|||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
Settings.load();
|
||||
NetworkRegistry.instance().registerGuiHandler(this, proxy);
|
||||
blockEngineeringTable = contentRegistry.newBlock(TileEngineeringTable.class);
|
||||
blockCrate = contentRegistry.createBlock(BlockCrate.class, ItemBlockCrate.class, TileCrate.class);
|
||||
|
|
|
@ -99,8 +99,6 @@ public class Electrical
|
|||
{
|
||||
NetworkRegistry.instance().registerGuiHandler(this, proxy);
|
||||
|
||||
Settings.load();
|
||||
|
||||
// Energy
|
||||
itemWire = contentRegistry.createItem(ItemWire.class);
|
||||
itemMultimeter = contentRegistry.createItem(ItemMultimeter.class);
|
||||
|
|
|
@ -103,7 +103,6 @@ public class Mechanical
|
|||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
Settings.load();
|
||||
NetworkRegistry.instance().registerGuiHandler(this, proxy);
|
||||
MinecraftForge.EVENT_BUS.register(new MicroblockHighlightHandler());
|
||||
BlockCreativeBuilder.register(new SchematicWindTurbine());
|
||||
|
|
|
@ -3,6 +3,7 @@ package resonantinduction.core;
|
|||
import java.util.HashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import calclavia.lib.configurable.ConfigHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -90,8 +91,6 @@ public class ResonantInduction
|
|||
NetworkRegistry.instance().registerGuiHandler(this, proxy);
|
||||
Modstats.instance().getReporter().registerMod(this);
|
||||
|
||||
Settings.load();
|
||||
|
||||
// Register Forge Events
|
||||
MinecraftForge.EVENT_BUS.register(ResourceGenerator.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(new TextureHookHandler());
|
||||
|
@ -137,7 +136,16 @@ public class ResonantInduction
|
|||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt)
|
||||
{
|
||||
Settings.save();
|
||||
try
|
||||
{
|
||||
ConfigHandler.configure(Settings.CONFIGURATION, "resonantinduction");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Settings.save();
|
||||
// Generate Resources
|
||||
ResourceGenerator.generateOreResources();
|
||||
proxy.postInit();
|
||||
|
|
|
@ -3,6 +3,7 @@ package resonantinduction.core;
|
|||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
import calclavia.lib.configurable.Config;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import calclavia.lib.content.IDManager;
|
||||
|
@ -48,37 +49,15 @@ public class Settings
|
|||
return Settings.CONFIGURATION.get(Configuration.CATEGORY_ITEM, key, id).getInt(id);
|
||||
}
|
||||
|
||||
/** Settings */
|
||||
private static boolean didLoad = false;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Engineering Table Autocraft")
|
||||
public static boolean ALLOW_ENGINEERING_AUTOCRAFT = true;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Tesla Sound FXs")
|
||||
public static boolean SOUND_FXS = true;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Shiny silver Wires")
|
||||
public static boolean SHINY_SILVER = true;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Max EM Contractor Path")
|
||||
public static int MAX_LEVITATOR_DISTANCE = 200;
|
||||
|
||||
/**
|
||||
* Called from RI's core.
|
||||
*/
|
||||
public static void load()
|
||||
{
|
||||
CONFIGURATION.load();
|
||||
|
||||
if (!didLoad)
|
||||
{
|
||||
// Config
|
||||
ALLOW_ENGINEERING_AUTOCRAFT = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Engineering Table Autocraft", ALLOW_ENGINEERING_AUTOCRAFT).getBoolean(ALLOW_ENGINEERING_AUTOCRAFT);
|
||||
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
|
||||
SHINY_SILVER = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", SHINY_SILVER).getBoolean(SHINY_SILVER);
|
||||
MAX_LEVITATOR_DISTANCE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MAX_LEVITATOR_DISTANCE).getInt(MAX_LEVITATOR_DISTANCE);
|
||||
|
||||
LEVITATOR_ACCELERATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Levitator Item Acceleration", Settings.LEVITATOR_ACCELERATION).getDouble(Settings.LEVITATOR_ACCELERATION);
|
||||
LEVITATOR_MAX_REACH = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Levitator Max Item Reach", Settings.LEVITATOR_MAX_REACH).getInt(Settings.LEVITATOR_MAX_REACH);
|
||||
LEVITATOR_MAX_SPEED = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Levitator Max Item Speed", Settings.LEVITATOR_MAX_SPEED).getDouble(Settings.LEVITATOR_MAX_SPEED);
|
||||
LEVITATOR_PUSH_DELAY = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Levitator Item Push Delay", Settings.LEVITATOR_PUSH_DELAY).getInt(Settings.LEVITATOR_PUSH_DELAY);
|
||||
|
||||
didLoad = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void save()
|
||||
{
|
||||
CONFIGURATION.save();
|
||||
|
@ -115,8 +94,12 @@ public class Settings
|
|||
return false;
|
||||
}
|
||||
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Levitator Max Reach")
|
||||
public static int LEVITATOR_MAX_REACH = 40;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Levitator Push Delay")
|
||||
public static int LEVITATOR_PUSH_DELAY = 5;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Levitator Max Speed")
|
||||
public static double LEVITATOR_MAX_SPEED = .2;
|
||||
@Config(category = Configuration.CATEGORY_GENERAL, key = "Levitator Acceleration")
|
||||
public static double LEVITATOR_ACCELERATION = .02;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue