//////////////// public static void Implant(Chest chest, ChestImplanterItemDefinition info) { int addedAmount = ChestImplanter.GetImplantQuantity(info); if (addedAmount == 0) { return; } int itemType = info.ChestItem.Type; if (itemType == 0) { LogHelpers.Alert("Invalid item key " + info.ChestItem); return; } // Add or remove quantity of item, according to implanter spec if (addedAmount > 0) { ChestImplanter.PrependItemToChest(chest, itemType, addedAmount, info); } else if (addedAmount < 0) { ChestImplanter.ExtractItemFromChest(chest, itemType, -addedAmount); } else { throw new ModHelpersException("Invalid quantity."); } }
public static void PrependItemToChest(Chest chest, int itemType, int amount, ChestImplanterItemDefinition info) { ChestImplanter.PrependItemToChest(chest, itemType, amount, info.Prefix); if (ChestImplantsConfig.Instance.DebugModeInfo) { Tile mytile = Main.tile[chest.x, chest.y]; string chestName; if (!TileFrameHelpers.VanillaChestTypeNamesByFrame.TryGetValue(mytile.frameX / 36, out chestName)) { chestName = "Unknown (modded?) chest"; } LogHelpers.Log( " Implanted " + chestName + " (" + chest.x + ", " + chest.y + ") with " + amount + " " + info.ChestItem.ToString()); } }