public override void OnStopCrafting(BlockJobInstance instance)
        {
            if (!BlockTypes.ContainsByReference(instance.BlockType, out int index))
            {
                return;
            }

            int num = index;

            if ((uint)(num - 6) <= 3u)
            {
                ItemTypes.ItemType newType = BlockTypes[index - 5];
                ESetBlockFlags     flags   = ESetBlockFlags.None;
                if (ServerManager.TryChangeBlock(instance.Position, instance.BlockType, newType, instance.Owner, flags) == EServerChangeBlockResult.Success)
                {
                    instance.BlockType = newType;
                }
            }
        }
Exemplo n.º 2
0
        public override void OnStopCrafting()
        {
            int index;

            if (!CraftingJobSettings.BlockTypes.ContainsByReference <ItemTypes.ItemType>(CraftingJobInstance.BlockType, out index))
            {
                return;
            }
            switch (index)
            {
            case 6:
            case 7:
            case 8:
            case 9:
                ItemTypes.ItemType blockType = CraftingJobSettings.BlockTypes[index - 5];
                ESetBlockFlags     flags     = ESetBlockFlags.None;
                if (ServerManager.TryChangeBlock(CraftingJobInstance.Position, CraftingJobInstance.BlockType, blockType, (BlockChangeRequestOrigin)CraftingJobInstance.Owner, flags) == EServerChangeBlockResult.Success)
                {
                    CraftingJobInstance.BlockType = blockType;
                    break;
                }
                break;
            }
        }