Sprites - babybluetit/Xaeros-Minimap-Modded-Support GitHub Wiki

This page will guide you through setting up your config file and sprites so that you can see them in-game.

Configuration

Your config file can contain the following properties:

{
  "variantIdBuilderMethod": "xaero.common.minimap.render.radar.EntityIconDefinitions.buildVariantIdString",

  "variants": {
    "MOD_ID:textures/entity/variant_0.png" : "outlined_sprite:icon_0.png",
    "MOD_ID:textures/entity/variant_1.png" : "outlined_sprite:icon_1.png",
    "default": "outlined_sprite:default_icon.png"
  }
}

A breakdown of each property and their usage is as follows:

variantIdBuilderMethod [optional]

  • Default: xaero.common.minimap.render.radar.EntityIconDefinitions.buildVariantIdString
  • Specifies a method for generating a variant id for an entity. In most cases the default method provided by the Minimap mod is sufficient, but you may write your own if you wish. See the note at the end of this section for more on the variant id builder method.

Tip: You can view entity variant ids by setting debugEntityVariantIds in the minimap config to true. This will print the ids of any entity you encounter to the chat.

variants

  • Contains a set of variant ids and the corresponding source to use for its minimap icon.
  • Variants ids are generated by the method specified in variantIdBuilderMethod.
  • If an entity's variant id matches one in the list it will use the corresponding icon source for its minimap icon.
  • If no match is found the default source is used (here being outlined_sprite:default_icon.png).

Icon sources

  • As seen on the model-based rendering page you can specify a model as the source of an icon.
  • Here we will see how to specify an image file to use instead.

General format: SPRITE_TYPE:SPRITE_LOCATION

Sprite type

We have 3 options for the sprite type:

  1. normal_sprite
    Uses the given sprite as the icon with no modifications.

  2. outlined_sprite
    Uses the given sprite as the icon with an outline (I use this option in most cases).

  3. sprite
    Uses the given sprite as the icon, but flipped vertically.

Please note normal_sprite and outlined_sprite are relatively recent introductions, so if your sprites are not appearing in-game you may need to update your mod!

Sprite location

The path specified is relative to the sprites directory. In the following example, orange.png would simply be accessed via outlined_sprite:orange.png. The file apple.png would be accessed via outlined_sprite:example_directory/apple.png.

sprites/
├─ example_directory/
│  ├─ apple.png
├─ orange.png

Examples

Test Dummy from Danny's Expansion

Setup mod directory and config file

We get the MOD ID and ENTITY ID from the debug screen (see the naming conventions). These are dannys_expansion and test_dummy respectively. Therefore, the contents of the definitions directory will look like this:

definitions/
├─ dannys_expansion/
│  ├─ test_dummy.json

Create image sprite

Now we create a sprite to use as the default icon. I'm using GIMP for this guide but you can feel free to use whatever image editor you like. If you are already comfortable with creating/editing your own images you can skip to the end of this example.

Open the texture file used for the Test Dummy and select an area to use as the icon (in this case the head). Hit Ctrl+c to add this to your clipboard.

Next create a blank image that we can paste our selected area to. Selecting File>New... will bring up a box with some options. I recommnd setting the image dimensions to be 64px by 64px and 'Fill with' set to transparency. Select OK to create the image.

Hit Ctrl + v to paste your selection into the new image. We are going to double the size of the selection by pressing Shift + s and setting the new dimensions to 16px by 16px. Make sure you have interpolation set to none or GIMP will blend some pixels for you. We have scaled the image so that it is the correct size relative to other icons on the minimap.

When you have done this, place the head in the centre of your image and export (Ctrl + e) the image to your sprites directory. I have named my sprite test_dummy.png.

All that's left to do now is fill out the config file!

{
    "variants" : {
        "default" : "outlined_sprite:test_dummy.png"
    }
}

As there is only one variant I have used test_dummy.png as the default icon for all test_dummy entities. After you've reloaded the resource pack (F3 + t) you'll see the new icon in the minimap!


Straw Golem from Straw Golem Reborn

Setup mod directory and config file

As before, we retrieve the MOD ID (strawgolem) and ENTITY ID (straw_golem) and create the config file in definitions/strawgolem/straw_golem.json. However, in this case the straw golem entity actually has several possible variants! We can see the identifiers for a few of these being displayed in the chat:

Create image sprites

If we want to support all the variants, we could make a sprite for each one. I usually start by opening the 'original' texture for the entity and work out which areas should make up the icon. All the variants use the same model, which means that the area you extract to create the icon will be the same across all textures. Here we have identified the face and 'hair' parts:

The tedious part is repeating this for every single texture! Once this is done, we can complete the config file. To keep my sprites organised, I have placed them all in a subdirectory called strawgolem. Remember that we place the variant ids on the left of the :, and the corresponding sprite to use on the right. The variant ids are the messages we saw printed in the chat earlier.

{
  "variants": {
    "strawgolem:textures/entity/igalaxy.png": "outlined_sprite:strawgolem/igalaxy.png",
    "strawgolem:textures/entity/mr_chocolate.png": "outlined_sprite:strawgolem/mr_chocolate.png",
    "strawgolem:textures/entity/shockmicro.png": "outlined_sprite:strawgolem/shockmicro.png",
    "strawgolem:textures/entity/winter_golem.png": "outlined_sprite:strawgolem/winter_golem.png",
    "strawgolem:textures/entity/dying_golem.png": "outlined_sprite:strawgolem/dying_golem.png",
    "strawgolem:textures/entity/old_golem.png": "outlined_sprite:strawgolem/old_golem.png",
    "default": "outlined_sprite:strawgolem/golem.png"
  }
}

Reload the pack (F3 + t) and you will see each variant has their own unique icon!

If you want to see a slightly excessive example of supporting lots of variants, check out fire_dragon.json for the Ice and Fire: Dragons mod!

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