Skip to content

Commit

Permalink
feat(minecraft): add initial docs for ComponentParser (#33)
Browse files Browse the repository at this point in the history
Is this sufficient? Should I talk about the annotations this also uses?

<!-- readthedocs-preview incendocloud start -->
----
πŸ“š Documentation preview πŸ“š:
https://incendocloud--33.org.readthedocs.build/en/33/

<!-- readthedocs-preview incendocloud end -->
  • Loading branch information
Machine-Maker authored May 14, 2024
1 parent 240d21f commit 0c9b363
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
15 changes: 15 additions & 0 deletions docs/minecraft/minecraft-extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [MinecraftExceptionHandler](#minecraft-exception-handler)
- [RichDescription](#rich-description)
- [TextColorParser](#text-color-parser)
- [ComponentParser](#component-parser)

</div>

Expand Down Expand Up @@ -148,3 +149,17 @@ It parses `NamedTextColor`, legacy color codes using `&` as well as hex codes.
```java
ParserDescriptor<?, TextColor> parser = TextColorParser.textColorParser();
```

## Component Parser

`ComponentParser` is a [parser](../core/index.md#parsers) which parses Adventure `Component`s via
a specified "decoder" function.

```java
// This creates a parser that uses MiniMessage for decoding the argument, and uses
// greedy string parsing.
ParserDescriptor<?, Component> parser = ComponentParser.componentParser(
MiniMessage.miniMessage(),
StringParser.StringMode.GREEDY_FLAG_YIELDING
);
```

0 comments on commit 0c9b363

Please sign in to comment.