Checking for RedstoneFlux API instead of TE now, closes #455.

This commit is contained in:
Florian Nücke 2014-08-01 16:14:08 +02:00
parent bb89fd3245
commit 4987b9702d
5 changed files with 18 additions and 16 deletions

View File

@ -116,7 +116,7 @@ class Settings(config: Config) {
!Mods.ElectricalAge.isAvailable &&
!Mods.IndustrialCraft2.isAvailable &&
!Mods.Mekanism.isAvailable &&
!Mods.ThermalExpansion.isAvailable &&
!Mods.RedstoneFlux.isAvailable &&
!Mods.UniversalElectricity.isAvailable)
val tickFrequency = config.getDouble("power.tickFrequency") max 1
val chargeRate = config.getDouble("power.chargerChargeRate")
@ -244,7 +244,7 @@ object Settings {
val valueBuildCraft = 500.0
val valueIndustrialCraft2 = 200.0
val valueMekanism = 2000.0 / 3.0
val valueThermalExpansion = 50.0
val valueRedstoneFlux = 50.0
val valueUniversalElectricity = 1.0
val valueInternal = valueBuildCraft
@ -252,7 +252,7 @@ object Settings {
val ratioBuildCraft = valueBuildCraft / valueInternal
val ratioIndustrialCraft2 = valueIndustrialCraft2 / valueInternal
val ratioMekanism = valueMekanism / valueInternal
val ratioThermalExpansion = valueThermalExpansion / valueInternal
val ratioRedstoneFlux = valueRedstoneFlux / valueInternal
val ratioUniversalElectricity = valueUniversalElectricity / valueInternal
def basicScreenPixels = screenResolutionsByTier(0)._1 * screenResolutionsByTier(0)._2

View File

@ -49,8 +49,8 @@ class PowerConverter(val parent: SimpleDelegator) extends SimpleDelegate {
if (Mods.Mekanism.isAvailable) {
addRatio("Mekanism", Settings.ratioMekanism)
}
if (Mods.ThermalExpansion.isAvailable) {
addRatio("ThermalExpansion", Settings.ratioThermalExpansion)
if (Mods.RedstoneFlux.isAvailable) {
addRatio("ThermalExpansion", Settings.ratioRedstoneFlux)
}
if (Mods.UniversalElectricity.isAvailable) {
addRatio("UniversalElectricity", Settings.ratioUniversalElectricity)

View File

@ -5,5 +5,5 @@ trait PowerAcceptor
with power.BuildCraft
with power.IndustrialCraft2
with power.Mekanism
with power.ThermalExpansion
with power.RedstoneFlux
// with power.UniversalElectricity

View File

@ -6,21 +6,21 @@ import li.cil.oc.Settings
import li.cil.oc.util.mods.Mods
import net.minecraftforge.common.util.ForgeDirection
@Optional.Interface(iface = "cofh.api.energy.IEnergyHandler", modid = Mods.IDs.ThermalExpansion)
trait ThermalExpansion extends Common with IEnergyHandler {
@Optional.Method(modid = Mods.IDs.ThermalExpansion)
@Optional.Interface(iface = "cofh.api.energy.IEnergyHandler", modid = Mods.IDs.RedstoneFlux)
trait RedstoneFlux extends Common with IEnergyHandler {
@Optional.Method(modid = Mods.IDs.RedstoneFlux)
def canConnectEnergy(from: ForgeDirection) = canConnectPower(from)
@Optional.Method(modid = Mods.IDs.ThermalExpansion)
@Optional.Method(modid = Mods.IDs.RedstoneFlux)
def receiveEnergy(from: ForgeDirection, maxReceive: Int, simulate: Boolean) =
(tryChangeBuffer(from, maxReceive * Settings.ratioThermalExpansion, !simulate) / Settings.ratioThermalExpansion).toInt
(tryChangeBuffer(from, maxReceive * Settings.ratioRedstoneFlux, !simulate) / Settings.ratioRedstoneFlux).toInt
@Optional.Method(modid = Mods.IDs.ThermalExpansion)
def getEnergyStored(from: ForgeDirection) = (globalBuffer(from) / Settings.ratioThermalExpansion).toInt
@Optional.Method(modid = Mods.IDs.RedstoneFlux)
def getEnergyStored(from: ForgeDirection) = (globalBuffer(from) / Settings.ratioRedstoneFlux).toInt
@Optional.Method(modid = Mods.IDs.ThermalExpansion)
def getMaxEnergyStored(from: ForgeDirection) = (globalBufferSize(from) / Settings.ratioThermalExpansion).toInt
@Optional.Method(modid = Mods.IDs.RedstoneFlux)
def getMaxEnergyStored(from: ForgeDirection) = (globalBufferSize(from) / Settings.ratioRedstoneFlux).toInt
@Optional.Method(modid = Mods.IDs.ThermalExpansion)
@Optional.Method(modid = Mods.IDs.RedstoneFlux)
def extractEnergy(from: ForgeDirection, maxExtract: Int, simulate: Boolean) = 0
}

View File

@ -19,6 +19,7 @@ object Mods {
final val PortalGun = "PortalGun"
final val ProjectRedTransmission = "ProjRed|Transmission"
final val RedLogic = "RedLogic"
final val RedstoneFlux = "CoFHAPI"
final val StargateTech2 = "StargateTech2"
final val ThermalExpansion = "ThermalExpansion"
final val TinkersConstruct = "TConstruct"
@ -41,6 +42,7 @@ object Mods {
val PortalGun = new SimpleMod(IDs.PortalGun)
val ProjectRedTransmission = new SimpleMod(IDs.ProjectRedTransmission)
val RedLogic = new SimpleMod(IDs.RedLogic)
val RedstoneFlux = new SimpleMod(IDs.RedstoneFlux)
val StargateTech2 = new Mod {
val isAvailable = Loader.isModLoaded(IDs.StargateTech2) && {
val mod = Loader.instance.getIndexedModList.get(IDs.StargateTech2)