Ejemplo n.º 1
0
        public void DelectBlockInfo(string id, string datas)
        {
            var Success = false;

            foreach (var key in BlockInfoList.Keys)
            {
                var s = BlockInfoList[key].RemoveAll
                        (
                    (List <BlockInfo> blockList)
                    => blockList.Exists
                    (
                        (BlockInfo blockInfo)
                        => blockInfo.Id == id && Universal.Match(blockInfo.Data, datas)
                    )
                        );
                if (s > 0)
                {
                    Success = true;
                }
            }
            if (!Success)
            {
                Current.Error("Filter Block: \"" + id + "[" + datas + "]\" Not Found", false);
            }
            return;
        }
Ejemplo n.º 2
0
        public List <BlockInfo> GetBlockList(string id, string datas)
        {
            var t = new List <BlockInfo>();

            if (!Regex.Match(id, @"\d+").Success&& !Regex.Match(id, @"^minecraft:").Success)
            {
                id = "minecraft:" + id;
            }

            foreach (var key in BlockInfoList.Keys)
            {
                t = BlockInfoList[key].Find
                    (
                    blockList
                    => blockList.Any
                    (
                        blockInfo
                        => blockInfo.Id == id && Universal.Match(datas, blockInfo.Data)
                    )
                    );
                if (t != null)
                {
                    return(t);
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
                }                                                                                                                                         //RelativeBlocks (Tags | Ids, Relative Coordinate)

                public bool ConditionMet(BlockInfo blockInfo, BlockCollection blockCollection, Vector3 pos, ResourceList res = null)
                {
                    SetParamList();
                    if (_paramslist != null && blockInfo.Model.Params != null) //Match Params
                    {
                        if (!Universal.Match(blockInfo.Model.Params.Split(',').ToList(), _paramslist))
                        {
                            return(false);                                                                           //When Params of BlockInfo Not Include Params of ModelInfoCondition
                        }
                    }
                    if (_relativeBlocks != null) //Match RelativeBlocks
                    {
                        foreach (var info in _relativeBlocks.Keys)
                        {
                            if (res != null)
                            {
                                var _b = res.SimpleBlockInfoCollection(info);
                                var b  = blockCollection.GetBlock((int)(_relativeBlocks[info].X + pos.X), (int)(_relativeBlocks[info].Y + pos.Y), (int)(_relativeBlocks[info].Z + pos.Z));
                                if (b != null && _b != null)
                                {
                                    var success = _b.Find((SimpleBlockInfo __b) => Universal.MatchBlock(b.GetBlockInfo(), __b));
                                    if (success == null)
                                    {
                                        return(false);                //When Blocks Not Match
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                    return(true);
                }
Ejemplo n.º 4
0
 public void SetTag(Dictionary <string, List <SimpleBlockInfo> > blockTagList)
 {
     foreach (var tag in blockTagList.Keys)
     {
         foreach (var target in blockTagList[tag])
         {
             if (Universal.MatchBlock(this, target))
             {
                 TagAdd(tag);
             }
         }
     }
 }
Ejemplo n.º 5
0
 public bool TagsAllMet(List <string> tags)
 {
     return(Universal.Match(tags, _tags));
 }
Ejemplo n.º 6
0
 public bool TagsAllMet(string tagExpression)
 {
     return(Universal.Match(tagExpression.Split(';').ToList(), _tags));
 }
Ejemplo n.º 7
0
 public bool TagsContain(List <string> tags)
 {
     return(Universal.Match(_tags, tags));
 }
Ejemplo n.º 8
0
 public bool TagsContain(string tagExpression)
 {
     return(Universal.Match(_tags, tagExpression.Split(';').ToList()));
 }