Model based Rendering vs Sprites - babybluetit/Xaeros-Minimap-Modded-Support GitHub Wiki

You will need to decide which approach to use to when making your icon. Each method has its own advantages and disadvantages, but sometimes you will be forced to use one over the other.

Options

1. Model-based rendering
- Icons can be generated using part or all of their in-game model. In our config file we can specify a path to the entity's model and the parts of the model to use for our icon.

2. Sprites
- We can supply our own textures to be used as an icon. In our config file we specify the location of any textures we have created.

Advantages and disadvantages

Model-based rendering Sprites
Advantages • Simple and fast - just enter a few lines in a config file
• Single model can support multiple variants as correct texture is retrieved automatically
• Absolute control over icon appearance
• Allows us to support mobs with custom renderers
Disadvantages • Does not work for mods with custom renderers
• Complex models can look out of place in the minimap
• Slower - it inevitably takes more time to edit a sprite than change a few lines of text
• If you want to support a mob's variants you will need to supply a unique sprite for every single one

When can I use model-based rendering?

We can only use model-based rendering when the entity uses the rendering system provided by vanilla Minecraft. To check if a mod uses this system, try to locate the model class for an entity.

Mod authors usually place their model classes in a location like mod_id/client/model/ or mod_id/client/renderer/model/, but sometimes you may have to look around further.

Here is an extract from the model file for a goose, taken from Upgrade Aquatic.

public class GooseModel<T extends Entity> extends AgeableModel<T> {
    private final ModelRenderer body;
    private final ModelRenderer neck;
    private final ModelRenderer head;
    private final ModelRenderer leftWing;

    ...

The goose's model is made up of ModelRenderer parts, which are provided by vanilla Minecraft. Therefore, we can use the model rendering system to generate an icon for this mob.

Another example of an entity model is the elephant model from Alex's Mobs:

public class ModelElephant extends AdvancedEntityModel<EntityElephant> {
    public final AdvancedModelBox root;
    public final AdvancedModelBox body;
    public final AdvancedModelBox storage_chest_left;
    public final AdvancedModelBox storage_chest_right;

    ...

In this case the elephant's model is made up of AdvancedModelBox parts, which are not supplied by vanilla Minecraft (in this case they come from the Citadel library). So in this case we would not be able to use the model rendering system.

When can I use sprites?

The good thing about sprites is we can use them for any entity we like! So even if a mob uses a custom rendering system, we can still create an icon for it.

⚠️ **GitHub.com Fallback** ⚠️