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

89 lines
3.3 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.archaic.ArchaicContent
import resonantinduction.atomic.AtomicContent
2014-07-14 22:20:02 +02:00
import resonantinduction.core.handler.TextureHookHandler
import resonantinduction.electrical.ElectricalContent
import resonantinduction.mechanical.{MechanicalContent, MicroblockHighlightHandler}
2014-07-14 22:20:02 +02:00
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")
final object ResonantInduction
2014-07-14 22:20:02 +02:00
{
/** 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)
{
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(TextureHookHandler)
MinecraftForge.EVENT_BUS.register(MicroblockHighlightHandler)
2014-07-14 22:20:02 +02:00
loadables.applyModule(proxy)
loadables.applyModule(packetHandler)
loadables.applyModule(CoreContent)
loadables.applyModule(ArchaicContent)
loadables.applyModule(ElectricalContent)
loadables.applyModule(MechanicalContent)
loadables.applyModule(AtomicContent)
2014-07-14 22:20:02 +02:00
loadables.preInit()
2014-07-14 22:20:02 +02:00
2014-10-25 14:31:19 +02:00
RICreativeTab.itemStack = new ItemStack(CoreContent.decoration)
}
2014-07-14 22:20:02 +02:00
@EventHandler
def init(evt: FMLInitializationEvent)
{
//TODO: Why is there an if statement check here?
if (ResonantInduction.metadata != null)
2014-09-07 05:50:03 +02:00
{
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()
loadables.init()
}
@EventHandler
def postInit(evt: FMLPostInitializationEvent)
{
loadables.postInit()
}
2014-07-14 22:20:02 +02:00
}