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