mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 12:17:17 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8.9
This commit is contained in:
commit
279a87e473
Binary file not shown.
@ -823,6 +823,7 @@ opencomputers {
|
||||
Mekanism: 1333.33
|
||||
PowerAdvantage: 31.25
|
||||
RedstoneFlux: 100.0
|
||||
RotaryCraft: 200.0 # / 11256, same as AE2
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,6 +237,7 @@ class Settings(val config: Config) {
|
||||
private val valueMekanism = config.getDouble("power.value.Mekanism")
|
||||
private val valuePowerAdvantage = config.getDouble("power.value.PowerAdvantage")
|
||||
private val valueRedstoneFlux = config.getDouble("power.value.RedstoneFlux")
|
||||
private val valueRotaryCraft = config.getDouble("power.value.RotaryCraft") / 11256.0
|
||||
|
||||
private val valueInternal = 1000
|
||||
|
||||
@ -247,6 +248,7 @@ class Settings(val config: Config) {
|
||||
val ratioMekanism = valueMekanism / valueInternal
|
||||
val ratioPowerAdvantage = valuePowerAdvantage / valueInternal
|
||||
val ratioRedstoneFlux = valueRedstoneFlux / valueInternal
|
||||
val ratioRotaryCraft = valueRotaryCraft / valueInternal
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// filesystem
|
||||
|
@ -9,3 +9,4 @@ trait PowerAcceptor
|
||||
// with power.IndustrialCraft2Classic
|
||||
// with power.Mekanism
|
||||
with power.RedstoneFlux
|
||||
// with power.RotaryCraft
|
||||
|
@ -22,9 +22,9 @@ trait Common extends TileEntity {
|
||||
// but our throughput is per tick, so multiply this up for actual budget.
|
||||
var budget = energyThroughput * Settings.get.tickFrequency
|
||||
for (side <- EnumFacing.values) {
|
||||
val demand = fromOther(math.min(budget, globalDemand(side)))
|
||||
val demand = toOther(math.min(budget, globalDemand(side)))
|
||||
if (demand > 1) {
|
||||
val energy = toOther(provider(demand, side))
|
||||
val energy = fromOther(provider(demand, side))
|
||||
if (energy > 0) {
|
||||
budget -= tryChangeBuffer(side, energy)
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
package li.cil.oc.common.tileentity.traits.power
|
||||
/* TODO RotaryCraft
|
||||
import li.cil.oc.OpenComputers
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.common.asm.Injectable
|
||||
import li.cil.oc.integration.Mods
|
||||
import li.cil.oc.integration.util.Power
|
||||
import net.minecraft.util.EnumFacing
|
||||
import net.minecraftforge.fml.common.Optional
|
||||
|
||||
@Injectable.Interface(value = "Reika.RotaryCraft.API.Power.ShaftPowerReceiver", modid = Mods.IDs.RotaryCraft)
|
||||
trait RotaryCraft extends Common {
|
||||
private lazy val useRotaryCraftPower = isServer && Mods.RotaryCraft.isAvailable
|
||||
|
||||
private var omega = 0
|
||||
private var torque = 0
|
||||
private var power = 0L
|
||||
private var alpha = 0
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def updateEntity() {
|
||||
if (useRotaryCraftPower) updateEnergy()
|
||||
super.updateEntity()
|
||||
}
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
private def updateEnergy() {
|
||||
if (world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
|
||||
tryAllSides((demand, _) => {
|
||||
val consumed = demand.toLong min power
|
||||
power -= consumed
|
||||
consumed
|
||||
}, Power.fromWA, Power.toWA)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// ShaftMachine
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def getOmega: Int = omega
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def getTorque: Int = torque
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def getPower: Long = power
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def getName: String = OpenComputers.Name
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def getIORenderAlpha: Int = alpha
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def setIORenderAlpha(value: Int): Unit = alpha = value
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// ShaftPowerReceiver
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def setOmega(value: Int): Unit = omega = value
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def setTorque(value: Int): Unit = torque = value
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def setPower(value: Long): Unit = power = value
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def noInputMachine(): Unit = {
|
||||
omega = 0
|
||||
torque = 0
|
||||
power = 0
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// PowerAcceptor
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def canReadFrom(forgeDirection: EnumFacing): Boolean = true
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def isReceiving: Boolean = true
|
||||
|
||||
@Optional.Method(modid = Mods.IDs.RotaryCraft)
|
||||
def getMinTorque(available: Int): Int = 0
|
||||
}
|
||||
*/
|
@ -17,7 +17,7 @@ object Power {
|
||||
|
||||
// Galacticraft
|
||||
|
||||
def fromGC(value: Float) = value * Settings.get.ratioGalacticraft
|
||||
def fromGC(value: Double) = value * Settings.get.ratioGalacticraft
|
||||
|
||||
def toGC(value: Double): Float = (value / Settings.get.ratioGalacticraft).toFloat
|
||||
|
||||
@ -35,7 +35,13 @@ object Power {
|
||||
|
||||
// Redstone Flux
|
||||
|
||||
def fromRF(value: Int) = value * Settings.get.ratioRedstoneFlux
|
||||
def fromRF(value: Double) = value * Settings.get.ratioRedstoneFlux
|
||||
|
||||
def toRF(value: Double): Int = (value / Settings.get.ratioRedstoneFlux).toInt
|
||||
|
||||
// RotaryCraft
|
||||
|
||||
def fromWA(value: Double) = value * Settings.get.ratioRotaryCraft
|
||||
|
||||
def toWA(value: Double): Long = (value / Settings.get.ratioRotaryCraft).toLong
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user