using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using Vintagestory.API.Common.Entities; using Vintagestory.API.MathTools; using Vintagestory.API.Client; using ProtoBuf; using Newtonsoft.Json; namespace Automap { /// /// Basically the same as a POI but for an entity /// [ProtoContract] public struct EntityOfInterest { [DisplayName(0, "Name")] [ProtoMember(1)] public string Name; [DisplayName(2, "Notes")] [ProtoMember(2)] public string Notes; [DisplayName(1, "Loc.")] public string PrettyLocation; [ProtoMember(3)] public BlockPos Location; [DisplayName(3, "Time")] [ProtoMember(4)] public DateTime Timestamp; [DisplayName(4, "ID")] [ProtoMember(5)] public long EntityId; } /// /// Entities of interest. /// /// Tracked by ID - these never leave. public class EntitiesOfInterest : KeyedCollection { protected override long GetKeyForItem(EntityOfInterest item) => item.EntityId; internal void AddReplace(EntityOfInterest entity) { if (Contains(entity.EntityId)) Remove(entity.EntityId); Add(entity); } } }