Render Operations
A render operation is an interface RenderOperation that accepts a BentoElement and a RenderInfo and draws to the screen.
You can replace the render operations of any element to change how it renders on the screen, and you can reuse these functions or write your own to compose the final rendering.
Example:
Button.builder() .dimensions(16, 20) .renderOperations( RenderOperations.BUTTON_RENDER, (self, render) -> render.context().drawTexture( self.isEnabled() ? BentoConfigMain.id("textures/gui/reset_enabled.png") : BentoConfigMain.id("textures/gui/reset_disabled.png"), self.getX() + 4, self.getY() + 6, 0, 0, 8, 8, 8, 8 ) ) .build();General renders
Section titled “General renders”SCROLL_RENDER
Section titled “SCROLL_RENDER”Must implement ScrollableElement.
Renders a scroll bar.
Panel renders
Section titled “Panel renders”These render operations are for Panel’s.
CHILD_RENDER
Section titled “CHILD_RENDER”Renders the panel’s child elements.
MENU_BACKGROUND_RENDER
Section titled “MENU_BACKGROUND_RENDER”Renders a menu background.
This may be used by any element, but it is intended for panels.
Text renders
Section titled “Text renders”These render operations are for TextElement’s.
TEXT_RENDER
Section titled “TEXT_RENDER”Renders the element’s text.
SLIDING_TEXT_RENDER
Section titled “SLIDING_TEXT_RENDER”Renders the element’s text, and if it overflow, it slides left and right.
SCROLLABLE_TEXT_RENDER
Section titled “SCROLLABLE_TEXT_RENDER”Must implement ScrollableElement.
Renders the element’s multiline text, with scrolling support.
VALUE_RENDER
Section titled “VALUE_RENDER”Must implement ValueElement<T>.
Renders the element’s value.
TEXT_VALUE_RENDER
Section titled “TEXT_VALUE_RENDER”Must implement ValueElement<T>.
Renders the element’s text and value as "${text}: ${value}". If there is no text, it just renders the value.
This uses Minecraft’s translation key options.generic_value.
SPLIT_TEXT_VALUE_RENDER
Section titled “SPLIT_TEXT_VALUE_RENDER”Must implement ValueElement<T>.
Renders the element’s text on the left side and the value on the right side.
CHECKBOX_VALUE_RENDER
Section titled “CHECKBOX_VALUE_RENDER”Must implement ValueElement<Boolean>.
Render’s the element’s value as "[✔]: ${value}" for true and "[❌]: ${value}" for false.
This uses Bento GUI’s translation keys text.bento_gui.checkbox.on and text.bento_gui.checkbox.off.
Button renders
Section titled “Button renders”These render operations are intended for Button’s, but can be used for any element.
BUTTON_RENDER
Section titled “BUTTON_RENDER”Renders a button texture.
CHECKBOX_RENDER
Section titled “CHECKBOX_RENDER”Must implement ValueElement<Boolean>.
Renders a checkbox texture.
Slider renders
Section titled “Slider renders”These render operations are for Slider<T>’s.
SLIDER_BG_RENDER
Section titled “SLIDER_BG_RENDER”Renders a slider background texture.
SLIDER_HANDLE_RENDER
Section titled “SLIDER_HANDLE_RENDER”Renders a slider handle.
SLIDER_SMOOTHED_HANDLE_RENDER
Section titled “SLIDER_SMOOTHED_HANDLE_RENDER”Renders a smoothened slider handle.
Text field renders
Section titled “Text field renders”These render operations are for TextField<T>’s.
TEXT_FIELD_TEXT_RENDER
Section titled “TEXT_FIELD_TEXT_RENDER”Renders the text field’s text. Unlike TEXT_RENDER, this supports selections and indexing.
TEXT_FIELD_COLOR_RENDER
Section titled “TEXT_FIELD_COLOR_RENDER”Must implement ValueElement<Color>.
Renders the text field’s color on the right side.
TEXT_FIELD_ITEM_RENDER
Section titled “TEXT_FIELD_ITEM_RENDER”Must implement ValueElement<Item>.
Renders the text field’s item on the right side.
TEXT_FIELD_BLOCK_RENDER
Section titled “TEXT_FIELD_BLOCK_RENDER”Must implement ValueElement<Block>.
Renders the text field’s block on the right side.
TEXT_FIELD_ENTITY_RENDER
Section titled “TEXT_FIELD_ENTITY_RENDER”Must implement ValueElement<EntityType>.
Renders the text field’s entity on the right side.
Model renders
Section titled “Model renders”These render operations are for ModelRenderer<T>’s.
ENTITY_RENDER
Section titled “ENTITY_RENDER”Must be of the type EntityType.
Renders the model renderer’s entity.
ITEM_RENDER
Section titled “ITEM_RENDER”Must be of the type Item.
Renders the model renderer’s item.
Image renders
Section titled “Image renders”These render operations are for Image’s.
IMAGE_RENDER
Section titled “IMAGE_RENDER”Renders the image using a bilinear filter.
LANCZOS_IMAGE_RENDER
Section titled “LANCZOS_IMAGE_RENDER”Renders the image using a lanczos filter.