void OnInventoryUpdate(ref MyEventInventoryUpdate msg)
 {
     var inventory = MyEntities.GetEntityByIdOrNull(new MyEntityIdentifier(msg.EntityId)) as IMyInventory;
     if (inventory != null)
     {
         inventory.Inventory.IsDummy = true;
         inventory.Inventory.Init(msg.InventoryBuilder);
         inventory.Inventory.IsDummy = false;
     }
 }
        void UpdateInventory(MyEntity entity, bool gameMechanicsItemsOnly)
        {
            Debug.Assert(entity is IMyInventory);
            Debug.Assert(entity.EntityId.HasValue);

            var inventoryEntity = (IMyInventory)entity;
            if (inventoryEntity.Inventory.IsDummy) return;

            var msg = new MyEventInventoryUpdate();
            msg.EntityId = entity.EntityId.Value.NumericValue;
            msg.InventoryBuilder = GetInventory(inventoryEntity, gameMechanicsItemsOnly);
            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered, 0, DEFAULT_LARGE_MESSAGE_SIZE);
        }