๐Ÿ“„ images_and_fonts.yml

This is where the magic happens! You can use your own custom images and fonts in your health bars.

Part 1: Adding Custom Images

It's a two-step process:

  1. Place the Image: Put your .png file into the plugins/SunshineHealthBars/images/ folder. You can create sub-folders for organization (e.g., images/icons/my_icon.png).

  2. Define the Image: In the image_definitions/ folder, create a .yml file and register your image with a unique ID.

Example:

# In image_definitions/my_custom_images.yml
my_awesome_icon:
  texture: 'icons/my_icon' # Path in the 'images' folder, without .png
  height: 8 # How tall the image is in pixels.
  ascent: 7 # How far the image should be moved up. Usually slightly less than height.

You can then use this image in any layout or component with the placeholder %sunshine_image_my_awesome_icon%.

Part 2: Using Custom Fonts (Advanced)

A font is a collection of images mapped to text characters.

  1. Define all your character images in an image_definitions file, just like in Part 1.

  2. In the fonts/ folder, create a .yml file that maps characters to your image IDs.

Example:

# In fonts/my_number_font.yml
characters:
  '0': 'image_id_for_zero'
  '1': 'image_id_for_one'
  '2': 'image_id_for_two'
  # ... and so on for all characters you want to support.

You can then use this font to display numbers or text with the special placeholder: %font_my_number_font_{placeholder_api}%. For example, %font_my_number_font_{sunshine_health_current}% would display the mob's current health using your custom number images.

Last updated