public MiningInformationPB(MiningInformation mi) { Material = mi.Material; Location = mi.Location; Voxel = mi.Voxel; Count = (ulong)mi.Positions.Count; }
private void UpdateDeposits(ref BoundingSphereD sphere) { MySimpleProfiler.Begin("UpdateAndRegisterMarkers"); var newlist = new List <MiningInformation>(); foreach (var group in DepositGroupsByEntity.Values) { group.UpdateDeposits(ref sphere); foreach (var deposit in group.Deposits) { foreach (var material in deposit.Materials) { Vector3D pos; material.ComputeWorldPosition(deposit.VoxelMap, out pos); Logger.Instance.LogDebug($"Material: {material.Material.MinedOre}, Count: {material.Positions.Count}, Location: {pos}"); newlist.Add(new MiningInformation() { Location = pos, Material = material.Material, Voxel = deposit.VoxelMap, Positions = material.Positions, }); } } } for (var index = 0; index < newlist.Count - 1; index++) { var first = newlist[index]; var second = newlist[index + 1]; if ((first.Location - sphere.Center).LengthSquared() > (second.Location - sphere.Center).LengthSquared()) { newlist.Move(index, index + 1); } } //lock (m_miningInformationLock) //{ MiningInformation.Clear(); newlist.ForEach((i) => MiningInformation.Add(i)); MiningInformation.ApplyChanges(); Logger.Instance.LogDebugOnGameThread($"Mining Deposit count: {MiningInformation.Count}"); //} MyAPIGateway.Parallel.StartBackground(() => BuildAggregatedResult()); //BuildAggregatedResult(); MySimpleProfiler.End(); }