Removed TElectric, a redundant trait
This commit is contained in:
parent
5c7fc91ada
commit
15bd9807ab
|
@ -19,12 +19,13 @@ import net.minecraftforge.common.MinecraftForge
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.lib.content.prefab.{TIO, TInventory}
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.grid.thermal.{BoilEvent, ThermalPhysics}
|
||||
import resonant.lib.network.discriminator.PacketType
|
||||
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
||||
import resonant.lib.prefab.tile.spatial.{SpatialBlock, SpatialTile}
|
||||
import resonant.lib.prefab.tile.traits.TElectric
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonant.lib.utility.FluidUtility
|
||||
import resonant.lib.wrapper.ByteBufWrapper._
|
||||
|
@ -35,7 +36,7 @@ import resonant.lib.wrapper.CollectionWrapper._
|
|||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TInventory with TElectric with TIO with TPacketSender with TPacketReceiver
|
||||
class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TInventory with TBlockNodeProvider with TIO with TPacketSender with TPacketReceiver
|
||||
{
|
||||
/**
|
||||
* 1KG of coal ~= 24MJ
|
||||
|
@ -45,8 +46,9 @@ 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
|
||||
protected val tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME)
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
private val energy = new EnergyStorage
|
||||
private var burnTime = 0
|
||||
private var heatEnergy = 0d
|
||||
|
||||
|
@ -159,6 +161,11 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
|||
return this.getBlockMetadata == 1
|
||||
}
|
||||
|
||||
def canBurn(stack: ItemStack): Boolean =
|
||||
{
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0
|
||||
}
|
||||
|
||||
override def randomDisplayTick(): Unit =
|
||||
{
|
||||
if (isBurning)
|
||||
|
@ -184,6 +191,8 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
|||
}
|
||||
}
|
||||
|
||||
def isBurning: Boolean = burnTime > 0
|
||||
|
||||
override def getSizeInventory = 1
|
||||
|
||||
def getMeltIronEnergy(volume: Float): Double =
|
||||
|
@ -198,11 +207,6 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
|||
return i == 0 && canBurn(itemStack)
|
||||
}
|
||||
|
||||
def canBurn(stack: ItemStack): Boolean =
|
||||
{
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method
|
||||
* Be sure to super this method or manually write the id into the packet when sending
|
||||
|
@ -293,8 +297,6 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
|||
return if (isBurning) (if (isElectric) SpatialBlock.icon.get("firebox_electric_side_on") else SpatialBlock.icon.get("firebox_side_on")) else (if (isElectric) SpatialBlock.icon.get("firebox_electric_side_off") else SpatialBlock.icon.get("firebox_side_off"))
|
||||
}
|
||||
|
||||
def isBurning: Boolean = burnTime > 0
|
||||
|
||||
override def click(player: EntityPlayer)
|
||||
{
|
||||
if (server)
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.block.material.Material
|
|||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.network.discriminator.PacketType
|
||||
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
||||
import resonant.lib.prefab.fluid.NodeFluid
|
||||
|
@ -17,7 +17,7 @@ import resonant.lib.wrapper.ByteBufWrapper._
|
|||
*
|
||||
* @author DarkGuardsman, Calclavia
|
||||
*/
|
||||
abstract class TileFluidProvider(material: Material) extends SpatialTile(material) with TSpatialNodeProvider with IFluidHandler with TPacketReceiver with TPacketSender
|
||||
abstract class TileFluidProvider(material: Material) extends SpatialTile(material) with TBlockNodeProvider with IFluidHandler with TPacketReceiver with TPacketSender
|
||||
{
|
||||
protected var colorID: Int = 0
|
||||
protected var clientRenderMask = 0x3F
|
||||
|
@ -33,6 +33,20 @@ abstract class TileFluidProvider(material: Material) extends SpatialTile(materia
|
|||
}
|
||||
}
|
||||
|
||||
def fluidNode = _fluidNode
|
||||
|
||||
def fluidNode_=(newNode: NodeFluid)
|
||||
{
|
||||
_fluidNode = newNode
|
||||
fluidNode.onConnectionChanged = () =>
|
||||
{
|
||||
clientRenderMask = fluidNode.connectedMask
|
||||
sendPacket(0)
|
||||
}
|
||||
fluidNode.onFluidChanged = () => if (!world.isRemote) sendPacket(1)
|
||||
nodes.add(fluidNode)
|
||||
}
|
||||
|
||||
override def write(buf: ByteBuf, id: Int)
|
||||
{
|
||||
super.write(buf, id)
|
||||
|
@ -94,20 +108,6 @@ abstract class TileFluidProvider(material: Material) extends SpatialTile(materia
|
|||
|
||||
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = fluidNode.drain(from, maxDrain, doDrain)
|
||||
|
||||
def fluidNode = _fluidNode
|
||||
|
||||
def fluidNode_=(newNode: NodeFluid)
|
||||
{
|
||||
_fluidNode = newNode
|
||||
fluidNode.onConnectionChanged = () =>
|
||||
{
|
||||
clientRenderMask = fluidNode.connectedMask
|
||||
sendPacket(0)
|
||||
}
|
||||
fluidNode.onFluidChanged = () => if (!world.isRemote) sendPacket(1)
|
||||
nodes.add(fluidNode)
|
||||
}
|
||||
|
||||
override def canFill(from: ForgeDirection, fluid: Fluid): Boolean = fluidNode.canFill(from, fluid)
|
||||
|
||||
override def canDrain(from: ForgeDirection, fluid: Fluid): Boolean = fluidNode.canDrain(from, fluid)
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package edx.core.prefab.part.connector
|
||||
|
||||
import java.util
|
||||
import java.util.{List => JList}
|
||||
|
||||
import codechicken.multipart.TMultiPart
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.api.ISave
|
||||
import resonant.api.tile.INodeProvider
|
||||
import resonant.api.tile.node.INode
|
||||
import resonant.lib.debug.IDebugInfo
|
||||
import resonant.lib.grid.core.Node
|
||||
import resonant.lib.grid.core.TNodeProvider
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
|
@ -18,10 +13,8 @@ import scala.collection.convert.wrapAll._
|
|||
* A node trait that can be mixed into any multipart nodes. Mixing this trait will cause nodes to reconstruct/deconstruct when needed.
|
||||
* @author Calclavia
|
||||
*/
|
||||
trait TPartNodeProvider extends PartAbstract with INodeProvider with IDebugInfo
|
||||
trait TPartNodeProvider extends PartAbstract with TNodeProvider
|
||||
{
|
||||
protected val nodes = new util.HashSet[Node]
|
||||
|
||||
override def start()
|
||||
{
|
||||
super.start()
|
||||
|
@ -65,20 +58,4 @@ trait TPartNodeProvider extends PartAbstract with INodeProvider with IDebugInfo
|
|||
super.load(nbt)
|
||||
nodes.filter(_.isInstanceOf[ISave]).foreach(_.asInstanceOf[ISave].load(nbt))
|
||||
}
|
||||
|
||||
override def getNode[N <: INode](nodeType: Class[_ <: N], from: ForgeDirection): N =
|
||||
{
|
||||
return nodes.filter(node => nodeType.isAssignableFrom(node.getClass)).headOption.getOrElse(null).asInstanceOf[N]
|
||||
}
|
||||
|
||||
override def getDebugInfo: JList[String] =
|
||||
{
|
||||
val debugs = nodes.toList.filter(_.isInstanceOf[IDebugInfo])
|
||||
|
||||
if (debugs.size > 0)
|
||||
{
|
||||
return debugs.map(_.asInstanceOf[IDebugInfo].getDebugInfo.toList).reduceLeft(_ ::: _)
|
||||
}
|
||||
return List[String]()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,13 @@ import net.minecraftforge.common.util.ForgeDirection
|
|||
import org.lwjgl.opengl.GL11._
|
||||
import resonant.api.items.ISimpleItemRenderer
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.network.discriminator.PacketType
|
||||
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.{TElectric, TEnergyProvider}
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
import resonant.lib.render.RenderUtility
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonant.lib.utility.science.UnitDisplay
|
||||
|
@ -47,8 +48,9 @@ object TileBattery
|
|||
def getEnergyForTier(tier: Int) = Math.round(Math.pow(500000000, (tier / (maxTier + 0.7f)) + 1) / 500000000) * 500000000
|
||||
}
|
||||
|
||||
class TileBattery extends SpatialTile(Material.iron) with TIO with TElectric with TSpatialNodeProvider with TPacketSender with TPacketReceiver with TEnergyProvider with ISimpleItemRenderer
|
||||
class TileBattery extends SpatialTile(Material.iron) with TIO with TBlockNodeProvider with TPacketSender with TPacketReceiver with TEnergyProvider with ISimpleItemRenderer
|
||||
{
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
var energyRenderLevel = 0
|
||||
|
||||
nodes.add(electricNode)
|
||||
|
@ -102,6 +104,7 @@ class TileBattery extends SpatialTile(Material.iron) with TIO with TElectric wit
|
|||
energyRenderLevel = Math.round((energy.value / TileBattery.getEnergyForTier(getBlockMetadata).toDouble) * 8).toInt
|
||||
sendDescPacket()
|
||||
}
|
||||
|
||||
/**
|
||||
* Update packet when energy level changes.
|
||||
|
||||
|
|
|
@ -11,9 +11,10 @@ import net.minecraftforge.client.model.AdvancedModelLoader
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import org.lwjgl.opengl.GL11
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.{TElectric, TRotatable}
|
||||
import resonant.lib.prefab.tile.traits.TRotatable
|
||||
import resonant.lib.render.RenderUtility
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
|
@ -40,9 +41,10 @@ object TileMotor
|
|||
val motorConstant = fieldStrength * area * coils
|
||||
}
|
||||
|
||||
class TileMotor extends SpatialTile(Material.iron) with TIO with TElectric with TSpatialNodeProvider with TRotatable
|
||||
class TileMotor extends SpatialTile(Material.iron) with TIO with TBlockNodeProvider with TRotatable
|
||||
{
|
||||
var mechNode = new NodeMechanical(this)
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
private val mechNode = new NodeMechanical(this)
|
||||
{
|
||||
override def canConnect(from: ForgeDirection): Boolean =
|
||||
{
|
||||
|
@ -67,8 +69,8 @@ class TileMotor extends SpatialTile(Material.iron) with TIO with TElectric with
|
|||
|
||||
override def start()
|
||||
{
|
||||
super.start()
|
||||
updateConnections()
|
||||
super.start()
|
||||
}
|
||||
|
||||
def updateConnections()
|
||||
|
|
|
@ -7,16 +7,18 @@ import net.minecraft.client.renderer.texture.IIconRegister
|
|||
import net.minecraft.util.IIcon
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.prefab.tile.spatial.{SpatialBlock, SpatialTile}
|
||||
import resonant.lib.prefab.tile.traits.TElectric
|
||||
import resonant.lib.render.block.RenderConnectedTexture
|
||||
import resonant.lib.transform.region.Cuboid
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
class TileSolarPanel extends SpatialTile(Material.iron) with TElectric with TSpatialNodeProvider with TIO with RenderConnectedTexture
|
||||
class TileSolarPanel extends SpatialTile(Material.iron) with TBlockNodeProvider with TIO with RenderConnectedTexture
|
||||
{
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
|
||||
ioMap = 728
|
||||
textureName = "solarPanel_top"
|
||||
bounds = new Cuboid(0, 0, 0, 1, 0.3f, 1)
|
||||
|
|
|
@ -8,20 +8,20 @@ import net.minecraft.init.Blocks
|
|||
import net.minecraft.util.IIcon
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.prefab.tile.spatial.{SpatialBlock, SpatialTile}
|
||||
import resonant.lib.prefab.tile.traits.TElectric
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
class TileThermopile extends SpatialTile(Material.rock) with TElectric with TSpatialNodeProvider with TIO
|
||||
class TileThermopile extends SpatialTile(Material.rock) with TBlockNodeProvider with TIO
|
||||
{
|
||||
/**
|
||||
* The amount of ticks the thermopile will use the temperature differences before turning all
|
||||
* adjacent sides to thermal equilibrium.
|
||||
*/
|
||||
private val maxTicks = 120 * 20
|
||||
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
private var ticksUsed = 0
|
||||
|
||||
ioMap = 728
|
||||
|
|
|
@ -18,11 +18,13 @@ import net.minecraft.util.ChatComponentText
|
|||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
||||
import resonant.lib.prefab.tile.mixed.TileElectric
|
||||
import resonant.lib.prefab.tile.multiblock.reference.{IMultiBlockStructure, MultiBlockHandler}
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
import resonant.lib.render.EnumColor
|
||||
import resonant.lib.transform.vector.{Vector3, VectorWorld}
|
||||
|
@ -43,13 +45,13 @@ object TileTesla
|
|||
final val DEFAULT_COLOR: Int = 12
|
||||
}
|
||||
|
||||
class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[TileTesla] with ITesla with TPacketReceiver with TPacketSender with TEnergyProvider with TIO
|
||||
class TileTesla extends SpatialTile(Material.iron) with TBlockNodeProvider with IMultiBlockStructure[TileTesla] with ITesla with TPacketReceiver with TPacketSender with TEnergyProvider with TIO
|
||||
{
|
||||
|
||||
final val TRANSFER_CAP: Double = 10000D
|
||||
/** Prevents transfer loops */
|
||||
final val outputBlacklist: Set[TileTesla] = new HashSet[TileTesla]
|
||||
final val connectedTeslas: Set[TileTesla] = new HashSet[TileTesla]
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
var dyeID: Int = TileTesla.DEFAULT_COLOR
|
||||
var canReceive: Boolean = true
|
||||
var attackEntities: Boolean = true
|
||||
|
@ -399,6 +401,12 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
getMultiBlock.save(nbt)
|
||||
}
|
||||
|
||||
def getMultiBlock: MultiBlockHandler[TileTesla] =
|
||||
{
|
||||
if (multiBlock == null) multiBlock = new MultiBlockHandler[TileTesla](this)
|
||||
return multiBlock
|
||||
}
|
||||
|
||||
def setLink(vector3: Vector3, dimID: Int, setOpponent: Boolean)
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
|
@ -602,12 +610,6 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
}
|
||||
}
|
||||
|
||||
def getMultiBlock: MultiBlockHandler[TileTesla] =
|
||||
{
|
||||
if (multiBlock == null) multiBlock = new MultiBlockHandler[TileTesla](this)
|
||||
return multiBlock
|
||||
}
|
||||
|
||||
def getLowestTesla: TileTesla =
|
||||
{
|
||||
var lowest: TileTesla = this
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.netty.buffer.ByteBuf
|
|||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.network.discriminator.PacketType
|
||||
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
|
@ -18,7 +18,7 @@ import scala.collection.convert.wrapAll._
|
|||
/** Prefab for resonantinduction.mechanical tiles
|
||||
*
|
||||
* @author Calclavia */
|
||||
abstract class TileMechanical(material: Material) extends SpatialTile(material: Material) with TRotatable with TSpatialNodeProvider with TPacketSender with TPacketReceiver
|
||||
abstract class TileMechanical(material: Material) extends SpatialTile(material: Material) with TRotatable with TBlockNodeProvider with TPacketSender with TPacketReceiver
|
||||
{
|
||||
/** Node that handles most mechanical actions */
|
||||
private var _mechanicalNode: NodeMechanical = null
|
||||
|
@ -42,18 +42,6 @@ abstract class TileMechanical(material: Material) extends SpatialTile(material:
|
|||
return false
|
||||
}
|
||||
|
||||
def mechanicalNode = _mechanicalNode
|
||||
|
||||
def mechanicalNode_=(newNode: NodeMechanical)
|
||||
{
|
||||
_mechanicalNode = newNode
|
||||
mechanicalNode.onVelocityChanged = () => sendPacket(1)
|
||||
nodes.removeAll(nodes.filter(_.isInstanceOf[NodeMechanical]))
|
||||
nodes.add(mechanicalNode)
|
||||
}
|
||||
|
||||
mechanicalNode = new NodeMechanical(this)
|
||||
|
||||
override def write(buf: ByteBuf, id: Int)
|
||||
{
|
||||
super.write(buf, id)
|
||||
|
@ -65,6 +53,8 @@ abstract class TileMechanical(material: Material) extends SpatialTile(material:
|
|||
}
|
||||
}
|
||||
|
||||
def mechanicalNode = _mechanicalNode
|
||||
|
||||
override def read(buf: ByteBuf, id: Int, packetType: PacketType)
|
||||
{
|
||||
super.read(buf, id, packetType)
|
||||
|
@ -76,4 +66,18 @@ abstract class TileMechanical(material: Material) extends SpatialTile(material:
|
|||
}
|
||||
}
|
||||
|
||||
def mechanicalNode_=(newNode: NodeMechanical)
|
||||
{
|
||||
_mechanicalNode = newNode
|
||||
mechanicalNode.onVelocityChanged = () => sendPacket(1)
|
||||
nodes.removeAll(nodes.filter(_.isInstanceOf[NodeMechanical]))
|
||||
nodes.add(mechanicalNode)
|
||||
}
|
||||
|
||||
mechanicalNode = new NodeMechanical(this)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@ import net.minecraftforge.client.model.AdvancedModelLoader
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import org.lwjgl.opengl.GL11
|
||||
import org.lwjgl.opengl.GL11._
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TRotatable
|
||||
|
@ -38,7 +38,7 @@ object TileLaserEmitter
|
|||
val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "laserEmitter.png")
|
||||
}
|
||||
|
||||
class TileLaserEmitter extends SpatialTile(Material.iron) with ILaserHandler with TSpatialNodeProvider with TRotatable
|
||||
class TileLaserEmitter extends SpatialTile(Material.iron) with ILaserHandler with TBlockNodeProvider with TRotatable
|
||||
{
|
||||
val electricNode = new NodeElectricComponent(this)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.util.{MovingObjectPosition, ResourceLocation}
|
|||
import net.minecraftforge.client.model.AdvancedModelLoader
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import org.lwjgl.opengl.GL11._
|
||||
import resonant.lib.grid.core.TSpatialNodeProvider
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TRotatable
|
||||
|
@ -30,7 +30,7 @@ object TileLaserReceiver
|
|||
@SideOnly(Side.CLIENT) val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "laserReceiver.png")
|
||||
}
|
||||
|
||||
class TileLaserReceiver extends SpatialTile(Material.rock) with ILaserHandler with TSpatialNodeProvider with TRotatable
|
||||
class TileLaserReceiver extends SpatialTile(Material.rock) with ILaserHandler with TBlockNodeProvider with TRotatable
|
||||
{
|
||||
val electricNode = new NodeElectricComponent(this)
|
||||
|
||||
|
|
|
@ -13,17 +13,18 @@ import net.minecraft.nbt.NBTTagCompound
|
|||
import net.minecraft.util.IIcon
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.api.tile.{IElectromagnet, IRotatable}
|
||||
import resonant.lib.content.prefab.TInventory
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.{TPacketIDReceiver, TPacketSender}
|
||||
import resonant.lib.prefab.tile.mixed.TileElectricInventory
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonant.lib.utility.BlockUtility
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
class TileAccelerator extends TileElectricInventory(Material.iron) with IElectromagnet with IRotatable with TPacketIDReceiver with TPacketSender with TEnergyProvider
|
||||
class TileAccelerator extends SpatialTile(Material.iron) with TInventory with IElectromagnet with IRotatable with TPacketIDReceiver with TPacketSender with TEnergyProvider
|
||||
{
|
||||
final val DESC_PACKET_ID = 2
|
||||
/**
|
||||
|
@ -220,20 +221,6 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
|
|||
return 0
|
||||
}
|
||||
|
||||
override def getDirection: ForgeDirection =
|
||||
{
|
||||
return ForgeDirection.getOrientation(getBlockMetadata)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
/// Save handling ///
|
||||
////////////////////////////////////////
|
||||
|
||||
override def setDirection(direction: ForgeDirection)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal, 3)
|
||||
}
|
||||
|
||||
override def activate(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
player.openGui(Electrodynamics, 0, world, xi, yi, zi)
|
||||
|
@ -241,7 +228,7 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
|
|||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
/// Inventory Overrides ///
|
||||
/// Save handling ///
|
||||
////////////////////////////////////////
|
||||
|
||||
override def read(buf: ByteBuf, id: Int, player: EntityPlayer, packet: PacketType): Boolean =
|
||||
|
@ -269,6 +256,10 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
|
|||
antimatter = par1NBTTagCompound.getInteger("antimatter")
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
/// Inventory Overrides ///
|
||||
////////////////////////////////////////
|
||||
|
||||
override def writeToNBT(par1NBTTagCompound: NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound)
|
||||
|
@ -276,10 +267,6 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
|
|||
par1NBTTagCompound.setInteger("antimatter", antimatter)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
/// Field Getters & Setters ///
|
||||
////////////////////////////////////////
|
||||
|
||||
override def canInsertItem(slotID: Int, itemStack: ItemStack, j: Int): Boolean =
|
||||
{
|
||||
return isItemValidForSlot(slotID, itemStack) && slotID != 2 && slotID != 3
|
||||
|
@ -301,6 +288,10 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
|
|||
return false
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
/// Field Getters & Setters ///
|
||||
////////////////////////////////////////
|
||||
|
||||
override def canExtractItem(slotID: Int, itemstack: ItemStack, j: Int): Boolean =
|
||||
{
|
||||
return slotID == 2 || slotID == 3
|
||||
|
@ -320,4 +311,14 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
|
|||
}
|
||||
return getIcon
|
||||
}
|
||||
|
||||
override def getDirection: ForgeDirection =
|
||||
{
|
||||
return ForgeDirection.getOrientation(getBlockMetadata)
|
||||
}
|
||||
|
||||
override def setDirection(direction: ForgeDirection)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal, 3)
|
||||
}
|
||||
}
|
|
@ -11,11 +11,13 @@ import net.minecraft.network.Packet
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.core.ResonantEngine
|
||||
import resonant.lib.content.prefab.TIO
|
||||
import resonant.lib.content.prefab.{TIO, TInventory}
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
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.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.{TEnergyProvider, TRotatable}
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
|
@ -27,14 +29,12 @@ object TileNuclearBoiler
|
|||
final val power: Long = 50000
|
||||
}
|
||||
|
||||
class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with TRotatable with TEnergyProvider with TIO
|
||||
class TileNuclearBoiler extends SpatialTile(Material.iron) with TInventory with TBlockNodeProvider with IPacketReceiver with IFluidHandler with TRotatable with TEnergyProvider with TIO
|
||||
{
|
||||
final val totalTime: Int = 20 * 15
|
||||
|
||||
final val waterTank: FluidTank = new FluidTank(QuantumContent.fluidStackWater.copy, FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||
|
||||
final val gasTank: FluidTank = new FluidTank(QuantumContent.fluidStackUraniumHexaflouride.copy, FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
var timer: Int = 0
|
||||
|
||||
var rotation: Float = 0
|
||||
|
|
|
@ -11,12 +11,14 @@ 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.TIO
|
||||
import resonant.lib.content.prefab.{TIO, TInventory}
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
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.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.{TEnergyProvider, TRotatable}
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
|
@ -29,9 +31,10 @@ object TileCentrifuge
|
|||
final val DIAN: Long = 500000
|
||||
}
|
||||
|
||||
class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketReceiver with IFluidHandler with IInventory with TEnergyProvider with TRotatable with TIO
|
||||
class TileCentrifuge extends SpatialTile(Material.iron) with TInventory with TBlockNodeProvider with IPacketReceiver with IFluidHandler with IInventory with TEnergyProvider with TRotatable with TIO
|
||||
{
|
||||
val gasTank: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 5)
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
var timer: Int = 0
|
||||
var rotation: Float = 0
|
||||
|
||||
|
@ -148,22 +151,6 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
|
|||
return false
|
||||
}
|
||||
|
||||
override def isItemValidForSlot(i: Int, itemStack: ItemStack): Boolean =
|
||||
{
|
||||
i match
|
||||
{
|
||||
case 0 =>
|
||||
return Compatibility.isHandler(itemStack.getItem, null)
|
||||
case 1 =>
|
||||
return true
|
||||
case 2 =>
|
||||
return itemStack.getItem eq QuantumContent.itemUranium
|
||||
case 3 =>
|
||||
return itemStack.getItem eq QuantumContent.itemUranium
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
openGui(player, QuantumContent)
|
||||
|
@ -258,6 +245,22 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
|
|||
return slotID == 1 && this.isItemValidForSlot(slotID, itemStack)
|
||||
}
|
||||
|
||||
override def isItemValidForSlot(i: Int, itemStack: ItemStack): Boolean =
|
||||
{
|
||||
i match
|
||||
{
|
||||
case 0 =>
|
||||
return Compatibility.isHandler(itemStack.getItem, null)
|
||||
case 1 =>
|
||||
return true
|
||||
case 2 =>
|
||||
return itemStack.getItem eq QuantumContent.itemUranium
|
||||
case 3 =>
|
||||
return itemStack.getItem eq QuantumContent.itemUranium
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override def canExtractItem(slotID: Int, itemstack: ItemStack, j: Int): Boolean =
|
||||
{
|
||||
return slotID == 2 || slotID == 3
|
||||
|
|
|
@ -4,14 +4,16 @@ import net.minecraft.block.material.Material
|
|||
import net.minecraft.item.ItemStack
|
||||
import net.minecraftforge.fluids.{FluidContainerRegistry, FluidStack, FluidTank}
|
||||
import resonant.api.recipe.{MachineRecipes, RecipeResource}
|
||||
import resonant.lib.prefab.tile.mixed.TileElectricInventory
|
||||
import resonant.lib.content.prefab.TInventory
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
|
||||
/**
|
||||
* General class for all machines that do traditional recipe processing
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
abstract class TileProcess(material: Material) extends TileElectricInventory(material)
|
||||
abstract class TileProcess(material: Material) extends SpatialTile(material) with TInventory with TBlockNodeProvider
|
||||
{
|
||||
protected var inputSlot: Int = 0
|
||||
protected var outputSlot: Int = 0
|
||||
|
|
|
@ -2,7 +2,7 @@ package edx.quantum.machine.fulmination
|
|||
|
||||
import net.minecraft.block.material.Material
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.prefab.tile.mixed.TileElectric
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@ object TileFulmination
|
|||
private final val maxEnergy: Long = 10000000000000L
|
||||
}
|
||||
|
||||
class TileFulmination extends TileElectric(Material.iron) with TEnergyProvider
|
||||
class TileFulmination extends SpatialTile(Material.iron) with TEnergyProvider
|
||||
{
|
||||
//TODO: Dummy
|
||||
energy = new EnergyStorage
|
||||
|
|
|
@ -12,11 +12,13 @@ import net.minecraft.network.Packet
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import resonant.core.ResonantEngine
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.mod.config.Config
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.IPacketReceiver
|
||||
import resonant.lib.prefab.tile.mixed.TileElectric
|
||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonant.lib.utility.science.UnitDisplay
|
||||
|
@ -28,11 +30,12 @@ object TilePlasmaHeater
|
|||
@Config var plasmaHeatAmount: Int = 100
|
||||
}
|
||||
|
||||
class TilePlasmaHeater extends TileElectric(Material.iron) with IPacketReceiver with IFluidHandler with TEnergyProvider
|
||||
class TilePlasmaHeater extends SpatialTile(Material.iron) with TBlockNodeProvider with IPacketReceiver with IFluidHandler with TEnergyProvider
|
||||
{
|
||||
final val tankInputDeuterium: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10)
|
||||
final val tankInputTritium: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10)
|
||||
final val tankOutput: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10)
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
var rotation: Float = 0
|
||||
|
||||
//Constructor
|
||||
|
|
|
@ -9,10 +9,13 @@ 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.TInventory
|
||||
import resonant.lib.grid.core.TBlockNodeProvider
|
||||
import resonant.lib.grid.energy.EnergyStorage
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
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.spatial.SpatialTile
|
||||
import resonant.lib.prefab.tile.traits.TEnergyProvider
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
|
@ -21,8 +24,10 @@ import resonant.lib.transform.vector.Vector3
|
|||
*
|
||||
* @author Calclavia, Darkguardsman
|
||||
*/
|
||||
class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPacketReceiver with TEnergyProvider
|
||||
class TileQuantumAssembler extends SpatialTile(Material.iron) with TInventory with TBlockNodeProvider with IPacketReceiver with TEnergyProvider
|
||||
{
|
||||
private val electricNode = new NodeElectricComponent(this)
|
||||
|
||||
private[quantum] var power: Long = 1000000000L
|
||||
private[quantum] var MAX_TIME: Int = 20 * 120
|
||||
private[quantum] var time: Int = 0
|
||||
|
@ -44,6 +49,7 @@ class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPa
|
|||
normalRender = false
|
||||
customItemRender = true
|
||||
textureName = "machine"
|
||||
nodes.add(electricNode)
|
||||
|
||||
override def getSizeInventory: Int = 7
|
||||
|
||||
|
|
Loading…
Reference in New Issue