コード例 #1
0
ファイル: CmdSearch.cs プロジェクト: TheDireMaster/McDire
        static void SearchBlocks(Player p, string keyword, string modifier)
        {
            List <BlockID> blocks = new List <BlockID>();

            BlockDefinition[] defs = p.IsSuper ? BlockDefinition.GlobalDefs : p.level.CustomBlockDefs;

            for (int b = 0; b < Block.ExtendedCount; b++)
            {
                BlockID block = (BlockID)b;
                if (Block.IsPhysicsType(block))
                {
                    if (!Block.Undefined(block))
                    {
                        blocks.Add(block);
                    }
                }
                else
                {
                    if (defs[block] != null)
                    {
                        blocks.Add(block);
                    }
                }
            }

            List <string> blockNames = FilterList(blocks, keyword,
                                                  b => Block.GetName(p, b), null,
                                                  b => CmdBlocks.FormatBlockName(p, b));

            OutputList(p, keyword, "search blocks", "blocks", modifier, blockNames);
        }
コード例 #2
0
ファイル: CmdSearch.cs プロジェクト: netzbasis/MCGalaxy
        static void SearchBlocks(Player p, string keyword, string modifier)
        {
            List <BlockID> blocks = new List <BlockID>();

            for (int b = 0; b < Block.ExtendedCount; b++)
            {
                BlockID block = (BlockID)b;
                if (Block.ExistsFor(p, block))
                {
                    blocks.Add(block);
                }
            }

            List <string> blockNames = FilterList(blocks, keyword,
                                                  b => Block.GetName(p, b), null,
                                                  b => CmdBlocks.FormatBlockName(p, b));

            OutputList(p, keyword, "search blocks", "blocks", modifier, blockNames);
        }