Attempt to fix pipe packets
This commit is contained in:
parent
839d5f0abc
commit
6b625208fc
3 changed files with 24 additions and 33 deletions
|
@ -72,26 +72,24 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
|
||||||
|
|
||||||
def isCurrentlyConnected(side: ForgeDirection): Boolean = connectionMapContainsSide(clientRenderMask, side)
|
def isCurrentlyConnected(side: ForgeDirection): Boolean = connectionMapContainsSide(clientRenderMask, side)
|
||||||
|
|
||||||
/** Packet Methods */
|
|
||||||
def sendConnectionUpdate()
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
tile.getWriteStream(this).writeByte(0).writeByte(node.connectedMask)
|
|
||||||
}
|
|
||||||
|
|
||||||
override def write(packet: MCDataOutput, id: Int)
|
override def write(packet: MCDataOutput, id: Int)
|
||||||
{
|
{
|
||||||
super.write(packet, id)
|
super.write(packet, id)
|
||||||
packet.writeByte(node.connectedMask)
|
|
||||||
|
if (id == 0)
|
||||||
|
{
|
||||||
|
// packet.writeByte(0)
|
||||||
|
// packet.writeByte(node.connectedMask.toByte)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override def read(packet: MCDataInput, packetID: Int)
|
override def read(packet: MCDataInput, id: Int)
|
||||||
{
|
{
|
||||||
super.read(packet, packetID)
|
super.read(packet, id)
|
||||||
|
|
||||||
if (packetID == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
clientRenderMask = packet.readByte
|
// clientRenderMask = packet.readByte()
|
||||||
tile.markRender()
|
tile.markRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class PartFramedWire extends PartFramedNode with TWire
|
||||||
super.reconstruct()
|
super.reconstruct()
|
||||||
|
|
||||||
if (connectionMask != prevCon)
|
if (connectionMask != prevCon)
|
||||||
sendConnectionUpdate()
|
sendPacket(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def connect[B <: DCNode](obj: B, dir: ForgeDirection) =
|
override def connect[B <: DCNode](obj: B, dir: ForgeDirection) =
|
||||||
|
|
|
@ -32,7 +32,7 @@ class PartPipe extends PartFramedNode with TMaterial[PipeMaterial] with TColorab
|
||||||
private var markPacket = true
|
private var markPacket = true
|
||||||
|
|
||||||
material = PipeMaterials.ceramic
|
material = PipeMaterials.ceramic
|
||||||
node.onConnectionChanged = () => sendConnectionUpdate()
|
node.onConnectionChanged = () => sendPacket(0)
|
||||||
|
|
||||||
def preparePlacement(meta: Int)
|
def preparePlacement(meta: Int)
|
||||||
{
|
{
|
||||||
|
@ -64,42 +64,35 @@ class PartPipe extends PartFramedNode with TMaterial[PipeMaterial] with TColorab
|
||||||
*/
|
*/
|
||||||
override def write(packet: MCDataOutput, id: Int)
|
override def write(packet: MCDataOutput, id: Int)
|
||||||
{
|
{
|
||||||
super[TMaterial].write(packet,id)
|
super[PartFramedNode].write(packet, id)
|
||||||
super[PartFramedNode].write(packet,id)
|
|
||||||
super[TColorable].write(packet,id)
|
|
||||||
|
|
||||||
if(id == 3)
|
// super[TMaterial].write(packet, id)
|
||||||
|
// super[TColorable].write(packet, id)
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (id == 3)
|
||||||
{
|
{
|
||||||
//Tank Packet
|
//Tank Packet
|
||||||
val nbt = new NBTTagCompound
|
val nbt = new NBTTagCompound
|
||||||
var averageAmount: Int = 0
|
val averageAmount = averageTankData.reduce(_ + _) / averageTankData.size
|
||||||
if (averageTankData.size > 0)
|
|
||||||
{
|
|
||||||
for (i <- 0 until averageTankData.size)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
averageAmount += averageTankData.get(i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
averageAmount /= averageTankData.size
|
|
||||||
}
|
|
||||||
val tempTank = if (tank.getFluid != null) new FluidTank(tank.getFluid.getFluid, averageAmount, tank.getCapacity) else new FluidTank(tank.getCapacity)
|
val tempTank = if (tank.getFluid != null) new FluidTank(tank.getFluid.getFluid, averageAmount, tank.getCapacity) else new FluidTank(tank.getCapacity)
|
||||||
tempTank.writeToNBT(nbt)
|
tempTank.writeToNBT(nbt)
|
||||||
packet.writeInt(tank.getCapacity).writeNBTTagCompound(nbt)
|
packet.writeInt(tank.getCapacity).writeNBTTagCompound(nbt)
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
override def read(packet: MCDataInput, packetID: Int)
|
override def read(packet: MCDataInput, packetID: Int)
|
||||||
{
|
{
|
||||||
super[PartFramedNode].read(packet, packetID)
|
super[PartFramedNode].read(packet, packetID)
|
||||||
super[TColorable].read(packet, packetID)
|
|
||||||
|
|
||||||
|
// super[TMaterial].read(packet, packetID)
|
||||||
|
// super[TColorable].read(packet, packetID)
|
||||||
|
/*
|
||||||
if (packetID == 3)
|
if (packetID == 3)
|
||||||
{
|
{
|
||||||
tank.setCapacity(packet.readInt)
|
tank.setCapacity(packet.readInt)
|
||||||
tank.readFromNBT(packet.readNBTTagCompound)
|
tank.readFromNBT(packet.readNBTTagCompound)
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue