private ReadResults ReadBlockStates(out Dictionary <string, string> result) { result = new Dictionary <string, string>(); ReadResults readResults = StringReader.Expect('['); if (!readResults.Successful) { return(readResults); } StringReader.SkipWhitespace(); while (StringReader.CanRead() && StringReader.Peek() != ']') { StringReader.SkipWhitespace(); int start = StringReader.GetCursor(); readResults = StringReader.ReadString(out string property); if (!readResults.Successful) { return(readResults); } if (result.ContainsKey(property)) { StringReader.SetCursor(start); return(ReadResults.Failure(CommandError.DuplicateBlockProperty(Block, property).WithContext(StringReader))); } if (!IsTag && !Resources.Blocks.ContainsProperty(Block, property)) { StringReader.SetCursor(start); return(ReadResults.Failure(CommandError.UnknownBlockProperty(Block, property).WithContext(StringReader))); } StringReader.SkipWhitespace(); start = StringReader.GetCursor(); if (!StringReader.CanRead() || StringReader.Peek() != '=') { return(ReadResults.Failure(CommandError.ExpectedValueForBlockProperty(Block, property))); } StringReader.Skip(); StringReader.SkipWhitespace(); readResults = StringReader.ReadString(out string value); if (!readResults.Successful) { return(readResults); } if (!IsTag && !Resources.Blocks.PropertyContainsValue(Block, property, value)) { StringReader.SetCursor(start); return(ReadResults.Failure(CommandError.UnknownBlockPropertyValue(Block, property, value).WithContext(StringReader))); } result.Add(property, value); StringReader.SkipWhitespace(); if (StringReader.CanRead() && StringReader.Peek() == ',') { StringReader.Skip(); continue; } break; } if (!StringReader.CanRead() || StringReader.Peek() != ']') { return(ReadResults.Failure(CommandError.UnclosedBlockStateProperties().WithContext(StringReader))); } StringReader.Skip(); return(ReadResults.Success()); }