using System; using System.IO; using Vintagestory.API.Common; using Vintagestory.API.Datastructures; namespace Automap { public class StatusData : IAttribute { public uint TotalUpdates { get; set; } public uint VoidChunks { get; set; } public uint Delta { get; set; } public uint Max_N, Max_E, Max_S, Max_W; public RunState CurrentState { get; set; } public StatusData(uint totalUpdates, uint voidChunks, uint delta, RunState currently) { TotalUpdates = totalUpdates; VoidChunks = voidChunks; Delta = delta; CurrentState = currently; } public void FromBytes(BinaryReader stream) { TotalUpdates = stream.ReadUInt32(); VoidChunks = stream.ReadUInt32(); Delta = stream.ReadUInt32(); CurrentState = (RunState) stream.ReadByte(); } public int GetAttributeId() { return 12345; } public object GetValue() { return this; } public void ToBytes(BinaryWriter stream) { stream.Write(TotalUpdates); stream.Write(VoidChunks); stream.Write(Delta); stream.Write((byte) CurrentState); } public string ToJsonToken() { return $"TotalUpdate:{TotalUpdates}, VoidChunks:{VoidChunks}, Delta:{Delta}"; } public bool Equals(IWorldAccessor worldForResolve, IAttribute attr) { StatusData other = attr.GetValue() as StatusData; if (this.TotalUpdates == other.TotalUpdates && this.VoidChunks == other.VoidChunks && this.Delta == other.Delta && this.CurrentState == other.CurrentState) { return true; } return false; } } }