Пример #1
0
        public override void OnBlockPlaced(ItemStack byItemStack = null)
        {
            CookedContainerFix blockpot = byItemStack?.Block as CookedContainerFix;

            if (blockpot != null)
            {
                TreeAttribute tempTree = byItemStack.Attributes?["temperature"] as TreeAttribute;

                ItemStack[] stacks = blockpot.GetContents(api.World, byItemStack);
                for (int i = 0; i < stacks.Length; i++)
                {
                    ItemStack stack = stacks[i].Clone();
                    Inventory[i].Itemstack = stack;

                    // Clone temp attribute
                    if (tempTree != null)
                    {
                        stack.Attributes["temperature"] = tempTree.Clone();
                    }
                }

                RecipeCode       = blockpot.GetRecipeCode(api.World, byItemStack);
                QuantityServings = blockpot.GetServings(api.World, byItemStack);
            }

            if (api.Side == EnumAppSide.Client)
            {
                currentMesh = GenMesh();
                MarkDirty(true);
            }
        }
Пример #2
0
        public override void Initialize(ICoreAPI api)
        {
            base.Initialize(api);
            ownBlock = api.World.BlockAccessor.GetBlock(pos) as CookedContainerFix;

            if (api.Side.IsClient() && currentMesh == null)
            {
                currentMesh = GenMesh();
                MarkDirty(true);
            }
        }