Skip to content

Commit 0c9b363

Browse files
feat(minecraft): add initial docs for ComponentParser (#33)
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 -->
1 parent 240d21f commit 0c9b363

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ ipython_config.py
316316
# pyenv
317317
# For a library or package, you might want to ignore these files since the code is
318318
# intended to run in multiple environments; otherwise, check them in:
319-
# .python-version
319+
.python-version
320320

321321
# pipenv
322322
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.

β€Ždocs/minecraft/minecraft-extras.mdβ€Ž

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [MinecraftExceptionHandler](#minecraft-exception-handler)
1717
- [RichDescription](#rich-description)
1818
- [TextColorParser](#text-color-parser)
19+
- [ComponentParser](#component-parser)
1920

2021
</div>
2122

@@ -148,3 +149,17 @@ It parses `NamedTextColor`, legacy color codes using `&` as well as hex codes.
148149
```java
149150
ParserDescriptor<?, TextColor> parser = TextColorParser.textColorParser();
150151
```
152+
153+
## Component Parser
154+
155+
`ComponentParser` is a [parser](../core/index.md#parsers) which parses Adventure `Component`s via
156+
a specified "decoder" function.
157+
158+
```java
159+
// This creates a parser that uses MiniMessage for decoding the argument, and uses
160+
// greedy string parsing.
161+
ParserDescriptor<?, Component> parser = ComponentParser.componentParser(
162+
MiniMessage.miniMessage(),
163+
StringParser.StringMode.GREEDY_FLAG_YIELDING
164+
);
165+
```

0 commit comments

Comments
Β (0)