65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
public class NetPackageUpdateCoopRebirth : NetPackage
|
|
{
|
|
int clrIdx;
|
|
Vector3i blockPos;
|
|
int blockID;
|
|
ulong accumulatedTicks;
|
|
|
|
public NetPackageUpdateCoopRebirth Setup(int _clrIdx, Vector3i _blockPos, int _blockID, ulong _accumulatedTicks)
|
|
{
|
|
this.clrIdx = _clrIdx;
|
|
this.blockPos = _blockPos;
|
|
this.blockID = _blockID;
|
|
this.accumulatedTicks = _accumulatedTicks;
|
|
return this;
|
|
}
|
|
|
|
public override void read(PooledBinaryReader _br)
|
|
{
|
|
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
|
this.clrIdx = _br.ReadInt32();
|
|
this.accumulatedTicks = _br.ReadUInt64();
|
|
this.blockID = _br.ReadInt32();
|
|
}
|
|
|
|
public override void write(PooledBinaryWriter _bw)
|
|
{
|
|
base.write(_bw);
|
|
_bw.Write((int)this.blockPos.x);
|
|
_bw.Write((int)this.blockPos.y);
|
|
_bw.Write((int)this.blockPos.z);
|
|
_bw.Write(this.clrIdx);
|
|
_bw.Write(this.accumulatedTicks);
|
|
_bw.Write(this.blockID);
|
|
}
|
|
|
|
public override int GetLength()
|
|
{
|
|
return 28;
|
|
}
|
|
|
|
public override void ProcessPackage(World _world, GameManager _callbacks)
|
|
{
|
|
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage START");
|
|
if (_world == null)
|
|
{
|
|
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage 1");
|
|
return;
|
|
}
|
|
|
|
if (!_world.IsRemote())
|
|
{
|
|
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage 2");
|
|
return;
|
|
}
|
|
|
|
TileEntityChickenCoopRebirth tileEntityCoop = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityChickenCoopRebirth;
|
|
if (tileEntityCoop != null)
|
|
{
|
|
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage this.accumulatedTicks: " + this.accumulatedTicks);
|
|
tileEntityCoop.AccumulatedTicks = this.accumulatedTicks;
|
|
}
|
|
}
|
|
}
|
|
|