mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 19:56:17 -04:00
Added 1.7 UE API. No idea if this implementation is correct, tho.
This commit is contained in:
parent
2f03b932f5
commit
9a41e9a506
@ -3,11 +3,16 @@ repositories {
|
|||||||
name = "ic2"
|
name = "ic2"
|
||||||
url = "http://maven.ic2.player.to/"
|
url = "http://maven.ic2.player.to/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = "ue"
|
||||||
|
url = "http://calclavia.com/maven/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "codechicken:CodeChickenLib:${config.cc.mc.version}-${config.ccl.version}:dev"
|
compile "codechicken:CodeChickenLib:${config.cc.mc.version}-${config.ccl.version}:dev"
|
||||||
compile "codechicken:ForgeMultipart:${config.cc.mc.version}-${config.fmp.version}:dev"
|
compile "codechicken:ForgeMultipart:${config.cc.mc.version}-${config.fmp.version}:dev"
|
||||||
compile "net.industrial-craft:industrialcraft-2:2.2.509-experimental:api"
|
compile "net.industrial-craft:industrialcraft-2:2.2.509-experimental:api"
|
||||||
|
compile "dev.calclavia.universalelectricity:universal-electricity:+:dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
|
@ -240,9 +240,9 @@ object Settings {
|
|||||||
|
|
||||||
// Power conversion values. These are the same values used by Universal
|
// Power conversion values. These are the same values used by Universal
|
||||||
// Electricity to provide global power support.
|
// Electricity to provide global power support.
|
||||||
val valueBC = 56280.0
|
val valueBC = 500.0
|
||||||
val valueIC2 = 22512.0
|
val valueIC2 = 200.0
|
||||||
val valueTE = 5628.0
|
val valueTE = 50.0
|
||||||
val valueUE = 1.0
|
val valueUE = 1.0
|
||||||
|
|
||||||
val valueOC = valueBC
|
val valueOC = valueBC
|
||||||
|
@ -5,4 +5,4 @@ trait PowerAcceptor
|
|||||||
with power.BuildCraft
|
with power.BuildCraft
|
||||||
with power.IndustrialCraft2
|
with power.IndustrialCraft2
|
||||||
with power.ThermalExpansion
|
with power.ThermalExpansion
|
||||||
// with power.UniversalElectricity
|
with power.UniversalElectricity
|
@ -1,39 +1,51 @@
|
|||||||
//package li.cil.oc.common.tileentity.traits.power
|
package li.cil.oc.common.tileentity.traits.power
|
||||||
//
|
|
||||||
//import cpw.mods.fml.common.Optional
|
import cpw.mods.fml.common.Optional
|
||||||
//import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
//import net.minecraftforge.common.util.ForgeDirection
|
import li.cil.oc.util.mods.Mods
|
||||||
//import universalelectricity.api.core.grid.{INode, INodeProvider}
|
import net.minecraftforge.common.util.ForgeDirection
|
||||||
//import universalelectricity.api.core.grid.electric.{IElectricNode, IEnergyContainer}
|
import universalelectricity.api.core.grid.electric.{IElectricNode, IEnergyContainer}
|
||||||
//
|
import universalelectricity.api.core.grid.{INode, INodeProvider}
|
||||||
//@Optional.InterfaceList(Array(
|
|
||||||
// new Optional.Interface(iface = "universalelectricity.api.core.grid.INodeProvider", modid = "UniversalElectricity"),
|
@Optional.InterfaceList(Array(
|
||||||
// new Optional.Interface(iface = "universalelectricity.api.core.grid.electric.IEnergyContainer", modid = "UniversalElectricity")
|
new Optional.Interface(iface = "universalelectricity.api.core.grid.INodeProvider", modid = "UniversalElectricity"),
|
||||||
//))
|
new Optional.Interface(iface = "universalelectricity.api.core.grid.electric.IEnergyContainer", modid = "UniversalElectricity")
|
||||||
//trait UniversalElectricity extends Common with INodeProvider with IEnergyContainer {
|
))
|
||||||
// @Optional.Method(modid = "UniversalElectricity")
|
trait UniversalElectricity extends Common with INodeProvider with IEnergyContainer {
|
||||||
// override def canConnect(direction: ForgeDirection, source: AnyRef) = canConnectPower(direction)
|
private lazy val ueNode: AnyRef = universalelectricity.api.core.grid.NodeRegistry.get(this, classOf[IElectricNode])
|
||||||
//
|
|
||||||
// @Optional.Method(modid = "UniversalElectricity")
|
private lazy val useUniversalElectricityPower = isServer && !Settings.get.ignorePower && Mods.BuildCraftPower.isAvailable
|
||||||
// override def onReceiveEnergy(from: ForgeDirection, receive: Long, doReceive: Boolean) =
|
|
||||||
// (tryChangeBuffer(from, receive * Settings.ratioUE, doReceive) / Settings.ratioUE).toLong
|
// ----------------------------------------------------------------------- //
|
||||||
//
|
|
||||||
// @Optional.Method(modid = "UniversalElectricity")
|
override def updateEntity() {
|
||||||
// override def onExtractEnergy(from: ForgeDirection, extract: Long, doExtract: Boolean) = 0
|
super.updateEntity()
|
||||||
//
|
if (useUniversalElectricityPower && world.getWorldTime % Settings.get.tickFrequency == 0) {
|
||||||
// override def getNode[N <: INode](nodeType: Class[N], from: ForgeDirection) = {
|
val electric = ueNode.asInstanceOf[IElectricNode]
|
||||||
// if (canConnectPower(from) && nodeType == classOf[IElectricNode]) {
|
for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||||
//
|
val demand = (globalBufferSize(side) - globalBuffer(side)) / Settings.ratioUE
|
||||||
// }
|
val power = math.min(demand, electric.getEnergy(100))
|
||||||
// else null
|
if (power > 1) {
|
||||||
// }
|
electric.drawPower(power)
|
||||||
//
|
tryChangeBuffer(side, power * Settings.ratioUE)
|
||||||
// @Optional.Method(modid = "UniversalElectricity")
|
}
|
||||||
// override def setEnergy(from: ForgeDirection, energy: Double) {}
|
}
|
||||||
//
|
}
|
||||||
// @Optional.Method(modid = "UniversalElectricity")
|
}
|
||||||
// override def getEnergy(from: ForgeDirection) = globalBuffer(from) / Settings.ratioUE
|
|
||||||
//
|
// ----------------------------------------------------------------------- //
|
||||||
// @Optional.Method(modid = "UniversalElectricity")
|
|
||||||
// override def getEnergyCapacity(from: ForgeDirection) = globalBufferSize(from) / Settings.ratioUE
|
override def getNode[N <: INode](nodeType: Class[N], from: ForgeDirection) = {
|
||||||
//}
|
if (canConnectPower(from) && nodeType == classOf[IElectricNode]) ueNode.asInstanceOf[N]
|
||||||
|
else null.asInstanceOf[N]
|
||||||
|
}
|
||||||
|
|
||||||
|
@Optional.Method(modid = "UniversalElectricity")
|
||||||
|
override def setEnergy(from: ForgeDirection, energy: Double) {}
|
||||||
|
|
||||||
|
@Optional.Method(modid = "UniversalElectricity")
|
||||||
|
override def getEnergy(from: ForgeDirection) = globalBuffer(from) / Settings.ratioUE
|
||||||
|
|
||||||
|
@Optional.Method(modid = "UniversalElectricity")
|
||||||
|
override def getEnergyCapacity(from: ForgeDirection) = globalBufferSize(from) / Settings.ratioUE
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user