Skip to content

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();

Must implement ScrollableElement.

Renders a scroll bar.

These render operations are for Panel’s.

Renders the panel’s child elements.


Renders a menu background.

This may be used by any element, but it is intended for panels.

These render operations are for TextElement’s.

Renders the element’s text.


Renders the element’s text, and if it overflow, it slides left and right.


Must implement ScrollableElement.

Renders the element’s multiline text, with scrolling support.


Must implement ValueElement<T>.

Renders the element’s value.


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.


Must implement ValueElement<T>.

Renders the element’s text on the left side and the value on the right side.


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.

These render operations are intended for Button’s, but can be used for any element.

Renders a button texture.


Must implement ValueElement<Boolean>.

Renders a checkbox texture.

These render operations are for Slider<T>’s.

Renders a slider background texture.


Renders a slider handle.


Renders a smoothened slider handle.

These render operations are for TextField<T>’s.

Renders the text field’s text. Unlike TEXT_RENDER, this supports selections and indexing.


Must implement ValueElement<Color>.

Renders the text field’s color on the right side.


Must implement ValueElement<Item>.

Renders the text field’s item on the right side.


Must implement ValueElement<Block>.

Renders the text field’s block on the right side.


Must implement ValueElement<EntityType>.

Renders the text field’s entity on the right side.

These render operations are for ModelRenderer<T>’s.

Must be of the type EntityType.

Renders the model renderer’s entity.


Must be of the type Item.

Renders the model renderer’s item.

These render operations are for Image’s.

Renders the image using a bilinear filter.


Renders the image using a lanczos filter.