Upload from upload_mods.ps1
This commit is contained in:
78
Scripts/Network/NetPackageUpdateManualLightRebirth.cs
Normal file
78
Scripts/Network/NetPackageUpdateManualLightRebirth.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
public class NetPackageUpdateManualLightRebirth : NetPackage
|
||||
{
|
||||
int clrIdx = 0;
|
||||
int contentCount = 0;
|
||||
Vector3i blockPos;
|
||||
|
||||
public NetPackageUpdateManualLightRebirth Setup(int _clrIdx, Vector3i _blockPos, int _contentCount)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-Setup START");
|
||||
this.clrIdx = _clrIdx;
|
||||
this.contentCount = _contentCount;
|
||||
this.blockPos = _blockPos;
|
||||
|
||||
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.contentCount = _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.contentCount);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 2");
|
||||
TileEntityManualLightRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityManualLightRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage SERVER tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
tileEntity.powerCount = this.contentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 3");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 4");
|
||||
TileEntityManualLightRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityManualLightRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage CLIENT tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
tileEntity.powerCount = this.contentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 5");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user