private static void AddItemsInternal(AddItemsMsg msg) { IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner; MyInventory inv = owner.GetInventory(msg.InventoryIndex); inv.AddItemsInternal(msg.Amount, msg.Item, msg.itemIdx); }
public static void GrindBlockIntoInventory(MySlimBlock src, MyInventory dst) { src.DeconstructStockpile(float.MaxValue, dst); var stockpile = src.Value(); if (stockpile == null) { return; } foreach (var item in stockpile.GetItems()) { dst.AddItemsInternal(item.Content, item.Amount); } GrindBlock(src); }
public static void CopyItemsIntoInventory(MyEntity src, MyInventory dst) { if (!src.HasInventory) { return; } for (var index = 0; index < src.InventoryCount; index++) { var inventory = src.GetInventory(index); if (inventory.Empty()) { continue; } foreach (var item in inventory.GetItems()) { dst.AddItemsInternal(item.Content, item.Amount); } inventory.ClearItems(); } }