Creation methods are the ones responsible for the creation of new resources and textures. These are located in the HealthTypes class.
How do I create a new Heart Type? createCustomHeartType(...)
To create a new heart type (or better, a new CustomHeartType), you can start by creating a new class to store the new resources. At this point you should use the createCustomHeartType(...) method, but what does it do? And how should I use it?
CustomHeartType CUSTOM_HEART = HealthTypes.createCustomHeartType(YouMod.MOD_ID, "nameOfTheHeart");
This is how you use the method, putting as parameter you MOD_ID and the name of the heart. The name of the heart is extremely important, and, based on what you put, your textures must be named as consequence. The createCustomHeartType(...) methods point to 8 different textures this being:
|| Let's call "nameOfTheHeart" -> "name"
- "name" + "_full.png": pointing to the full heart texture;
- "name" + "_half.png": pointing to the half heart texture;
- "name" + "_full_blinking.png": pointing to the full blinking heart texture;
- "name" + "_half_blinking.png": pointing to the half blinking texture;
- "name" + "_hardcore_full.png": pointing to the hardcore full heart texture;
- "name" + "_hardcore_half.png": pointing to the hardcore half heart texture;
- "name" + "_hardcore_full_blinking.png": pointing to the hardcore full blinking texture;
- "name" + "_hardcore_half_blinking.png": pointing to the hardcore half blinking texture;
This is how you should rename your textures. If, for instance, my heart textures are orange_full, orange_half... then the "nameOfTheHeart" would be "orange". Also, your textures should be place in a specific path inside you project:
How do I create a new Container Type? createNORMALCustomContainerType(...) and createCOMPLEXCustomContainerType(...)
Since containers don't need an half variant of the textures, and can accept two different blinking textures (one for damage blinking, and the other for regen blinking), you use different methods. To generate a CustomContainerType with the same damage and regen blinking textures, you should use the createNORMALCustomContainerType(...) method. Instead, to separate the two textures, use the createCOMPLEXCustomContainerType(...) method.
Here is how they operate:
-> createNORMALCustomContainerType(...)
- "name" + "_container.png": pointing to the container texture;
- "name" + "_container_blinking.png": pointing to the container blinking texture;
- "name" + "_container_blinking.png": pointing to the container blinking texture;
- "name" + "_container_hardcore.png": pointing to the container hardcore texture;
- "name" + "_container_hardcore_blinking.png": pointing to the container hardcore blinking texture;
- "name" + "_container_hardcore_blinking.png": pointing to the container hardcore blinking texture; As you can see, the blinking textures have the same path.
-> createCOMPLEXCustomContainerType(...)
- "name" + "_container.png": pointing to the container texture;
- "name" + "_container_blinking_damage.png": pointing to the container blinking damage texture;
- "name" + "_container_blinking_healing.png": pointing to the container blinking healing texture;
- "name" + "_container_hardcore.png": pointing to the container hardcore texture;
- "name" + "_container_hardcore_blinking_damage.png": pointing to the container hardcore blinking damage texture;
- "name" + "_container_hardcore_blinking_healing.png": pointing to the container hardcore blinking healing texture; This time the damage blinking and the regen blinking have different path.
Tetures should be put under this path:
- resources/assets/modid/textures/gui/sprites/hud/heart/texture.png
Heads up!
All your heart textures must be place in this exact path: "resources/assets/modid/textures/gui/sprites/hud/heart/texture.png"
Also you should always name your textures based on the method you use.
What are those textures? VanillaHeartTypes and ModdedTextures
Inside HealthTypes you can find two subclasses the VanillaHeartTypes and the ModdedTextures, the first containing the vanilla HeartTypes, and the second containing some CustomHeartType provided by the library. You can access them and use the as you desire!
Heads up!
The CustomContainerType and CustomHeartType classes shouldn't be accessed directly to create your resources. Though it is an option, in particular if you want to use custom paths and names.
-> You are now ready to create your own rendering system! Check out the set up guide to understand how to implement this methods.