mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Merge branch 'ec' of https://github.com/DrummerMC/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
01e195676c
@ -152,6 +152,10 @@ repositories {
|
|||||||
name 'BloodMagic'
|
name 'BloodMagic'
|
||||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.bloodmagic.cf}/[module]-${config.minecraft.version}-[revision].[ext]"
|
artifactPattern "http://addons-origin.cursecdn.com/files/${config.bloodmagic.cf}/[module]-${config.minecraft.version}-[revision].[ext]"
|
||||||
}
|
}
|
||||||
|
ivy {
|
||||||
|
name 'ExtraCells'
|
||||||
|
artifactPattern "http://addons-origin.cursecdn.com/files/${config.ec.cf}/[module]-[revision].[ext]"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@ -191,6 +195,7 @@ dependencies {
|
|||||||
provided name: 'EnderIO', version: config.eio.version, ext: 'jar'
|
provided name: 'EnderIO', version: config.eio.version, ext: 'jar'
|
||||||
provided name: 'Railcraft', version: config.rc.version, ext: 'jar'
|
provided name: 'Railcraft', version: config.rc.version, ext: 'jar'
|
||||||
provided name: 'BloodMagic', version: config.bloodmagic.version, ext: 'jar'
|
provided name: 'BloodMagic', version: config.bloodmagic.version, ext: 'jar'
|
||||||
|
provided name: 'ExtraCells', version: config.ec.version, ext: 'jar'
|
||||||
|
|
||||||
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
|
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ cc.version=1.65
|
|||||||
ccl.version=1.1.1.104
|
ccl.version=1.1.1.104
|
||||||
cofhlib.cf=2230/207
|
cofhlib.cf=2230/207
|
||||||
cofhlib.version=[1.7.10]1.0.0RC7-127
|
cofhlib.version=[1.7.10]1.0.0RC7-127
|
||||||
|
ec.cf=2242/839
|
||||||
|
ec.version=deobf-1.7.10-2.2.73b129
|
||||||
eio.cf=2219/296
|
eio.cf=2219/296
|
||||||
eio.version=1.7.10-2.2.1.276
|
eio.version=1.7.10-2.2.1.276
|
||||||
es.version=1.4.5.24
|
es.version=1.4.5.24
|
||||||
|
@ -35,6 +35,7 @@ object Mods {
|
|||||||
val ComputerCraft = new SimpleMod(IDs.ComputerCraft)
|
val ComputerCraft = new SimpleMod(IDs.ComputerCraft)
|
||||||
val CraftingCosts = new SimpleMod(IDs.CraftingCosts)
|
val CraftingCosts = new SimpleMod(IDs.CraftingCosts)
|
||||||
val DeepStorageUnit = new ClassBasedMod(IDs.DeepStorageUnit, "powercrystals.minefactoryreloaded.api.IDeepStorageUnit")()
|
val DeepStorageUnit = new ClassBasedMod(IDs.DeepStorageUnit, "powercrystals.minefactoryreloaded.api.IDeepStorageUnit")()
|
||||||
|
val ExtraCells = new SimpleMod(IDs.ExtraCells, version = "@[2.2.73,)")
|
||||||
val ElectricalAge = new SimpleMod(IDs.ElectricalAge, providesPower = true)
|
val ElectricalAge = new SimpleMod(IDs.ElectricalAge, providesPower = true)
|
||||||
val EnderIO = new SimpleMod(IDs.EnderIO)
|
val EnderIO = new SimpleMod(IDs.EnderIO)
|
||||||
val EnderStorage = new SimpleMod(IDs.EnderStorage)
|
val EnderStorage = new SimpleMod(IDs.EnderStorage)
|
||||||
@ -47,6 +48,7 @@ object Mods {
|
|||||||
val IndustrialCraft2Classic = new SimpleMod(IDs.IndustrialCraft2Classic, providesPower = true)
|
val IndustrialCraft2Classic = new SimpleMod(IDs.IndustrialCraft2Classic, providesPower = true)
|
||||||
val IngameWiki = new SimpleMod(IDs.IngameWiki, version = "@[1.1.3,)")
|
val IngameWiki = new SimpleMod(IDs.IngameWiki, version = "@[1.1.3,)")
|
||||||
val Mekanism = new SimpleMod(IDs.Mekanism, providesPower = true)
|
val Mekanism = new SimpleMod(IDs.Mekanism, providesPower = true)
|
||||||
|
val MekanismGas = new SimpleMod(IDs.MekanismGas)
|
||||||
val Minecraft = new SimpleMod(IDs.Minecraft)
|
val Minecraft = new SimpleMod(IDs.Minecraft)
|
||||||
val MineFactoryReloaded = new SimpleMod(IDs.MineFactoryReloaded)
|
val MineFactoryReloaded = new SimpleMod(IDs.MineFactoryReloaded)
|
||||||
val Mystcraft = new SimpleMod(IDs.Mystcraft)
|
val Mystcraft = new SimpleMod(IDs.Mystcraft)
|
||||||
@ -91,6 +93,7 @@ object Mods {
|
|||||||
integration.cofh.item.ModCoFHItem,
|
integration.cofh.item.ModCoFHItem,
|
||||||
integration.cofh.tileentity.ModCoFHTileEntity,
|
integration.cofh.tileentity.ModCoFHTileEntity,
|
||||||
integration.cofh.transport.ModCoFHTransport,
|
integration.cofh.transport.ModCoFHTransport,
|
||||||
|
integration.ec.ModExtraCells,
|
||||||
integration.enderstorage.ModEnderStorage,
|
integration.enderstorage.ModEnderStorage,
|
||||||
integration.dsu.ModDeepStorageUnit,
|
integration.dsu.ModDeepStorageUnit,
|
||||||
integration.forestry.ModForestry,
|
integration.forestry.ModForestry,
|
||||||
@ -98,6 +101,7 @@ object Mods {
|
|||||||
integration.gc.ModGalacticraft,
|
integration.gc.ModGalacticraft,
|
||||||
integration.gregtech.ModGregtech,
|
integration.gregtech.ModGregtech,
|
||||||
integration.ic2.ModIndustrialCraft2,
|
integration.ic2.ModIndustrialCraft2,
|
||||||
|
integration.mekanism.gas.ModMekanismGas,
|
||||||
integration.mfr.ModMineFactoryReloaded,
|
integration.mfr.ModMineFactoryReloaded,
|
||||||
integration.mystcraft.ModMystcraft,
|
integration.mystcraft.ModMystcraft,
|
||||||
integration.nek.ModNotEnoughKeys,
|
integration.nek.ModNotEnoughKeys,
|
||||||
@ -164,6 +168,7 @@ object Mods {
|
|||||||
final val CoFHTransport = "CoFHAPI|transport"
|
final val CoFHTransport = "CoFHAPI|transport"
|
||||||
final val ComputerCraft = "ComputerCraft"
|
final val ComputerCraft = "ComputerCraft"
|
||||||
final val CraftingCosts = "CraftingCosts"
|
final val CraftingCosts = "CraftingCosts"
|
||||||
|
final val ExtraCells = "extracells"
|
||||||
final val ElectricalAge = "Eln"
|
final val ElectricalAge = "Eln"
|
||||||
final val EnderIO = "EnderIO"
|
final val EnderIO = "EnderIO"
|
||||||
final val EnderStorage = "EnderStorage"
|
final val EnderStorage = "EnderStorage"
|
||||||
@ -177,6 +182,7 @@ object Mods {
|
|||||||
final val IndustrialCraft2Classic = "IC2-Classic"
|
final val IndustrialCraft2Classic = "IC2-Classic"
|
||||||
final val IngameWiki = "IGWMod"
|
final val IngameWiki = "IGWMod"
|
||||||
final val Mekanism = "Mekanism"
|
final val Mekanism = "Mekanism"
|
||||||
|
final val MekanismGas = "MekanismAPI|gas"
|
||||||
final val Minecraft = "Minecraft"
|
final val Minecraft = "Minecraft"
|
||||||
final val MineFactoryReloaded = "MineFactoryReloaded"
|
final val MineFactoryReloaded = "MineFactoryReloaded"
|
||||||
final val Mystcraft = "Mystcraft"
|
final val Mystcraft = "Mystcraft"
|
||||||
|
@ -17,6 +17,8 @@ import li.cil.oc.api.machine.Context
|
|||||||
import li.cil.oc.api.network.Node
|
import li.cil.oc.api.network.Node
|
||||||
import li.cil.oc.api.prefab.AbstractValue
|
import li.cil.oc.api.prefab.AbstractValue
|
||||||
import li.cil.oc.common.EventHandler
|
import li.cil.oc.common.EventHandler
|
||||||
|
import li.cil.oc.integration.ec.ECUtil
|
||||||
|
import li.cil.oc.integration.Mods
|
||||||
import li.cil.oc.util.DatabaseAccess
|
import li.cil.oc.util.DatabaseAccess
|
||||||
import li.cil.oc.util.ExtendedArguments._
|
import li.cil.oc.util.ExtendedArguments._
|
||||||
import li.cil.oc.util.ExtendedNBT._
|
import li.cil.oc.util.ExtendedNBT._
|
||||||
@ -96,7 +98,12 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
|||||||
|
|
||||||
@Callback(doc = "function():table -- Get a list of the stored fluids in the network.")
|
@Callback(doc = "function():table -- Get a list of the stored fluids in the network.")
|
||||||
def getFluidsInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
def getFluidsInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(tile.getProxy.getStorage.getFluidInventory.getStorageList.map(_.getFluidStack).toArray)
|
result(tile.getProxy.getStorage.getFluidInventory.getStorageList.filter(stack => {
|
||||||
|
if(Mods.ExtraCells.isAvailable)
|
||||||
|
ECUtil.canSeeFluidInNetwork(stack)
|
||||||
|
else
|
||||||
|
true
|
||||||
|
}).map(_.getFluidStack).toArray)
|
||||||
|
|
||||||
@Callback(doc = "function():number -- Get the average power injection into the network.")
|
@Callback(doc = "function():number -- Get the average power injection into the network.")
|
||||||
def getAvgPowerInjection(context: Context, args: Arguments): Array[AnyRef] =
|
def getAvgPowerInjection(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package li.cil.oc.integration.ec
|
||||||
|
|
||||||
|
import appeng.api.networking.security.IActionHost
|
||||||
|
import appeng.me.helpers.IGridProxyable
|
||||||
|
import li.cil.oc.api.driver.EnvironmentAware
|
||||||
|
import li.cil.oc.api.network.ManagedEnvironment
|
||||||
|
import li.cil.oc.api.prefab.DriverTileEntity
|
||||||
|
import li.cil.oc.integration.ManagedTileEntityEnvironment
|
||||||
|
import li.cil.oc.integration.appeng.AEUtil
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
|
import scala.language.existentials
|
||||||
|
|
||||||
|
object DriverController extends DriverTileEntity with EnvironmentAware {
|
||||||
|
private type TileController = TileEntity with IGridProxyable with IActionHost
|
||||||
|
|
||||||
|
def getTileEntityClass = AEUtil.controllerClass
|
||||||
|
|
||||||
|
def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
|
||||||
|
new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileController])
|
||||||
|
|
||||||
|
override def providedEnvironment(stack: ItemStack) =
|
||||||
|
if (AEUtil.isController(stack)) classOf[Environment]
|
||||||
|
else null
|
||||||
|
|
||||||
|
class Environment(val tile: TileController) extends ManagedTileEntityEnvironment[TileController](tile, "me_controller") with NetworkControl[TileController] {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package li.cil.oc.integration.ec
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.tile.misc.TileInterface
|
||||||
|
import li.cil.oc.api.driver.EnvironmentAware
|
||||||
|
import li.cil.oc.api.network.ManagedEnvironment
|
||||||
|
import li.cil.oc.api.prefab.DriverTileEntity
|
||||||
|
import li.cil.oc.integration.ManagedTileEntityEnvironment
|
||||||
|
import li.cil.oc.integration.appeng.AEUtil
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
|
object DriverInterface extends DriverTileEntity with EnvironmentAware {
|
||||||
|
def getTileEntityClass: Class[_] = classOf[TileInterface]
|
||||||
|
|
||||||
|
def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
|
||||||
|
new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileInterface])
|
||||||
|
|
||||||
|
override def providedEnvironment(stack: ItemStack) =
|
||||||
|
if (AEUtil.isBlockInterface(stack)) classOf[Environment]
|
||||||
|
else null
|
||||||
|
|
||||||
|
class Environment(val tile: TileInterface) extends ManagedTileEntityEnvironment[TileInterface](tile, "me_interface") with NetworkControl[TileInterface] {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
src/main/scala/li/cil/oc/integration/ec/ECUtil.scala
Normal file
13
src/main/scala/li/cil/oc/integration/ec/ECUtil.scala
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package li.cil.oc.integration.ec
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack
|
||||||
|
import extracells.api.ECApi
|
||||||
|
|
||||||
|
|
||||||
|
object ECUtil {
|
||||||
|
|
||||||
|
val api = ECApi.instance
|
||||||
|
|
||||||
|
def canSeeFluidInNetwork(fluid: IAEFluidStack) = fluid != null && api.canFluidSeeInTerminal(fluid.getFluid)
|
||||||
|
|
||||||
|
}
|
13
src/main/scala/li/cil/oc/integration/ec/ModExtraCells.scala
Normal file
13
src/main/scala/li/cil/oc/integration/ec/ModExtraCells.scala
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package li.cil.oc.integration.ec
|
||||||
|
|
||||||
|
import li.cil.oc.api.Driver
|
||||||
|
import li.cil.oc.integration.{Mods, Mod, ModProxy}
|
||||||
|
|
||||||
|
object ModExtraCells extends ModProxy{
|
||||||
|
override def getMod: Mod = Mods.ExtraCells
|
||||||
|
|
||||||
|
override def initialize(): Unit = {
|
||||||
|
Driver.add(DriverController)
|
||||||
|
Driver.add(DriverInterface)
|
||||||
|
}
|
||||||
|
}
|
22
src/main/scala/li/cil/oc/integration/ec/NetworkControl.scala
Normal file
22
src/main/scala/li/cil/oc/integration/ec/NetworkControl.scala
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package li.cil.oc.integration.ec
|
||||||
|
|
||||||
|
import appeng.api.networking.security.IActionHost
|
||||||
|
import appeng.me.helpers.IGridProxyable
|
||||||
|
import extracells.api.ECApi
|
||||||
|
import li.cil.oc.api.machine.{Arguments, Context, Callback}
|
||||||
|
import li.cil.oc.util.ResultWrapper._
|
||||||
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
import scala.collection.convert.WrapAsScala._
|
||||||
|
|
||||||
|
// Note to self: this class is used by ExtraCells (and potentially others), do not rename / drastically change it.
|
||||||
|
trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActionHost] {
|
||||||
|
def tile: AETile
|
||||||
|
|
||||||
|
val api = ECApi.instance
|
||||||
|
|
||||||
|
@Callback(doc = "function():table -- Get a list of the stored gases in the network.")
|
||||||
|
def getGasesInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
|
result(tile.getProxy.getStorage.getFluidInventory.getStorageList.filter(stack => api.isGasStack(stack)).map(api.createGasStack(_)).toArray)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package li.cil.oc.integration.mekanism.gas
|
||||||
|
|
||||||
|
import java.util
|
||||||
|
|
||||||
|
import li.cil.oc.{Settings, api}
|
||||||
|
|
||||||
|
import scala.collection.convert.WrapAsScala._
|
||||||
|
|
||||||
|
object ConverterGasStack extends api.driver.Converter {
|
||||||
|
override def convert(value: scala.Any, output: util.Map[AnyRef, AnyRef]) =
|
||||||
|
value match {
|
||||||
|
case stack: mekanism.api.gas.GasStack =>
|
||||||
|
if (Settings.get.insertIdsInConverters) {
|
||||||
|
output += "id" -> Int.box(stack.getGas.getID)
|
||||||
|
}
|
||||||
|
output += "amount" -> Int.box(stack.amount)
|
||||||
|
val gas = stack.getGas
|
||||||
|
if (gas != null) {
|
||||||
|
output += "name" -> gas.getName
|
||||||
|
output += "label" -> gas.getLocalizedName
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package li.cil.oc.integration.mekanism.gas
|
||||||
|
|
||||||
|
import li.cil.oc.api.Driver
|
||||||
|
import li.cil.oc.integration.{Mod, ModProxy, Mods}
|
||||||
|
|
||||||
|
|
||||||
|
object ModMekanismGas extends ModProxy{
|
||||||
|
override def getMod: Mod = Mods.MekanismGas
|
||||||
|
|
||||||
|
override def initialize(): Unit = {
|
||||||
|
Driver.add(ConverterGasStack)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user