Skip to content

Components

Tobero edited this page Jul 21, 2023 · 19 revisions

Common parts of components

All components share some properties. Common Properties:

  • priority - This is the render priority of the component. It defines when the compoent will be drawn and when it recieves events. Default to NORMAL. Possible values are: HIGHEST, HIGH, NORMAL, LOW, LOWEST
  • id - Set the id of the component. This makes it easier to find components for developers and yourself when debugged why a gui doesn't work. It also provides the ability to use component specific actions (See PagedComponent). It defaults to a random 36 letter uuid.
  • x - Define the x position of the component. It starts with 0 and goes to the width of your gui - 1. Defaults to 0
  • y - Define the y position of the component. It starts with 0 and goes to the height of your gui - 1. Defaults to 0
  • hidden - Tell the component to render itself or not. Defaults to false. Possible values are: false, true
  • on-click - This is a multi value property. You have to define it in the body of the component. It takes a type, representing the function you want to execute and a value, enclosed by the on-click tag. Defaults to no functions. These functions get called when the component gets clicked
  • on-drag - This is a multi value property. You have to define it in the body of the component. It takes a type, representing the function you want to execute and a value, enclosed by the on-drag tag. Defaults to no functions. These functions get called when one fo the slots of the component is included in a drag event.
  • on-close - This is a multi value property. You have to define it in the body of the component. It takes a type, representing the function you want to execute and a value, enclosed by the on-close tag. Defaults to no functions. These functions call when the components gets closed. This usually is the case when the gui gets closed or incase of an embedded gui, when the gui gets replaced by another gui.

SimpleItemComponent

Use this component by setting the type property to item

Properties:

  • Common properties
  • name - The name of the item. Supports color codes. If not provided, it will default to nothing (" ")
  • material - This is a required property. You must always set it when using this component, as long as the head-texture isn't set or the head-owner, which automatically sets it to PLAYER_HEAD. Visit the beginner guide to see the trick to get the material from an item.
  • lore - This is a multivalue property. You must set it in the component body. Supports color codes. Defaults to an empty lore. The items will be handled sequenially
  • head-texture - Set this property to make this item a player head with a custom texture. You can find the textures on minecraft-heads. Once you found a head you like, copy the value at the bottom into this property. Defaults to an empty texture
  • head-owner - Set this property to make tis item a player head with the texture of the specified owner. When head-tetxure is set, this property will be ignored.

ToggleitemComponent

Use this component by setting the type property to toggle

Clone this wiki locally