Current now flows, but still contains glitches
This commit is contained in:
parent
1b19ff33c6
commit
c63f3d4eaf
3 changed files with 106 additions and 120 deletions
|
@ -63,28 +63,6 @@ trait TInsulatable extends PartAbstract
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override def write(packet: MCDataOutput, id: Int)
|
|
||||||
{
|
|
||||||
super.write(packet, id)
|
|
||||||
|
|
||||||
if (id <= 1)
|
|
||||||
packet.writeBoolean(insulated)
|
|
||||||
}
|
|
||||||
|
|
||||||
override def read(packet: MCDataInput, packetID: Int)
|
|
||||||
{
|
|
||||||
super.read(packet, packetID)
|
|
||||||
|
|
||||||
if (packetID <= 1)
|
|
||||||
_insulated = packet.readBoolean
|
|
||||||
}
|
|
||||||
|
|
||||||
override def save(nbt: NBTTagCompound)
|
|
||||||
{
|
|
||||||
super.save(nbt)
|
|
||||||
nbt.setBoolean("isInsulated", insulated)
|
|
||||||
}
|
|
||||||
|
|
||||||
def insulated: Boolean = _insulated
|
def insulated: Boolean = _insulated
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,6 +86,24 @@ trait TInsulatable extends PartAbstract
|
||||||
tile.getWriteStream(this).writeByte(1).writeBoolean(this._insulated)
|
tile.getWriteStream(this).writeByte(1).writeBoolean(this._insulated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def write(packet: MCDataOutput, id: Int)
|
||||||
|
{
|
||||||
|
if (id <= 1)
|
||||||
|
packet.writeBoolean(insulated)
|
||||||
|
}
|
||||||
|
|
||||||
|
override def read(packet: MCDataInput, packetID: Int)
|
||||||
|
{
|
||||||
|
if (packetID <= 1)
|
||||||
|
_insulated = packet.readBoolean
|
||||||
|
}
|
||||||
|
|
||||||
|
override def save(nbt: NBTTagCompound)
|
||||||
|
{
|
||||||
|
super.save(nbt)
|
||||||
|
nbt.setBoolean("isInsulated", insulated)
|
||||||
|
}
|
||||||
|
|
||||||
override def load(nbt: NBTTagCompound)
|
override def load(nbt: NBTTagCompound)
|
||||||
{
|
{
|
||||||
super.load(nbt)
|
super.load(nbt)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package edx.electrical.battery
|
package edx.electrical.battery
|
||||||
|
|
||||||
import java.util.{ArrayList, Arrays, List}
|
import java.util.ArrayList
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||||
import edx.core.Reference
|
import edx.core.Reference
|
||||||
|
@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraftforge.client.model.AdvancedModelLoader
|
import net.minecraftforge.client.model.AdvancedModelLoader
|
||||||
import net.minecraftforge.common.util.ForgeDirection
|
import net.minecraftforge.common.util.ForgeDirection
|
||||||
import org.lwjgl.opengl.GL11
|
|
||||||
import org.lwjgl.opengl.GL11._
|
import org.lwjgl.opengl.GL11._
|
||||||
import resonant.lib.content.prefab.{TElectric, TEnergyStorage}
|
import resonant.lib.content.prefab.{TElectric, TEnergyStorage}
|
||||||
import resonant.lib.grid.energy.EnergyStorage
|
import resonant.lib.grid.energy.EnergyStorage
|
||||||
|
@ -31,8 +30,7 @@ object TileBattery
|
||||||
{
|
{
|
||||||
/** Tiers: 0, 1, 2 */
|
/** Tiers: 0, 1, 2 */
|
||||||
final val maxTier = 2
|
final val maxTier = 2
|
||||||
/** The transfer rate **/
|
|
||||||
final val defaultPower = getEnergyForTier(0)
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "battery/battery.tcn"))
|
val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "battery/battery.tcn"))
|
||||||
|
|
||||||
|
@ -48,9 +46,10 @@ object TileBattery
|
||||||
|
|
||||||
class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacketReceiver with TEnergyStorage
|
class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacketReceiver with TEnergyStorage
|
||||||
{
|
{
|
||||||
var renderEnergyAmount: Double = 0
|
var renderEnergyAmount = 0d
|
||||||
var doCharge = false
|
var doCharge = false
|
||||||
private var markClientUpdate: Boolean = false
|
private var markClientUpdate = false
|
||||||
|
private var markDistributionUpdate = false
|
||||||
|
|
||||||
energy = new EnergyStorage
|
energy = new EnergyStorage
|
||||||
textureName = "material_metal_side"
|
textureName = "material_metal_side"
|
||||||
|
@ -59,7 +58,20 @@ class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacket
|
||||||
normalRender = false
|
normalRender = false
|
||||||
isOpaqueCube = false
|
isOpaqueCube = false
|
||||||
itemBlock = classOf[ItemBlockBattery]
|
itemBlock = classOf[ItemBlockBattery]
|
||||||
private var markDistributionUpdate: Boolean = false
|
|
||||||
|
override def start()
|
||||||
|
{
|
||||||
|
super.start()
|
||||||
|
updateConnectionMask()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updateConnectionMask()
|
||||||
|
{
|
||||||
|
dcNode.connectionMask = ForgeDirection.VALID_DIRECTIONS.filter(getIO(_) > 0).map(d => 1 << d.ordinal()).foldLeft(0)(_ | _)
|
||||||
|
dcNode.positiveTerminals.addAll(getInputDirections())
|
||||||
|
dcNode.negativeTerminals.addAll(getOutputDirections())
|
||||||
|
notifyChange()
|
||||||
|
}
|
||||||
|
|
||||||
override def update()
|
override def update()
|
||||||
{
|
{
|
||||||
|
@ -94,9 +106,9 @@ class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacket
|
||||||
if (player.isSneaking)
|
if (player.isSneaking)
|
||||||
{
|
{
|
||||||
doCharge = !doCharge
|
doCharge = !doCharge
|
||||||
|
println("Charge: " + doCharge)
|
||||||
}
|
}
|
||||||
|
|
||||||
println(dcNode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -113,19 +125,12 @@ class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacket
|
||||||
override def setIO(dir: ForgeDirection, packet: Int)
|
override def setIO(dir: ForgeDirection, packet: Int)
|
||||||
{
|
{
|
||||||
super.setIO(dir, packet)
|
super.setIO(dir, packet)
|
||||||
|
updateConnectionMask()
|
||||||
//TODO: Not set during init
|
|
||||||
dcNode.connectionMask = ForgeDirection.VALID_DIRECTIONS.filter(getIO(_) > 0).map(d => 1 << d.ordinal()).foldLeft(0)(_ | _)
|
|
||||||
//TODO: Connection logic having an issue
|
|
||||||
dcNode.positiveTerminals.clear()
|
|
||||||
dcNode.positiveTerminals.addAll(getOutputDirections())
|
|
||||||
notifyChange()
|
|
||||||
dcNode.reconstruct()
|
dcNode.reconstruct()
|
||||||
|
|
||||||
markUpdate()
|
markUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
override def onPlaced(entityliving: EntityLivingBase, itemStack: ItemStack)
|
override def onPlaced(entityLiving: EntityLivingBase, itemStack: ItemStack)
|
||||||
{
|
{
|
||||||
if (!world.isRemote && itemStack.getItem.isInstanceOf[ItemBlockBattery])
|
if (!world.isRemote && itemStack.getItem.isInstanceOf[ItemBlockBattery])
|
||||||
{
|
{
|
||||||
|
@ -152,19 +157,21 @@ class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacket
|
||||||
glPushMatrix()
|
glPushMatrix()
|
||||||
val energyLevel = ((itemStack.getItem.asInstanceOf[ItemBlockBattery].getEnergy(itemStack) / itemStack.getItem.asInstanceOf[ItemBlockBattery].getEnergyCapacity(itemStack)) * 8).toInt
|
val energyLevel = ((itemStack.getItem.asInstanceOf[ItemBlockBattery].getEnergy(itemStack) / itemStack.getItem.asInstanceOf[ItemBlockBattery].getEnergyCapacity(itemStack)) * 8).toInt
|
||||||
RenderUtility.bind(Reference.domain, Reference.modelPath + "battery/battery.png")
|
RenderUtility.bind(Reference.domain, Reference.modelPath + "battery/battery.png")
|
||||||
val disabledParts: List[String] = new ArrayList[String]
|
var disabledParts = Set.empty[String]
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("connector", "connectorIn", "connectorOut"): _*))
|
disabledParts ++= Set("connector", "connectorIn", "connectorOut")
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8"): _*))
|
disabledParts ++= Set("coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8")
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("coil1lit", "coil2lit", "coil3lit", "coil4lit", "coil5lit", "coil6lit", "coil7lit", "coil8lit"): _*))
|
disabledParts ++= Set("coil1lit", "coil2lit", "coil3lit", "coil4lit", "coil5lit", "coil6lit", "coil7lit", "coil8lit")
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("frame1con", "frame2con", "frame3con", "frame4con"): _*))
|
disabledParts ++= Set("frame1con", "frame2con", "frame3con", "frame4con")
|
||||||
TileBattery.model.renderAllExcept(disabledParts.toArray(new Array[String](0)): _*)
|
TileBattery.model.renderAllExcept(disabledParts.toList: _*)
|
||||||
|
|
||||||
for (i <- 1 until 8)
|
for (i <- 1 until 8)
|
||||||
{
|
{
|
||||||
if (i != 1 || !disabledParts.contains("coil1"))
|
if (i != 1 || !disabledParts.contains("coil1"))
|
||||||
{
|
{
|
||||||
if ((8 - i) <= energyLevel) TileBattery.model.renderOnly("coil" + i + "lit")
|
if ((8 - i) <= energyLevel)
|
||||||
else TileBattery.model.renderOnly("coil" + i)
|
TileBattery.model.renderOnly("coil" + i + "lit")
|
||||||
|
else
|
||||||
|
TileBattery.model.renderOnly("coil" + i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix()
|
glPopMatrix()
|
||||||
|
@ -173,98 +180,77 @@ class TileBattery extends SpatialTile(Material.iron) with TElectric with IPacket
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||||
{
|
{
|
||||||
val partToDisable: Array[Array[String]] = Array[Array[String]](Array[String]("bottom"), Array[String]("top"), Array[String]("frame1", "frame2"), Array[String]("frame3", "frame4"), Array[String]("frame4", "frame1"), Array[String]("frame2", "frame3"))
|
val partToDisable = Array[Array[String]](Array[String]("bottom"), Array[String]("top"), Array[String]("frame1", "frame2"), Array[String]("frame3", "frame4"), Array[String]("frame4", "frame1"), Array[String]("frame2", "frame3"))
|
||||||
val connectionPartToEnable: Array[Array[String]] = Array[Array[String]](null, null, Array[String]("frame1con", "frame2con"), Array[String]("frame3con", "frame4con"), Array[String]("frame4con", "frame1con"), Array[String]("frame2con", "frame3con"))
|
val connectionPartToEnable = Array[Array[String]](null, null, Array[String]("frame1con", "frame2con"), Array[String]("frame3con", "frame4con"), Array[String]("frame4con", "frame1con"), Array[String]("frame2con", "frame3con"))
|
||||||
glPushMatrix()
|
glPushMatrix()
|
||||||
glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||||
val energyLevel: Int = Math.round((energy.getEnergy / TileBattery.getEnergyForTier(getBlockMetadata).asInstanceOf[Double]) * 8).asInstanceOf[Int]
|
val energyLevel = Math.round((energy.getEnergy / TileBattery.getEnergyForTier(getBlockMetadata).asInstanceOf[Double]) * 8).toInt
|
||||||
|
|
||||||
RenderUtility.bind(Reference.domain, Reference.modelPath + "battery/battery.png")
|
RenderUtility.bind(Reference.domain, Reference.modelPath + "battery/battery.png")
|
||||||
|
|
||||||
val disabledParts = new ArrayList[String]
|
var disabledParts = Set.empty[String]
|
||||||
val enabledParts = new ArrayList[String]
|
var enabledParts = Set.empty[String]
|
||||||
|
|
||||||
for (check <- ForgeDirection.VALID_DIRECTIONS)
|
for (check <- ForgeDirection.VALID_DIRECTIONS)
|
||||||
{
|
{
|
||||||
if (center.add(check).getTileEntity.isInstanceOf[TileBattery])
|
if ((toVectorWorld + check).getTileEntity.isInstanceOf[TileBattery])
|
||||||
{
|
{
|
||||||
disabledParts.addAll(Arrays.asList(partToDisable(check.ordinal): _*))
|
disabledParts ++= partToDisable(check.ordinal)
|
||||||
if (check eq ForgeDirection.UP)
|
if (check == ForgeDirection.UP)
|
||||||
{
|
{
|
||||||
enabledParts.addAll(Arrays.asList(partToDisable(check.ordinal): _*))
|
enabledParts ++= partToDisable(check.ordinal)
|
||||||
enabledParts.add("coil1")
|
enabledParts += "coil1"
|
||||||
}
|
}
|
||||||
else if (check eq ForgeDirection.DOWN)
|
else if (check == ForgeDirection.DOWN)
|
||||||
{
|
{
|
||||||
val connectionParts = new ArrayList[String]
|
var connectionParts = Set.empty[String]
|
||||||
for (sideCheck <- ForgeDirection.VALID_DIRECTIONS) if (sideCheck.offsetY == 0) connectionParts.addAll(Arrays.asList(connectionPartToEnable(sideCheck.ordinal): _*))
|
val downDirs = ForgeDirection.VALID_DIRECTIONS.filter(_.offsetY == 0)
|
||||||
for (sideCheck <- ForgeDirection.VALID_DIRECTIONS)
|
downDirs.foreach(s => connectionParts ++= connectionPartToEnable(s.ordinal))
|
||||||
{
|
downDirs.filter(s => (toVectorWorld + s).getTileEntity.isInstanceOf[TileBattery]).foreach(s => connectionParts --= connectionPartToEnable(s.ordinal))
|
||||||
if (sideCheck.offsetY == 0)
|
enabledParts ++= connectionParts
|
||||||
{
|
|
||||||
if (center.add(sideCheck).getTileEntity.isInstanceOf[TileBattery])
|
|
||||||
{
|
|
||||||
connectionParts.removeAll(Arrays.asList(connectionPartToEnable(sideCheck.ordinal)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
enabledParts.addAll(connectionParts)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Render connectors
|
||||||
if (check.offsetY == 0)
|
if (check.offsetY == 0)
|
||||||
{
|
{
|
||||||
GL11.glPushMatrix()
|
glPushMatrix()
|
||||||
RenderUtility.rotateBlockBasedOnDirection(check)
|
RenderUtility.rotateBlockBasedOnDirection(check)
|
||||||
|
|
||||||
if (check == ForgeDirection.NORTH)
|
glRotatef(-90, 0, 1, 0)
|
||||||
|
|
||||||
|
getIO(check) match
|
||||||
{
|
{
|
||||||
glRotatef(0, 0, 1, 0)
|
case 1 => TileBattery.model.renderOnly("connectorIn")
|
||||||
|
case 2 => TileBattery.model.renderOnly("connectorOut")
|
||||||
|
case _ =>
|
||||||
}
|
}
|
||||||
if (check == ForgeDirection.SOUTH)
|
|
||||||
{
|
glPopMatrix()
|
||||||
glRotatef(0, 0, 1, 0)
|
|
||||||
}
|
|
||||||
else if (check == ForgeDirection.WEST)
|
|
||||||
{
|
|
||||||
glRotatef(-180, 0, 1, 0)
|
|
||||||
}
|
|
||||||
else if (check == ForgeDirection.EAST)
|
|
||||||
{
|
|
||||||
glRotatef(180, 0, 1, 0)
|
|
||||||
}
|
|
||||||
GL11.glRotatef(-90, 0, 1, 0)
|
|
||||||
val io: Int = getIO(check)
|
|
||||||
if (io == 1)
|
|
||||||
{
|
|
||||||
TileBattery.model.renderOnly("connectorIn")
|
|
||||||
}
|
|
||||||
else if (io == 2)
|
|
||||||
{
|
|
||||||
TileBattery.model.renderOnly("connectorOut")
|
|
||||||
}
|
|
||||||
GL11.glPopMatrix()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enabledParts.removeAll(disabledParts)
|
enabledParts --= disabledParts
|
||||||
|
|
||||||
for (i <- 1 to 8)
|
for (i <- 1 to 8)
|
||||||
{
|
{
|
||||||
if (i != 1 || enabledParts.contains("coil1"))
|
if (i != 1 || enabledParts.contains("coil1"))
|
||||||
{
|
{
|
||||||
if ((8 - i) < energyLevel) TileBattery.model.renderOnly("coil" + i + "lit")
|
if ((8 - i) < energyLevel)
|
||||||
else TileBattery.model.renderOnly("coil" + i)
|
TileBattery.model.renderOnly("coil" + i + "lit")
|
||||||
|
else
|
||||||
|
TileBattery.model.renderOnly("coil" + i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("connector", "connectorIn", "connectorOut"): _*))
|
disabledParts ++= Set("connector", "connectorIn", "connectorOut")
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8"): _*))
|
disabledParts ++= Set("coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8")
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("coil1lit", "coil2lit", "coil3lit", "coil4lit", "coil5lit", "coil6lit", "coil7lit", "coil8lit"): _*))
|
disabledParts ++= Set("coil1lit", "coil2lit", "coil3lit", "coil4lit", "coil5lit", "coil6lit", "coil7lit", "coil8lit")
|
||||||
disabledParts.addAll(Arrays.asList(Array[String]("frame1con", "frame2con", "frame3con", "frame4con"): _*))
|
disabledParts ++= Set("frame1con", "frame2con", "frame3con", "frame4con")
|
||||||
enabledParts.removeAll(Arrays.asList(Array[String]("coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8")))
|
enabledParts --= Set("coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8")
|
||||||
TileBattery.model.renderAllExcept(disabledParts.toArray(new Array[String](0)): _*)
|
TileBattery.model.renderAllExcept(disabledParts.toList: _*)
|
||||||
TileBattery.model.renderOnly(enabledParts.toArray(new Array[String](0)): _*)
|
TileBattery.model.renderOnly(enabledParts.toList: _*)
|
||||||
GL11.glPopMatrix()
|
glPopMatrix()
|
||||||
}
|
}
|
||||||
|
|
||||||
override def toString: String =
|
override def toString: String =
|
||||||
|
|
|
@ -56,15 +56,14 @@ object PartFlatWire
|
||||||
|
|
||||||
class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOcclusion
|
class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOcclusion
|
||||||
{
|
{
|
||||||
private val node = new FlatWireNode(this)
|
private val dcNode = new FlatWireNode(this)
|
||||||
/**
|
/**
|
||||||
* The current side the wire is placed on
|
* The current side the wire is placed on
|
||||||
*/
|
*/
|
||||||
var side: Byte = 0
|
var side: Byte = 0
|
||||||
/**
|
/**
|
||||||
* A map of the corners.
|
* A map of the corners.
|
||||||
* <p/>
|
*
|
||||||
* <p/>
|
|
||||||
* Currently split into 4 nybbles (from lowest) 0 = Corner connections (this wire should connect
|
* Currently split into 4 nybbles (from lowest) 0 = Corner connections (this wire should connect
|
||||||
* around a corner to something external) 1 = Straight connections (this wire should connect to
|
* around a corner to something external) 1 = Straight connections (this wire should connect to
|
||||||
* something external) 2 = Internal connections (this wire should connect to something internal)
|
* something external) 2 = Internal connections (this wire should connect to something internal)
|
||||||
|
@ -75,7 +74,10 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
||||||
*/
|
*/
|
||||||
var connectionMask = 0x00
|
var connectionMask = 0x00
|
||||||
|
|
||||||
nodes.add(node)
|
nodes.add(dcNode)
|
||||||
|
//TODO: Create DC wire nodes to allow omni directional connections
|
||||||
|
dcNode.positiveTerminals.addAll(Seq(ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.EAST))
|
||||||
|
dcNode.negativeTerminals.addAll(Seq(ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.WEST))
|
||||||
|
|
||||||
def preparePlacement(side: Int, meta: Int)
|
def preparePlacement(side: Int, meta: Int)
|
||||||
{
|
{
|
||||||
|
@ -86,22 +88,19 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
||||||
override def setMaterial(i: Int)
|
override def setMaterial(i: Int)
|
||||||
{
|
{
|
||||||
super.setMaterial(i)
|
super.setMaterial(i)
|
||||||
node.resistance = material.resistance
|
dcNode.resistance = material.resistance
|
||||||
}
|
}
|
||||||
|
|
||||||
override def update()
|
override def update()
|
||||||
{
|
{
|
||||||
super.update()
|
super.update()
|
||||||
|
|
||||||
if (node.current > 0)
|
|
||||||
println("Current is flowing: " + node)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def activate(player: EntityPlayer, hit: MovingObjectPosition, item: ItemStack): Boolean =
|
override def activate(player: EntityPlayer, hit: MovingObjectPosition, item: ItemStack): Boolean =
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
println(node)
|
println(dcNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -140,6 +139,7 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
||||||
|
|
||||||
override def write(packet: MCDataOutput, id: Int)
|
override def write(packet: MCDataOutput, id: Int)
|
||||||
{
|
{
|
||||||
|
super[PartAbstract].write(packet, id)
|
||||||
super.write(packet, id)
|
super.write(packet, id)
|
||||||
|
|
||||||
id match
|
id match
|
||||||
|
@ -154,15 +154,16 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
||||||
|
|
||||||
override def read(packet: MCDataInput, id: Int)
|
override def read(packet: MCDataInput, id: Int)
|
||||||
{
|
{
|
||||||
|
super[PartAbstract].read(packet, id)
|
||||||
super.read(packet, id)
|
super.read(packet, id)
|
||||||
|
|
||||||
id match
|
id match
|
||||||
{
|
{
|
||||||
case 0 =>
|
case 0 =>
|
||||||
side = packet.readByte
|
side = packet.readByte()
|
||||||
connectionMask = packet.readInt
|
connectionMask = packet.readInt()
|
||||||
case 3 =>
|
case 3 =>
|
||||||
connectionMask = packet.readInt
|
connectionMask = packet.readInt()
|
||||||
tile.markRender()
|
tile.markRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,6 +413,9 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
||||||
|
|
||||||
updateExternalConnections()
|
updateExternalConnections()
|
||||||
updateInternalConnections()
|
updateInternalConnections()
|
||||||
|
|
||||||
|
//Reconstruct the grid
|
||||||
|
grid.reconstruct(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue