Skip to content

Commit

Permalink
Final batch (1)?
Browse files Browse the repository at this point in the history
  • Loading branch information
tmvkrpxl0 committed Aug 4, 2023
1 parent 5c6e19b commit 3986dd7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions docs/misc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ Text Components

A `Component` is a holder for text which can be formatted and chained with other components via its subtype `MutableComponent`. A component can be created using one of the available static helpers:

| Method Name | Description |
|----------------|-------------------------------------------------------------------------------------------------------------------------|
| `literal` | it creates a component which simply wraps the passed in text. |
| `nullToEmpty` | it's the same as `#literal` except it creates an empty component if null has been passed |
| `translatable` | it creates a component which is represented as localized text to user, read [internationalization] for more details. |
| `empty` | it creates an empty component |
| `keybind` | it creates a component which is represented as the name of current keyboard key of the passed key mapping. |
| `nbt` | it creates a component for representing nbt data specified by `path` inside `dataSource` |
| Method Name | Description |
|----------------|------------------------------------------------------------------------------------------------------------------------------------|
| `literal` | it creates a component which simply wraps the passed in text. |
| `nullToEmpty` | it's the same as `#literal` except it creates an empty component if null has been passed |
| `translatable` | it creates a component which is represented as localized text to user, read [internationalization] for more details. |
| `empty` | it creates an empty component |
| `keybind` | it creates a component which is represented as the name of current keyboard key of the passed [key mapping][keymapping]. |
| `nbt` | it creates a component for representing nbt data specified by `path` inside `dataSource` |
| `score` | it creates a component for representing the `objective`'s score of an entity specified by the [entity selector][selectors] `name`. |
| `selector` | it creates a component for displaying the list of names of entities selected by the [entity selector][selectors] `pattern`. |
| `selector` | it creates a component for displaying the list of names of entities selected by the [entity selector][selectors] `pattern`. |

A component's text contents are represented by `ComponentContents`. Notably, the subtype `TranslatableContents` not only supports [localization][internalization] but also [text formatting][formatting].

Expand Down Expand Up @@ -106,4 +106,5 @@ Any `Component` element within `args` will be transformed into a formatted text
[red_hello]: /img/component_red_hello.png
[style_annotated]: /img/component_style_annotated.png
[formatting]: #text-formatting
[tree]: /img/component_graph.png
[tree]: /img/component_graph.png
[keymapping]: ../misc/keymappings.md

1 comment on commit 3986dd7

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: 3986dd7a5dc9c6e0d4f807cdd080193d2799fe07
Status: ✅ Deploy successful!
Preview URL: https://5d558977.neoforged-docs-previews.pages.dev
PR Preview URL: https://pr-4.neoforged-docs-previews.pages.dev

Please sign in to comment.