private bool TryParseStack(ItemStackNode node, out ItemStack stack) { if (node == null) { stack = null; return(false); } Item item = ItemRegistry.GetItem(node.id); stack = new ItemStack(item, node.count, node.meta); return(true); }
private bool TryParseStack(ItemStack stack, out ItemStackNode node) { if (stack == null || stack.IsEmpty) { node = null; return(false); } node = new ItemStackNode { id = stack.Item.UnlocalizedName, count = stack.Count, meta = stack.Meta }; return(true); }
private bool TryParseStack(World world, ItemStackNode node, out ItemStack stack) { if (node == null) { stack = null; return(false); } IItem item = null; if (node.IsBlock)//TODO - IMPORTANT! at this moment this is always true, will need to add another function for the items or something { item = new ItemBlock(BlockRegistry.GetBlock(world.GetLocalBlockName(node.LocalItemID))); } BlockRegistry.GetBlock(world.GetLocalBlockName(node.LocalItemID)); stack = new ItemStack(item, node.Count, node.Meta); return(true); }
private bool TryParseStack(EntityPlayerSP player, ItemStack stack, out ItemStackNode node) { if (stack == null || stack.IsEmpty) { node = null; return(false); } node = new ItemStackNode(); if (stack.Item is ItemBlock itemBlock) //TODO - IMPORTANT! at this moment this is always true, will need to add another function for the items or something { node.IsBlock = true; node.LocalItemID = player.World.GetLocalBlockId(itemBlock.Block.UnlocalizedName); node.Count = stack.Count; node.Meta = stack.Meta; } else { //TODO } return(true); }