electrodynamics/src/main/scala/resonantinduction/core/ResonantInduction.scala

90 lines
3.5 KiB
Scala
Raw Normal View History

2014-07-14 22:20:02 +02:00
package resonantinduction.core
import cpw.mods.fml.common.Mod.EventHandler
2014-07-14 22:35:26 +02:00
import cpw.mods.fml.common.event.{FMLInitializationEvent, FMLPostInitializationEvent, FMLPreInitializationEvent}
2014-07-14 22:20:02 +02:00
import cpw.mods.fml.common.network.NetworkRegistry
import cpw.mods.fml.common.{Mod, ModMetadata, SidedProxy}
2014-07-14 22:35:26 +02:00
import net.minecraft.item.ItemStack
2014-07-14 22:20:02 +02:00
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.common.config.Configuration
import org.modstats.{ModstatInfo, Modstats}
2014-08-15 15:59:41 +02:00
import resonant.engine.{References, ResonantEngine}
2014-07-14 22:20:02 +02:00
import resonant.lib.config.ConfigHandler
import resonant.lib.loadable.LoadableHandler
import resonantinduction.core.handler.TextureHookHandler
import scala.collection.convert.wrapAll._
2014-07-14 22:20:02 +02:00
/** The core module of Resonant Induction
*
* @author Calclavia */
2014-07-16 00:58:44 +02:00
@Mod(modid = Reference.coreID, name = Reference.name, version = Reference.version, modLanguage = "scala", dependencies = "required-after:ForgeMultipart@[1.0.0.244,);required-after:ResonantEngine;before:ThermalExpansion;before:Mekanism")
2014-07-14 22:20:02 +02:00
@ModstatInfo(prefix = "resonantin")
object ResonantInduction
{
/** Packets */
val packetHandler = ResonantEngine.instance.packetHandler
val loadables = new LoadableHandler
2014-07-14 22:20:02 +02:00
@SidedProxy(clientSide = "resonantinduction.core.ClientProxy", serverSide = "resonantinduction.core.CommonProxy")
var proxy: CommonProxy = _
2014-07-14 22:20:02 +02:00
@Mod.Metadata(References.ID)
var metadata: ModMetadata = null
@EventHandler
def preInit(evt: FMLPreInitializationEvent)
{
/**
* Registrations
*/
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy)
Modstats.instance.getReporter.registerMod(this)
2014-07-14 22:20:02 +02:00
Settings.config = new Configuration(evt.getSuggestedConfigurationFile)
ConfigHandler.sync(Settings, Settings.config)
2014-07-14 22:20:02 +02:00
MinecraftForge.EVENT_BUS.register(new TextureHookHandler)
2014-07-14 22:20:02 +02:00
loadables.applyModule(proxy)
loadables.applyModule(packetHandler)
loadables.applyModule(CoreContent)
2014-07-14 22:20:02 +02:00
loadables.preInit()
2014-07-14 22:20:02 +02:00
ResonantTab.itemStack = new ItemStack(CoreContent.decoration)
}
2014-07-14 22:20:02 +02:00
@EventHandler
def init(evt: FMLInitializationEvent)
2014-09-07 05:50:03 +02:00
{
//TODO: Why is there an if statement check here?
if (ResonantInduction.metadata != null)
{
ResonantInduction.metadata.modId = Reference.name
ResonantInduction.metadata.name = Reference.name
ResonantInduction.metadata.description = Reference.name + " is a mod... TODO add description"
ResonantInduction.metadata.url = "http://calclavia.com/resonant-induction/"
ResonantInduction.metadata.version = Reference.version + Reference.build
ResonantInduction.metadata.authorList = List[String]("Calclavia", "DarkCow", "tgame14", "Maxwolf")
ResonantInduction.metadata.autogenerated = false
}
ResonantPartFactory.init()
ResonantEngine.resourceFactory.generateAll();
2014-07-14 22:20:02 +02:00
loadables.init()
}
@EventHandler
def postInit(evt: FMLPostInitializationEvent)
{
/*
GameRegistry.addRecipe(new ShapelessOreRecipe(itemFlour, Array[AnyRef](Item.wheat, Item.wheat)))
FurnaceRecipes.smelting.addSmelting(itemFlour.itemID, 1, new ItemStack(Item.bread), 50f)
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(itemFlour, 1, 1), Array[AnyRef](itemFlour, Item.bucketWater)))
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER.name, Item.wheat, itemFlour)
*/
loadables.postInit()
}
2014-07-14 22:20:02 +02:00
}