mirror of
https://github.com/GTNewHorizons/gendustry.git
synced 2026-11-26 23:13:03 +00:00
Fixed crash if BC Core and/or CoFH API is present but not the respective transport API
This commit is contained in:
1 parent
3758262d68
commit
b213c8189d
2 files changed
+7
-3
No files matched your search
@@ -11,6 +11,7 @@ package net.bdew.gendustry.compat
|
||||
|
||||
import java.util
|
||||
|
||||
import cpw.mods.fml.common.versioning.VersionParser
|
||||
import cpw.mods.fml.common.{Loader, ModAPIManager, ModContainer}
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.gendustry.config.Tuning
|
||||
@@ -36,7 +37,10 @@ object PowerProxy {
|
||||
lazy val haveIC2 = haveModVersion(IC2_MOD_ID)
|
||||
lazy val haveTE = haveModVersion(TE_MOD_ID)
|
||||
|
||||
def haveModVersion(modId: String) = lookup.contains(modId)
|
||||
def haveModVersion(modId: String) = {
|
||||
val spec = VersionParser.parseVersionReference(modId)
|
||||
lookup.contains(spec.getLabel) && spec.containsVersion(lookup(spec.getLabel).getProcessedVersion)
|
||||
}
|
||||
|
||||
def getModVersion(modId: String): String = {
|
||||
val cont = lookup.getOrElse(modId, return "NOT FOUND")
|
||||
|
||||
@@ -19,8 +19,8 @@ object ItemPush {
|
||||
|
||||
def init() {
|
||||
register(VanillaPush)
|
||||
if (PowerProxy.haveModVersion("BuildCraftAPI|core")) register(BCPipePushProxy)
|
||||
if (PowerProxy.haveTE) register(CofhConduitPushProxy)
|
||||
if (PowerProxy.haveModVersion("BuildCraftAPI|transport@[3.0,)")) register(BCPipePushProxy)
|
||||
if (PowerProxy.haveModVersion("CoFHAPI|transport")) register(CofhConduitPushProxy)
|
||||
}
|
||||
|
||||
def register(p: ItemPushProxy) = proxies :+= p
|
||||
|
||||
Reference in new issue
Block a user