Skip to content

Game components

Giorgio Garofalo edited this page Feb 9, 2021 · 4 revisions

In Chorus, a "game component" is any element from Minecraft that receives special highlighting in the editor and several specific features.
Within this category, there are: items, entities, enchantments, effects, particles and sounds.
Programmatically talking, they are represented as interfaces implemented by version-specific enumerations.

All of them can be accessed from JavaScript by calling getX(name), which returns an instance of the component, and getXs(), which returns an array, where X is the corresponding component type (e.g. getItem(name) and getItems()).

Since they all differ in some properties, this page will explain their properties explaining what they are and what components inherit them.

getName()

Inherited by all components.
Returns the enum name, uppercase and spaces replaced by underscores (e.g. OAK_PLANKS).

getFormalName()

Inherited by all components.
Returns the name capitalized and with spaces (e.g. Oak planks).

getIcons()

Inherited by all component except Sound.
Returns a list of JavaFX Images.
Its size can be either 0 or 1 from 1.13 upwards, but can be any on 1.12 items.

getDescription()

Inherited by Item, Entity, Enchantment and Effect.
Returns a description synchronously fetched from the official Minecraft wiki.
Note that it is not cached.

getId()

Inherited by Item, Enchantment and Effect.
Returns a numeric ID.
Item: always 0 from 1.13 and upwards.
Enchantment: always -1 from 1.14 and upwards.