Image

Image is an element to display a texture.


Texture

This is the texture to draw. It can be a static PNG image or animated gif loaded from a namespace pointing to a minecraft (including modded) resource, or a url from the internet.

See the Texture documentation to learn more.


Vertex Color

This controls how much of a texture’s colors show through on the screen. See Mojang’s position texture color fragment shader for details.

E.g., a modifier of 0xFF00FFFF will remove all red from the texture.

Omitting the vertex color will default to 0xFFFFFFFF (opaque white).


TileModifier

This is used to divide the UV into tiled segments on each axis (repeat).

E.g., a value of 32 is used on vanilla option screens with the dirt texture in order to get the tiled effect. This does not mean it is tiled 32 times.

Omitting the tile modifier will default to 1.0 (no tile/repeat).

Examples:
1.0 makes the texture fit 1 times inside the allotted size, showing only the single image.
2.0 makes the texture fit 2 times inside the allotted size, showing 4 images tiled in a 2x2.
0.5 makes the texture fit 0.5 times inside the allotted size, showing the top left 25% of the image.


Examples

Basic Image

An example of a basic image

Image image = Image.builder("my_plugin:github_logo")
    .setPos(0, 20)
    .setSize(50, 50)
    .setTexture(
       "my_plugin:github_logo_texture",
       "https://cdn-icons-png.flaticon.com/512/25/25231.png"
    )
    .build();

Tiled Image

An example of a tiled image.

This Image is provided to you at Image.TILED_DIRT since it is a common Image (used in options screens).

public static final Image TILED_DIRT = Image.builder("guithium:tiled_dirt")
        .setTexture(new Texture("minecraft:dirt", "textures/gui/options_background.png"))
        .setVertexColor(0xFF404040)
        .setTileModifier(32.0F)
        .build();

Copyright © 2022-2025 William Blake Galbreath (BillyGalbreath)

This website is not an official Minecraft website and is not associated with Mojang Studios or Microsoft.
All product and company names are trademarks or registered trademarks of their respective holders.
Use of these names does not imply any affiliation or endorsement by them.