Added alternating current
This commit is contained in:
parent
1fc51def45
commit
21504bb3e4
3 changed files with 16 additions and 16 deletions
|
@ -2,12 +2,12 @@ package edx.electrical.transformer
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.api.tile.INodeProvider
|
||||
import resonant.lib.grid.energy.electric.NodeDC
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
|
||||
/**
|
||||
* Created by robert on 8/11/2014.
|
||||
*/
|
||||
class ElectricTransformerNode(parent: INodeProvider) extends NodeDC(parent: INodeProvider)
|
||||
class ElectricTransformerNode(parent: INodeProvider) extends NodeElectricComponent(parent: INodeProvider)
|
||||
{
|
||||
var connectionDirection: ForgeDirection = ForgeDirection.NORTH
|
||||
var input = true
|
||||
|
@ -30,7 +30,7 @@ class ElectricTransformerNode(parent: INodeProvider) extends NodeDC(parent: INod
|
|||
return 120
|
||||
}
|
||||
|
||||
override def canConnect[B <: NodeDC](obj: B, from: ForgeDirection): Boolean =
|
||||
override def canConnect[B <: NodeElectricComponent](obj: B, from: ForgeDirection): Boolean =
|
||||
{
|
||||
return obj.isInstanceOf[INodeProvider] && from == connectionDirection
|
||||
}
|
||||
|
|
|
@ -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, NodeDCJunction}
|
||||
import resonant.lib.grid.energy.electric.{NodeElectricComponent, NodeElectricJunction}
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
|
@ -309,8 +309,6 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
return false
|
||||
}
|
||||
|
||||
def useStaticRenderer: Boolean = true
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
|
@ -326,6 +324,8 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
}
|
||||
}
|
||||
|
||||
def useStaticRenderer: Boolean = true
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def drawBreaking(renderBlocks: RenderBlocks)
|
||||
{
|
||||
|
@ -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 NodeDCJunction(provider) with TMultipartNode[NodeDC]
|
||||
class NodeFlatWire(provider: INodeProvider) extends NodeElectricJunction(provider) with TMultipartNode[NodeElectricComponent]
|
||||
{
|
||||
override def reconstruct()
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
|
||||
if (part != null)
|
||||
{
|
||||
val node = part.asInstanceOf[INodeProvider].getNode(classOf[NodeDC], from)
|
||||
val node = part.asInstanceOf[INodeProvider].getNode(classOf[NodeElectricComponent], from)
|
||||
|
||||
if (canConnect(node, to))
|
||||
{
|
||||
|
@ -490,7 +490,7 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
val part = tpCorner.partMap(absDir ^ 1)
|
||||
val absToDir = ForgeDirection.getOrientation(absDir)
|
||||
val absFromDir = ForgeDirection.getOrientation(absDir).getOpposite
|
||||
val node = part.asInstanceOf[INodeProvider].getNode(classOf[NodeDC], absFromDir)
|
||||
val node = part.asInstanceOf[INodeProvider].getNode(classOf[NodeElectricComponent], absFromDir)
|
||||
|
||||
if (canConnect(node, absFromDir))
|
||||
{
|
||||
|
@ -509,7 +509,7 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
val facePart = tile.partMap(absDir)
|
||||
val toDir = ForgeDirection.getOrientation(absDir)
|
||||
|
||||
if (facePart != null && (!facePart.isInstanceOf[PartFlatWire] || !canConnect(facePart.asInstanceOf[INodeProvider].getNode(classOf[NodeDC], toDir.getOpposite), toDir.getOpposite)))
|
||||
if (facePart != null && (!facePart.isInstanceOf[PartFlatWire] || !canConnect(facePart.asInstanceOf[INodeProvider].getNode(classOf[NodeElectricComponent], toDir.getOpposite), toDir.getOpposite)))
|
||||
{
|
||||
return false
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
return false
|
||||
}
|
||||
|
||||
override def canConnect[B <: NodeDC](node: B, from: ForgeDirection): Boolean =
|
||||
override def canConnect[B <: NodeElectricComponent](node: B, from: ForgeDirection): Boolean =
|
||||
{
|
||||
if (node.isInstanceOf[NodeFlatWire])
|
||||
{
|
||||
|
@ -862,10 +862,10 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
/**
|
||||
* Gets a potential DCNode from an object.
|
||||
*/
|
||||
private def getComponent(obj: AnyRef, from: ForgeDirection): NodeDC =
|
||||
private def getComponent(obj: AnyRef, from: ForgeDirection): NodeElectricComponent =
|
||||
{
|
||||
if (obj.isInstanceOf[INodeProvider])
|
||||
return obj.asInstanceOf[INodeProvider].getNode(classOf[NodeDC], from)
|
||||
return obj.asInstanceOf[INodeProvider].getNode(classOf[NodeElectricComponent], from)
|
||||
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import edx.electrical.wire.base.TWire
|
|||
import net.minecraft.client.renderer.RenderBlocks
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.lib.grid.energy.electric.NodeDC
|
||||
import resonant.lib.grid.energy.electric.NodeElectricComponent
|
||||
import resonant.lib.wrapper.BitmaskWrapper._
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ import resonant.lib.wrapper.BitmaskWrapper._
|
|||
*/
|
||||
class PartFramedWire extends PartFramedNode with TWire
|
||||
{
|
||||
override lazy val node = new NodeDC(this) with TMultipartNode[NodeDC]
|
||||
override lazy val node = new NodeElectricComponent(this) with TMultipartNode[NodeElectricComponent]
|
||||
{
|
||||
override def reconstruct()
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ class PartFramedWire extends PartFramedNode with TWire
|
|||
sendPacket(0)
|
||||
}
|
||||
|
||||
override def connect[B <: NodeDC](obj: B, dir: ForgeDirection) =
|
||||
override def connect[B <: NodeElectricComponent](obj: B, dir: ForgeDirection) =
|
||||
{
|
||||
super.connect(obj, dir)
|
||||
connectionMask = connectionMask.openMask(dir)
|
||||
|
|
Loading…
Reference in a new issue