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; }
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); }
} //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); }
public bool TagsAllMet(List <string> tags) { return(Universal.Match(tags, _tags)); }
public bool TagsAllMet(string tagExpression) { return(Universal.Match(tagExpression.Split(';').ToList(), _tags)); }
public bool TagsContain(List <string> tags) { return(Universal.Match(_tags, tags)); }
public bool TagsContain(string tagExpression) { return(Universal.Match(_tags, tagExpression.Split(';').ToList())); }