diff --git a/dependencies.gradle b/dependencies.gradle index 80b28fdac0..9cf99622a8 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -13,7 +13,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:EnderStorage:1.4.12:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.42.82:dev") { + compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.43.99:dev") { transitive = false } compile("com.github.GTNewHorizons:ForestryMC:4.6.6:dev") { @@ -55,6 +55,9 @@ dependencies { compileOnly("com.github.GTNewHorizons:ExtraCells2:2.5.33:dev") { transitive = false } + compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.1.21-gtnh:dev') { + transitive = false + } compile("com.github.GTNewHorizons:EnderCore:0.2.14:dev") compile("com.github.GTNewHorizons:EnderIO:2.4.11:dev") { transitive = false diff --git a/src/main/scala/li/cil/oc/integration/Mods.scala b/src/main/scala/li/cil/oc/integration/Mods.scala index c724c2e4ea..1a90255aec 100644 --- a/src/main/scala/li/cil/oc/integration/Mods.scala +++ b/src/main/scala/li/cil/oc/integration/Mods.scala @@ -17,6 +17,7 @@ object Mods { def All = knownMods.clone() + val Ae2Fc = new SimpleMod(IDs.Ae2Fc) val AgriCraft = new SimpleMod(IDs.AgriCraft, version = "@[1.4.0,)") val AppliedEnergistics2 = new SimpleMod(IDs.AppliedEnergistics2, version = "@[rv1,)") val AvaritiaAddons = new SimpleMod(IDs.AvaritiaAddons) @@ -89,6 +90,7 @@ object Mods { val Proxies = Array( integration.agricraft.ModAgriCraft, + integration.ae2fc.ModAe2fc, integration.appeng.ModAppEng, integration.avaritiaaddons.ModAvaritiaAddons, integration.betterrecords.ModBetterRecords, @@ -168,6 +170,7 @@ object Mods { object IDs { final val AgriCraft = "AgriCraft" + final val Ae2Fc = "ae2fc" final val AppliedEnergistics2 = "appliedenergistics2" final val AvaritiaAddons = "avaritiaddons" final val BattleGear2 = "battlegear2" diff --git a/src/main/scala/li/cil/oc/integration/ae2fc/Ae2FcUtil.scala b/src/main/scala/li/cil/oc/integration/ae2fc/Ae2FcUtil.scala new file mode 100644 index 0000000000..1b54b0250a --- /dev/null +++ b/src/main/scala/li/cil/oc/integration/ae2fc/Ae2FcUtil.scala @@ -0,0 +1,8 @@ +package li.cil.oc.integration.ae2fc + +import appeng.api.storage.data.IAEFluidStack +import com.glodblock.github.api.FluidCraftAPI + +object Ae2FcUtil { + def canSeeFluidInNetwork(fluid: IAEFluidStack) = fluid != null && fluid.getFluid != null && !FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getFluid.getClass) +} diff --git a/src/main/scala/li/cil/oc/integration/ae2fc/ModAe2fc.scala b/src/main/scala/li/cil/oc/integration/ae2fc/ModAe2fc.scala new file mode 100644 index 0000000000..eaeb4ba69c --- /dev/null +++ b/src/main/scala/li/cil/oc/integration/ae2fc/ModAe2fc.scala @@ -0,0 +1,8 @@ +package li.cil.oc.integration.ae2fc + +import li.cil.oc.integration.{Mod, ModProxy, Mods} + +object ModAe2fc extends ModProxy { + override def getMod: Mod = Mods.Ae2Fc + override def initialize(): Unit = {} +} diff --git a/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala b/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala index 2f008276d6..f128edba4e 100644 --- a/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala +++ b/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala @@ -1,7 +1,6 @@ package li.cil.oc.integration.appeng import java.lang - import appeng.api.AEApi import appeng.api.config.Actionable import appeng.api.networking.IGridNode @@ -9,7 +8,7 @@ import appeng.api.networking.crafting.{CraftingItemList, ICraftingLink, ICraftin import appeng.api.networking.security.{BaseActionSource, IActionHost, MachineSource} import appeng.api.networking.storage.IBaseMonitor import appeng.api.storage.IMEMonitorHandlerReceiver -import appeng.api.storage.data.{IAEItemStack, IItemList} +import appeng.api.storage.data.{IAEFluidStack, IAEItemStack, IItemList} import appeng.api.util.AECableType import appeng.me.cluster.implementations.CraftingCPUCluster import appeng.me.helpers.IGridProxyable @@ -24,6 +23,7 @@ import li.cil.oc.api.network.Node import li.cil.oc.api.prefab.AbstractValue import li.cil.oc.common.EventHandler import li.cil.oc.integration.Mods +import li.cil.oc.integration.ae2fc.Ae2FcUtil import li.cil.oc.integration.appeng.NetworkControl._ import li.cil.oc.integration.ec.ECUtil import li.cil.oc.server.driver.Registry @@ -119,11 +119,14 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi }) } + private def isFluidVisible(stack: IAEFluidStack) = + if (Mods.ExtraCells.isAvailable) ECUtil.canSeeFluidInNetwork(stack) + else if (Mods.Ae2Fc.isAvailable) Ae2FcUtil.canSeeFluidInNetwork(stack) + else true + @Callback(doc = "function():table -- Get a list of the stored fluids in the network.") def getFluidsInNetwork(context: Context, args: Arguments): Array[AnyRef] = - result(tile.getProxy.getStorage.getFluidInventory.getStorageList.filter(stack => - !Mods.ExtraCells.isAvailable || ECUtil.canSeeFluidInNetwork(stack)). - map(_.getFluidStack).toArray) + result(tile.getProxy.getStorage.getFluidInventory.getStorageList.filter(isFluidVisible).map(fs => convert(fs, tile)).toArray) @Callback(doc = "function():number -- Get the average power injection into the network.") def getAvgPowerInjection(context: Context, args: Arguments): Array[AnyRef] = @@ -472,12 +475,13 @@ object NetworkControl { aeCraftItem(aeItem, tile) } + def hashConvert(value: java.util.HashMap[_, _]) = { + val hash = new java.util.HashMap[String, AnyRef] + value.collect { case (k: String, v: AnyRef) => hash += k -> v } + hash + } + def convert(aeItem: IAEItemStack, tile: TileEntity with IGridProxyable): java.util.HashMap[String, AnyRef] = { - def hashConvert(value: java.util.HashMap[_, _]) = { - val hash = new java.util.HashMap[String, AnyRef] - value.collect{ case (k:String, v:AnyRef) => hash += k -> v } - hash - } val potentialItem = aePotentialItem(aeItem, tile) val result = Registry.convert(Array[AnyRef](potentialItem.getItemStack)) .collect { case hash: java.util.HashMap[_,_] => hashConvert(hash) } @@ -492,6 +496,18 @@ object NetworkControl { null } + def convert(aeItem: IAEFluidStack, tile: TileEntity with IGridProxyable): java.util.HashMap[String, AnyRef] = { + val result = Registry.convert(Array[AnyRef](aeItem.getFluidStack)) + .collect { case hash: java.util.HashMap[_, _] => hashConvert(hash) } + if (result.length > 0) { + val hash = result(0) + hash.update("amount", Long.box(aeItem.getStackSize)) + hash.update("isCraftable", Boolean.box(aeItem.isCraftable)) + return hash + } + null + } + private def loadController(nbt: NBTTagCompound, f : TileEntity with IGridProxyable with IActionHost => Unit ) : Unit = { if (nbt.hasKey("dimension")) { val dimension = nbt.getInteger("dimension") diff --git a/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala b/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala index 94bd13c861..b95df44b51 100644 --- a/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala +++ b/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala @@ -15,7 +15,7 @@ object EventHandlerGregTech { val world = e.host.world world.getTileEntity(e.x, e.y, e.z) match { case tile : IGregTechTileEntity => - e.data += "facing" -> ForgeDirection.getOrientation(tile.getFrontFacing).name() + e.data += "facing" -> tile.getFrontFacing.name e.data += "sensorInformation" -> tile.getInfoData() case _ => }