Files
zzz_REBIRTH__Utils/Scripts/Network/NetPackageUpdatePlantedCropRebirth.cs
2025-06-04 16:44:53 +09:30

64 lines
1.9 KiB
C#

public class NetPackageUpdatePlantedCropRebirth : NetPackage
{
int clrIdx;
Vector3i blockPos;
int blockID;
ulong accumulatedTicks;
public NetPackageUpdatePlantedCropRebirth 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("NetPackageUpdatePlantedCropRebirth-ProcessPackage START");
if (_world == null)
{
//Log.Out("NetPackageUpdatePlantedCropRebirth-ProcessPackage 1");
return;
}
if (!_world.IsRemote())
{
//Log.Out("NetPackageUpdatePlantedCropRebirth-ProcessPackage 2");
return;
}
TileEntityPlantGrowingRebirth tileEntityPlantGrowing = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityPlantGrowingRebirth;
if (tileEntityPlantGrowing != null)
{
tileEntityPlantGrowing.AccumulatedTicks = this.accumulatedTicks;
}
}
}