Skip to content

Custom Textures

Anaku Senko edited this page Aug 23, 2022 · 2 revisions

Setup New Texture:

New TextureRecord arguments

  1. New Texture.
  2. Start of element on horizontal plane (left to right).
  3. start of element on virtical plane (top to bottom).
  4. Width of element.
  5. Height of element.
  6. Width of texture.
  7. height of texture.
    /* * Set Identifier to new texture path * */
    public static final Identifier MANA_HUD_ELEMENT = new Identifier("mana_demo", "textures/gui/mana_hud_element.png");
    /* * register new TextureRecord * */
    public static final TextureRecord MANA_ICON = new TextureRecord(MANA_HUD_ELEMENT, 99, 0, 9, 9, 256, 256);

(Optional) Replace vanilla status bars:

Call method/methods in mod/client init

    public static void setNewTextures() {
        /* * Set new textures for mana hud element * */
        RenderHudFunctions.setDefaultTexture(MANA_HUD_ELEMENT);

        /* * set new Y mod increment for mana hud element (default should be bar height + 1) * */
        RenderHudFunctions.setYModIncrement(10);
    }