mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-14 01:04:01 +00:00
Added ApiReporter
This commit is contained in:
1 parent
8e90643ea1
commit
64c0484c2d
4 files changed
+45
-2
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ buildscript {
|
||||
apply plugin: 'scala'
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.6.4"
|
||||
version = "1.6.5"
|
||||
|
||||
if (project.hasProperty('buildnum')) {
|
||||
project.version = project.version + '.' + project.buildnum
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2015
|
||||
* https://github.com/bdew/bdlib
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://bdew.net/minecraft-mod-public-license/
|
||||
*/
|
||||
|
||||
package net.bdew.lib
|
||||
|
||||
import java.util
|
||||
|
||||
import cpw.mods.fml.common.{ICrashCallable, ModAPIManager, ModContainer}
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
object ApiReporter extends ICrashCallable {
|
||||
lazy val APIs = {
|
||||
val mods = new util.ArrayList[ModContainer]
|
||||
val nameLookup = new util.HashMap[String, ModContainer]
|
||||
ModAPIManager.INSTANCE.injectAPIModContainers(mods, nameLookup)
|
||||
(for (mod <- mods.sortBy(_.getModId.toLowerCase)) yield
|
||||
"\t\t* %s (%s) from %s".format(mod.getModId, mod.getVersion,
|
||||
if (mod.getSource.isDirectory)
|
||||
mod.getSource
|
||||
else
|
||||
mod.getSource.getName
|
||||
)).mkString(System.lineSeparator())
|
||||
}
|
||||
override def getLabel = "List of loaded APIs"
|
||||
override def call() = System.lineSeparator() + APIs
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package net.bdew.lib
|
||||
|
||||
import cpw.mods.fml.common.Mod
|
||||
import cpw.mods.fml.common.Mod.EventHandler
|
||||
import cpw.mods.fml.common.event.{FMLPreInitializationEvent, FMLServerStartingEvent, FMLServerStoppingEvent}
|
||||
import cpw.mods.fml.common.{FMLCommonHandler, Mod}
|
||||
import net.bdew.lib.multiblock.network.NetHandler
|
||||
import net.minecraft.command.CommandHandler
|
||||
import org.apache.logging.log4j.Logger
|
||||
@@ -34,6 +34,8 @@ object BdLib {
|
||||
def preInit(ev: FMLPreInitializationEvent) {
|
||||
log = ev.getModLog
|
||||
log.info("bdlib BDLIB_VER loaded")
|
||||
log.debug("List of loaded APIs: " + ApiReporter.APIs)
|
||||
FMLCommonHandler.instance().registerCrashCallable(ApiReporter)
|
||||
NetHandler.init()
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,14 @@ object Misc {
|
||||
init
|
||||
}
|
||||
|
||||
def nextInSeq[T](seq: Seq[T], elem: T) = {
|
||||
val pos = seq.indexOf(elem)
|
||||
if (pos < 0 || pos == seq.size - 1)
|
||||
seq(0)
|
||||
else
|
||||
seq(pos + 1)
|
||||
}
|
||||
|
||||
def getFluidIcon(fs: FluidStack): IIcon =
|
||||
if (fs != null && fs.getFluid != null && fs.getFluid.getIcon != null)
|
||||
fs.getFluid.getIcon(fs)
|
||||
|
||||
Reference in new issue
Block a user