Skip to content

Resource Bar

Renders a bar above the hunger status bar on the HUD.

Type ID: kaya:resource_bar

Tip

Custom resource bar textures must be placed in the assets/<namespace>/textures/gui/sprites directory of a resource pack to be recognized and used properly. See here for a collection of resource bar sprites included in the mod.

Info

This HUD element type uses the following context parameters. The following fields must, or must not be present, depending on whether the context parameters are provided:

Parameter Field
kaya:hud/value value
kaya:hud/max_value max
kaya:hud/min_value min

Format

Field Type Default Description
sprite_location Sprite Location optional The IDs of the bar sprites to render.
inverted Boolean Provider false Determines whether the bar should progress from left-to-right or right-to-left.
x Int Provider 0 Determines the offset position of the bar on the horizontal axis.
y Int Provider 0 Determines the offset position of the bar on the vertical axis.
should_render Boolean Provider true Determines whether the bar should be rendered.
value Float Provider optional If present, this will be used as the "fill" value of the bar.
min Float Provider optional If present, this will be used as the minimum bounds of the bar.
max Float Provider optional If present, this will be used as the maximum bounds of the bar.

Sprite Location

The sprite_location has the following format:

Field Type Default Description
background Identifier "kaya:resource_bar/1/background" The ID of bar's background texture.
fill Identifier "kaya:resource_bar/1/fill" The ID of the bar's "fill" portion texture.
icon Identifier "kaya:resource_bar/1/icon" The ID of the bar's icon, rendered on the left side of the bar.

Example

{
    "type": "kaya:resource_bar",
    "sprite_location": {
        "background": "kaya:resource_bar/1/background"/*(1)!*/,
        "fill": "kaya:resource_bar/9/fill"/*(2)!*/,
        "icon": "kaya:resource_bar/2/icon"/*(3)!*/
    },
    "render_phase": "below_hud"
}

This example renders a resource bar differing textures; where it uses the background sprite of the 1st resource bar, the fill sprite of the 9th resource bar, and the icon sprite of the 2nd resource bar. (All referenced resource bars in the example are included in the mod.)

  1. The image: Image
  2. The image: Image
  3. The image: Image

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.