Fixed energy related error
This commit is contained in:
parent
5c00d74116
commit
1e74eebf09
8 changed files with 45 additions and 53 deletions
|
@ -44,15 +44,14 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
|||
* into fluids to increase their internal energy.
|
||||
*/
|
||||
private final val power = 100000
|
||||
val energy = new EnergyStorage(0)
|
||||
val energy = new EnergyStorage
|
||||
protected val tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME)
|
||||
private var burnTime = 0
|
||||
private var heatEnergy = 0d
|
||||
|
||||
tickRandomly = true
|
||||
private var boiledVolume = 0
|
||||
energy.setCapacity(power)
|
||||
energy.setMaxTransfer((power * 2) / 20)
|
||||
energy.max = power
|
||||
setIO(ForgeDirection.UP, 0)
|
||||
|
||||
override def update()
|
||||
|
@ -72,9 +71,9 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
|||
sendPacket(0)
|
||||
}
|
||||
}
|
||||
else if (isElectrical && energy.checkExtract)
|
||||
else if (isElectrical && energy >= power / 20)
|
||||
{
|
||||
energy.extractEnergy
|
||||
energy -= power / 20
|
||||
if (burnTime == 0)
|
||||
{
|
||||
sendPacket(0)
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.{IIcon, MovingObjectPosition}
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import org.lwjgl.opengl.GL11
|
||||
import resonant.api.tile.INodeProvider
|
||||
import resonant.lib.grid.energy.electric.{NodeDC, NodeDCWire}
|
||||
import resonant.lib.grid.energy.electric.{NodeDC, NodeDCJunction}
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
|
@ -338,7 +338,7 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
* TODO: ForgeDirection may NOT be suitable. Integers are better.
|
||||
* @param provider
|
||||
*/
|
||||
class NodeFlatWire(provider: INodeProvider) extends NodeDCWire(provider) with TMultipartNode[NodeDC]
|
||||
class NodeFlatWire(provider: INodeProvider) extends NodeDCJunction(provider) with TMultipartNode[NodeDC]
|
||||
{
|
||||
override def reconstruct()
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ class GuiNuclearBoiler(player: EntityPlayer, tileEntity: TileNuclearBoiler) exte
|
|||
override def drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int)
|
||||
{
|
||||
this.fontRendererObj.drawString("Boiler", 52, 6, 4210752)
|
||||
this.renderUniversalDisplay(8, 112, TileNuclearBoiler.DIAN * 20, mouseX, mouseY, UnitDisplay.Unit.WATT)
|
||||
this.renderUniversalDisplay(8, 112, TileNuclearBoiler.power * 20, mouseX, mouseY, UnitDisplay.Unit.WATT)
|
||||
//this.renderUniversalDisplay(110, 112, tileEntity.getVoltage, mouseX, mouseY, UnitDisplay.Unit.VOLTAGE)
|
||||
this.fontRendererObj.drawString("The nuclear boiler can boil", 8, 75, 4210752)
|
||||
this.fontRendererObj.drawString("yellow cake into uranium", 8, 85, 4210752)
|
||||
|
@ -40,7 +40,7 @@ class GuiNuclearBoiler(player: EntityPlayer, tileEntity: TileNuclearBoiler) exte
|
|||
super.drawGuiContainerBackgroundLayer(par1, x, y)
|
||||
this.drawSlot(55, 25, SlotType.BATTERY)
|
||||
this.drawSlot(80, 25)
|
||||
this.drawBar(110, 26, this.tileEntity.timer.asInstanceOf[Float] / this.tileEntity.SHI_JIAN.asInstanceOf[Float])
|
||||
this.drawBar(110, 26, this.tileEntity.timer.asInstanceOf[Float] / this.tileEntity.totalTime.asInstanceOf[Float])
|
||||
this.drawMeter(8, 18, this.tileEntity.waterTank.getFluidAmount.asInstanceOf[Float] / this.tileEntity.waterTank.getCapacity.asInstanceOf[Float], this.tileEntity.waterTank.getFluid)
|
||||
this.drawSlot(24, 49, SlotType.LIQUID)
|
||||
this.drawMeter(155, 18, this.tileEntity.gasTank.getFluidAmount.asInstanceOf[Float] / this.tileEntity.gasTank.getCapacity.asInstanceOf[Float], this.tileEntity.gasTank.getFluid)
|
||||
|
|
|
@ -11,13 +11,12 @@ import net.minecraft.network.Packet
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.engine.ResonantEngine
|
||||
import resonant.lib.content.prefab.{TEnergyStorage, TIO}
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.network.Synced
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.IPacketReceiver
|
||||
import resonant.lib.prefab.tile.mixed.TileElectricInventory
|
||||
import resonant.lib.prefab.tile.traits.TRotatable
|
||||
import resonant.lib.prefab.tile.traits.{TEnergyProvider, TRotatable}
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/**
|
||||
|
@ -25,28 +24,24 @@ import resonant.lib.transform.vector.Vector3
|
|||
*/
|
||||
object TileNuclearBoiler
|
||||
{
|
||||
final val DIAN: Long = 50000
|
||||
final val power: Long = 50000
|
||||
}
|
||||
|
||||
class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with TRotatable with TEnergyStorage with TIO
|
||||
class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with TRotatable with TEnergyProvider with TIO
|
||||
{
|
||||
final val SHI_JIAN: Int = 20 * 15
|
||||
final val totalTime: Int = 20 * 15
|
||||
|
||||
@Synced
|
||||
final val waterTank: FluidTank = new FluidTank(QuantumContent.FLUIDSTACK_WATER.copy, FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||
|
||||
@Synced
|
||||
final val gasTank: FluidTank = new FluidTank(QuantumContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy, FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||
|
||||
@Synced
|
||||
var timer: Int = 0
|
||||
|
||||
var rotation: Float = 0
|
||||
|
||||
//Constructor
|
||||
//TODO: Dummy
|
||||
energy = new EnergyStorage(0)
|
||||
energy.setCapacity(TileNuclearBoiler.DIAN * 2)
|
||||
energy = new EnergyStorage
|
||||
normalRender = false
|
||||
isOpaqueCube = false
|
||||
|
||||
|
@ -87,18 +82,18 @@ class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacke
|
|||
if (this.nengYong)
|
||||
{
|
||||
//discharge(getStackInSlot(0))
|
||||
if (energy.extractEnergy(TileNuclearBoiler.DIAN, false) >= TileNuclearBoiler.DIAN)
|
||||
if (energy >= TileNuclearBoiler.power)
|
||||
{
|
||||
if (this.timer == 0)
|
||||
{
|
||||
this.timer = SHI_JIAN
|
||||
this.timer = totalTime
|
||||
}
|
||||
if (this.timer > 0)
|
||||
{
|
||||
this.timer -= 1
|
||||
if (this.timer < 1)
|
||||
{
|
||||
this.yong
|
||||
this.use
|
||||
this.timer = 0
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +101,7 @@ class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacke
|
|||
{
|
||||
this.timer = 0
|
||||
}
|
||||
energy.extractEnergy(TileNuclearBoiler.DIAN, true)
|
||||
energy -= TileNuclearBoiler.power
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -130,7 +125,7 @@ class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacke
|
|||
/**
|
||||
* Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack.
|
||||
*/
|
||||
def yong
|
||||
def use
|
||||
{
|
||||
if (this.nengYong)
|
||||
{
|
||||
|
|
|
@ -11,13 +11,13 @@ import net.minecraft.nbt.NBTTagCompound
|
|||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.lib.content.prefab.{TEnergyStorage, TIO}
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.mod.compat.energy.Compatibility
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.IPacketReceiver
|
||||
import resonant.lib.prefab.tile.mixed.TileElectricInventory
|
||||
import resonant.lib.prefab.tile.traits.TRotatable
|
||||
import resonant.lib.prefab.tile.traits.{TEnergyProvider, TRotatable}
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/**
|
||||
|
@ -29,17 +29,16 @@ object TileCentrifuge
|
|||
final val DIAN: Long = 500000
|
||||
}
|
||||
|
||||
class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with IInventory with TEnergyStorage with TRotatable with TIO
|
||||
class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with IInventory with TEnergyProvider with TRotatable with TIO
|
||||
{
|
||||
val gasTank: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||
var timer: Int = 0
|
||||
var rotation: Float = 0
|
||||
|
||||
//TODO: Dummy
|
||||
energy = new EnergyStorage(0)
|
||||
energy = new EnergyStorage
|
||||
isOpaqueCube = false
|
||||
normalRender = false
|
||||
energy.setCapacity(TileCentrifuge.DIAN * 2)
|
||||
energy.max = TileCentrifuge.DIAN * 2
|
||||
|
||||
override def getSizeInventory: Int = 4
|
||||
|
||||
|
@ -83,7 +82,7 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
|
|||
if (this.nengYong)
|
||||
{
|
||||
//discharge(getStackInSlot(0))
|
||||
if (energy.extractEnergy(TileCentrifuge.DIAN, false) >= TileCentrifuge.DIAN)
|
||||
if (energy >= TileCentrifuge.DIAN)
|
||||
{
|
||||
if (this.timer == 0)
|
||||
{
|
||||
|
@ -102,7 +101,7 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
|
|||
{
|
||||
this.timer = 0
|
||||
}
|
||||
energy.extractEnergy(TileCentrifuge.DIAN, true)
|
||||
energy -= TileCentrifuge.DIAN
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -10,12 +10,12 @@ import net.minecraft.network.Packet
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.engine.ResonantEngine
|
||||
import resonant.lib.content.prefab.{TEnergyStorage, TIO}
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.mod.compat.energy.Compatibility
|
||||
import resonant.lib.network.Synced
|
||||
import resonant.lib.network.discriminator.PacketAnnotation
|
||||
import resonant.lib.prefab.tile.traits.TRotatable
|
||||
import resonant.lib.prefab.tile.traits.{TEnergyProvider, TRotatable}
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/**
|
||||
|
@ -28,11 +28,11 @@ object TileChemicalExtractor
|
|||
final val ENERGY: Long = 5000
|
||||
}
|
||||
|
||||
class TileChemicalExtractor extends TileProcess(Material.iron) with IFluidHandler with TEnergyStorage with TRotatable with TIO
|
||||
class TileChemicalExtractor extends TileProcess(Material.iron) with IFluidHandler with TEnergyProvider with TRotatable with TIO
|
||||
{
|
||||
//TODO: Dummy
|
||||
energy = new EnergyStorage(0)
|
||||
energy.setCapacity(TileChemicalExtractor.ENERGY * 2)
|
||||
energy = new EnergyStorage
|
||||
energy.max = TileChemicalExtractor.ENERGY * 2
|
||||
isOpaqueCube = false
|
||||
normalRender = false
|
||||
inputSlot = 1
|
||||
|
@ -61,7 +61,7 @@ class TileChemicalExtractor extends TileProcess(Material.iron) with IFluidHandle
|
|||
if (canUse)
|
||||
{
|
||||
//discharge(getStackInSlot(0))
|
||||
if (energy.checkExtract(TileChemicalExtractor.ENERGY))
|
||||
if (energy >= TileChemicalExtractor.ENERGY)
|
||||
{
|
||||
if (time == 0)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ class TileChemicalExtractor extends TileProcess(Material.iron) with IFluidHandle
|
|||
time = 0
|
||||
}
|
||||
}
|
||||
energy.extractEnergy(TileChemicalExtractor.ENERGY, true)
|
||||
energy -= TileChemicalExtractor.ENERGY
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package edx.quantum.machine.fulmination
|
||||
|
||||
import net.minecraft.block.material.Material
|
||||
import resonant.lib.content.prefab.TEnergyStorage
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.prefab.tile.mixed.TileElectric
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
|
||||
/**
|
||||
* Fulmination TileEntity
|
||||
|
@ -13,11 +13,11 @@ object TileFulmination
|
|||
private final val maxEnergy: Long = 10000000000000L
|
||||
}
|
||||
|
||||
class TileFulmination extends TileElectric(Material.iron) with TEnergyStorage
|
||||
class TileFulmination extends TileElectric(Material.iron) with TEnergyProvider
|
||||
{
|
||||
//TODO: Dummy
|
||||
energy = new EnergyStorage(0)
|
||||
energy.setCapacity(TileFulmination.maxEnergy * 2)
|
||||
energy = new EnergyStorage
|
||||
energy.max = TileFulmination.maxEnergy * 2
|
||||
blockHardness = 10
|
||||
blockResistance = 25000
|
||||
|
||||
|
@ -30,7 +30,7 @@ class TileFulmination extends TileElectric(Material.iron) with TEnergyStorage
|
|||
override def update
|
||||
{
|
||||
super.update
|
||||
energy.extractEnergy(10, true)
|
||||
energy -= 10
|
||||
}
|
||||
|
||||
override def invalidate
|
||||
|
|
|
@ -9,11 +9,11 @@ import net.minecraft.entity.player.EntityPlayer
|
|||
import net.minecraft.item.{Item, ItemStack}
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import resonant.api.recipe.QuantumAssemblerRecipes
|
||||
import resonant.lib.content.prefab.TEnergyStorage
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.IPacketReceiver
|
||||
import resonant.lib.prefab.tile.mixed.TileElectricInventory
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/**
|
||||
|
@ -21,9 +21,9 @@ import resonant.lib.transform.vector.Vector3
|
|||
*
|
||||
* @author Calclavia, Darkguardsman
|
||||
*/
|
||||
class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPacketReceiver with TEnergyStorage
|
||||
class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPacketReceiver with TEnergyProvider
|
||||
{
|
||||
private[quantum] var ENERGY: Long = 1000000000L
|
||||
private[quantum] var power: Long = 1000000000L
|
||||
private[quantum] var MAX_TIME: Int = 20 * 120
|
||||
private[quantum] var time: Int = 0
|
||||
/**
|
||||
|
@ -38,9 +38,8 @@ class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPa
|
|||
//Constructor
|
||||
|
||||
//TODO: Dummy
|
||||
energy = new EnergyStorage(0)
|
||||
energy.setCapacity(ENERGY)
|
||||
energy.setMaxTransfer(ENERGY / 10)
|
||||
energy = new EnergyStorage
|
||||
energy.max = power
|
||||
isOpaqueCube = false
|
||||
normalRender = false
|
||||
customItemRender = true
|
||||
|
@ -67,7 +66,7 @@ class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPa
|
|||
{
|
||||
if (this.canProcess)
|
||||
{
|
||||
if (energy.checkExtract)
|
||||
if (energy >= power / 20)
|
||||
{
|
||||
if (this.time == 0)
|
||||
{
|
||||
|
@ -86,7 +85,7 @@ class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPa
|
|||
{
|
||||
this.time = 0
|
||||
}
|
||||
energy.extractEnergy(ENERGY, true)
|
||||
energy -= power / 20
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue