Esempio n. 1
0
        public override ItemStack OnPickBlock(IWorldAccessor world, BlockPos pos)
        {
            ItemStack stack = new ItemStack(world.GetBlock(CodeWithVariant("side", "east")));

            BlockEntityContainer bec = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityContainer;

            if (bec != null)
            {
                SetContents(stack, bec.GetContentStacks());
            }


            BlockEntityCrock becrock = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityCrock;

            if (becrock == null)
            {
                return(stack);
            }

            ItemStack[] stacks = becrock.inventory.Where(slot => !slot.Empty).Select(slot => slot.Itemstack).ToArray();
            if (becrock.RecipeCode != null)
            {
                stack.Attributes.SetString("recipeCode", becrock.RecipeCode);
                stack.Attributes.SetFloat("quantityServings", becrock.QuantityServings);
                stack.Attributes.SetBool("sealed", becrock.Sealed);
            }

            return(stack);
        }
Esempio n. 2
0
        public override ItemStack OnPickBlock(IWorldAccessor world, BlockPos pos)
        {
            ItemStack stack = base.OnPickBlock(world, pos);

            BlockEntityContainer bec = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityContainer;

            if (bec != null)
            {
                SetContents(stack, bec.GetContentStacks());
            }

            return(stack);
        }