onyx.text_component

class onyx.text_component.TextComponentPart(text=None, translate=None, with_=None, score=None, selector=None, keybind=None, nbt=None, interpret=None, block=None, entity=None, storage=None, extra=None, color=None, font=None, bold=None, italic=None, underlined=None, strikethrough=None, obfuscated=None, insertion=None, click_event=None, hover_event=None, dict=None)

TextComponentPart - Do not create manually. Instead, use the TextComponent.part() method. Defines an element in a text component.

Parameters
  • text (str, optional) – The text of the text component. Defaults to None.

  • translate (str, optional) – A translation identifier. Defaults to None.

  • with (list, optional) – A list of text components to be inserted into the translation text. Defaults to None.

  • score (dict, optional) – Displays the score holder’s current score in an objective. Defaults to None.

  • selector (Selector, optional) – Displays all entities matched from a selector. Defaults to None.

  • keybind (keybind, optional) – Displays a keybind. Defaults to None.

  • nbt (str, optional) – The NBT path to look for when using block, entity, or storage. Defaults to None.

  • interpret (bool, optional) – Whether or not each NBT value should be parsed as a text component. Defaults to None.

  • block (tuple, optional) – The coordinates of a block to get the NBT from. Defaults to None.

  • entity (Selector, optional) – The selector matching an entity to get the NBT from. Defaults to None.

  • storage (str, optional) – The storage ID to get the NBT from. Defaults to None.

  • extra (list, optional) – A list of child text components. Defaults to None.

  • color (color, optional) – The color of text. Defaults to None.

  • font (str, optional) – The font used by text. Defaults to None.

  • bold (bool, optional) – Whether or not text should be bold. Defaults to None.

  • italic (bool, optional) – Whether or not text should be italic. Defaults to None.

  • underlined (bool, optional) – Whether or not text should be underlined. Defaults to None.

  • strikethrough (bool, optional) – Whether or not text should be stricken. Defaults to None.

  • obfuscated (bool, optional) – Whether or not text should be obfuscated. Defaults to None.

  • insertion (str, optional) – The text to be inserted into the chat when the text is shift clicked. Defaults to None.

  • click_event (ClickEvent, optional) – Defines an event to run when the text is clicked on. Defaults to None.

  • hover_event (HoverEvent, optional) – Defines a tooltip to be display when the text is hovered over. Defaults to None.

  • dict (dict, optional) – Import a text component directly into an object without using other parameters. Defaults to None.

build()

build - Returns the built text component part

Returns

The built text component part

Return type

str

class onyx.text_component.TextComponent

TextComponent - Defines a text component array

part(text=None, translate=None, with_=None, score=None, selector=None, keybind=None, nbt=None, interpret=None, block=None, entity=None, storage=None, extra=None, color=None, font=None, bold=None, italic=None, underlined=None, strikethrough=None, obfuscated=None, insertion=None, click_event=None, hover_event=None, dict=None)

part - See TextComponentPart documentation for more info

Return type

TextComponent

Returns

self - The current TextComponent object. Allows for method chaining.

build(is_extra=False)

build - Returns a built text component

Parameters

is_extra (bool, optional) – Whether or not the text component should be put inside an extra list. Defaults to False.

Returns

The built text component

Return type

str