Jump to content

How to add custom icons

From Leaf Essentials

Creating a resource pack

We recommend reading the Introduction to ResourcePacks to create the base of the resource pack

Put your texture in a subfolder under the "textures" folder of your resource pack. For this example, we'll have a custom icon named icon.png in a folder named custom_icons (both the folder and any images inside it can be named anything; we highly recommend all lowercase and underscores if needed though) THIS IS REQUIRED TO BE A PNG!!

Using the icon

This icon wont appear in icon viewer, so to use it, you need to click the button at the bottom of icon viewer with an icon that looks like a button with the "a" in it, this should allow you to manually type Icon ID. since it isn't mapped, we'll need need to add a ^ to the start to treat everything after the ^ as a raw path

Example: ^textures/custom_icons/icon (the png extension isnt required)

Adding it to icon viewer

This IS possible, but slightly janky, since its an old unupdated featrure. Given enough uses of it, I may update it. But it does work.

THIS USES COMMANDS, BUT MAKE SURE IT ONLY RUNS WHEN LEAF IS LOADED

For behavior packs:

  • You can make an initialize event in leaf to run an mcfunction (recommended if you dont know scripting)
  • Run the commands in a event as soon as it sees leaf_ess_api:recv1. the message will always be empty

For no behavior pack:

  • Just use the initialize event in leafs Customizer utility

RUN THESE COMMANDS IN ORDER!

Initializing the pack

To initialize the process, run this once:

  • /scriptevent leaficon:add_icon_pack {"ns":"custom_icons","name":"My custom icon pack!","version":1}

remember to replace ns and name!!!!!

"ns" refers to the namespace of the icon pack, that is the part before the / in the icon ID, example: custom_icons/my_icon

Adding icons

  • /scriptevent leaficon:add_icon_to_pack {"pack":"your_namespace","name":"my_icon","texture_path":"textures/custom_icons/icon"}

Registering the icon pack into leaf

  • /scriptevent leaficon:push_icon_pack_to_registry custom_icons

REMEMBER TO REPLACE "custom_icons" WITH YOUR PACKS NAMESPACE