# textures

Textures are an important section in Minecraft and can be both overwritten and new textures can be added from Fonts or Models, the main path is

```
📦resource_pack.zip
  └── 📁assets
       └── 📁minecraft
           └── 📁textures
               ├── 📁block
               │    └── 🎨amethyst_cluster.png
               ├── 📁colormap
               ├── 📁effect
               ├── 📁entity
               ├── 📁environment
               ├── 📁font
               ├── 📁gui
               ├── 📁item
               │    └── 🎨axolotl_bucket.png
               ├── 📁map
               ├── 📁misc
               ├── 📁mob_effect
               ├── 📁painting
               ├── 📁particle
               └── 📁trims
```

{% hint style="warning" %}
Try to use textures in multiples of 16x, otherwise the texture may be distorted.
{% endhint %}

{% hint style="success" %}
The best way to obtain Minecraft assets is to go directly to [mcasset.cloud](https://mcasset.cloud/)
{% endhint %}

## MCMeta & Animated Textures

To make animated textures you need to multiply the size of the texture vertically, for example to add only one frame instead of `16x16` it is now `16x32` and has no limit, and so on with each frame you want to add.

| Parameter   | Description                                                                                                                                                                                                                                                     |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| interpolate | The font type, in this case, is bit-map for image-based chars. If true, *Minecraft* generates additional frames between frames with a frame time greater than 1 between them                                                                                    |
| height      | The height of the sprite, in pixels. This is also unused in vanilla, but can be used by resource packs to have frames that are not perfect squares. Defaults to the image's height if "width" is defined, and the smaller of the image's dimensions if it's not |
| frametime   | Sets the default time for each frame in increments of one game tick. Defaults to                                                                                                                                                                                |
| frames      | Contains a list of frames. Defaults to displaying all the frames from top to bottom.                                                                                                                                                                            |

#### Command Block Animated Example

{% file src="<https://4146076988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNDlPwSxiLGZoSIhAE04w%2Fuploads%2FtIPzW2A3TXAMs5yssh3s%2Fcommand_block_back.png?alt=media&token=9bd24268-1c3a-4f93-b46f-b08c792c913f>" %}

`command_block_back.png.mcmeta`

```json
{
  "animation": {
    "interpolate": true,
    "frametime": 10
  }
}
```

#### Fire Animated Example

{% file src="<https://4146076988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNDlPwSxiLGZoSIhAE04w%2Fuploads%2FzZACrZmEspXdqflWk08G%2Ffire_0.png?alt=media&token=e834dd83-137b-4b09-bec4-6b44cff39f41>" %}
fire\_0.png
{% endfile %}

`fire_0.png.mcmeta`

```json
{
  "animation": {
    "frames": [
      16,
      17,
      18,
      19,
      20,
      21,
      22,
      23,
      24,
      25,
      26,
      27,
      28,
      29,
      30,
      31,
      0,
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15
    ]
  }
}

```

#### An example of a Flash animation

{% file src="<https://4146076988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNDlPwSxiLGZoSIhAE04w%2Fuploads%2FXk2ZCGxbf5O96Gw0VHBa%2Freflection_animated_texture.png?alt=media&token=166f7156-9b23-421e-bb41-e1e6ad28b45b>" %}

`reflection_animated_texture.png.pmcmeta`

```json
{
    "animation": {
        "frametime": 2.5,
        "width": 100,
        "height": 100,
        "interpolate": true,
        "frames": [
            {
                "index": 0,"time": 70
            },
            0,
            {
                "index": 1,"time": 1
            },
            1,
            {
                "index": 2,"time": 1
            },
            2,
            {
                "index": 3,"time": 1
            },
            3,
            {
                "index": 4,"time": 1
            },
            4,
            {
                "index": 5,"time": 1
            },
            5,
            {
                "index": 6,"time": 1
            },
            6,
            {
                "index": 7,"time": 1
            }
        ]
    }
}
```

### Scaling Options in MCMeta & Custom Tooltip Example

Minecraft allows to add new tooltips through the tooltip\_style component, for example you need to create two textures with a prefix similar to `<name>_background` and `<name>_frame`

```
📦resource_pack.zip
  └── 📁assets
       └── 📁minecraft
           └── 📁textures
               └── 📁gui
                    └── 📁sprites
                         └── 📁tooltip
                              ├── 🎨awesome_background.png
                              ├── 📝awesome_background.png.mcmeta
                              ├── 🎨awesome_frame.png
                              └── 📝awesome_frame.png.mcmeta
                         
```

Existing types of scaling

| Parameter   | Description                                                                                                      |
| ----------- | ---------------------------------------------------------------------------------------------------------------- |
| stretch     | default method                                                                                                   |
| tile        | the sprite is repeated across the desired space, starting from the top-left.                                     |
| nine\_slice | the sprite is sliced into *4 corners*, *4 edges*, and *1 center slice*, which is tiled across the desired space. |

More scaling options

| Parameter      | Description                                                                                                                         |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| width          | The width of the sprite, in pixels.                                                                                                 |
| height         | The height of the sprite, in pixels.                                                                                                |
| border         | An array of chThe size in pixels that the border slices should cover on-screen                                                      |
| stretch\_inner | the `stretch_inner` option means whether the texture will be stretched or not, to avoid mixels or something like that deactivate it |

{% file src="<https://4146076988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNDlPwSxiLGZoSIhAE04w%2Fuploads%2FNOXb9Gk7XRfBkruBrNr1%2Fbackground.png?alt=media&token=96464203-0148-4dc5-8912-5142c0ea6e39>" %}
awesome\_background.png
{% endfile %}

`awesome_background.png.mcmeta`

```json
{
    "gui": {
        "scaling": {
            "type": "nine_slice",
            "width": 100,
            "height": 100,
            "border": 9
        }
    }
}
```

{% file src="<https://4146076988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNDlPwSxiLGZoSIhAE04w%2Fuploads%2FDW0jFaCC1JugJBDgw90Y%2Fframe.png?alt=media&token=c273d993-1d67-48c3-ac95-2bbfb94e3e46>" %}
awesome\_frame.png
{% endfile %}

`awesome_frame.png.mcmeta`

```json
{
    "gui": {
        "scaling": {
            "type": "nine_slice",
            "width": 100,
            "height": 100,
            "border": 10,
            "stretch_inner": true
        }
    }
}
```

#### Give Custom Tooltip Command

`/give @p diamond[tooltip_style='minecraft:awesome'] 1`

## GUI Routes

{% hint style="warning" %}
Examples made in 1.21.4
{% endhint %}

```
📦resource_pack.zip
  └── 📁assets
       └── 📁minecraft
           └── 📁textures
               └── 📁gui
                   ├── 📁advancements
                   │    ├── 📁backgrounds
                   │    │    └── 🎨<textures>
                   │    └── 🎨<textures>
                   ├── 📁container
                   │    ├── 📁creative_inventory
                   │    │    └── 🎨<textures>
                   │    └── 🎨<textures>
                   ├── 📁hanging_signs
                   │    └── 🎨<textures>
                   ├── 📁presets
                   │    └── 🎨<textures>
                   ├── 📁realms
                   │    └── 🎨<textures>
                   ├── 📁sprites
                   │    ├── 📁advancements
                   │    │    └── 🎨<textures>
                   │    ├── 📁boss_bar
                   │    │    └── 🎨<textures>
                   │    ├── 📁container
                   │    │    ├── 📁anvil
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁beacon
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁blast_furnace
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁brewing_stand
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁bundle
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁cartography_table
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁crafter
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁creative_inventory
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁enchanting_table
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁furnace
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁grindstone
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁horse
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁inventory
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁loom
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁slot
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁smithing
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁smoker
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁stonecutter
                   │    │    │    └── 🎨<textures>
                   │    │    ├── 📁villager
                   │    │    │    └── 🎨<textures>
                   │    │    └── 🎨<textures>
                   │    ├── 📁gamemode_switcher
                   │    │    └── 🎨<textures>
                   │    ├── 📁hud
                   │    │    ├── 📁heart
                   │    │    │     └── 🎨<textures>
                   │    │    └── 🎨<textures>
                   │    ├── 📁icon
                   │    │    └── 🎨<textures>
                   │    ├── 📁notification
                   │    │    └── 🎨<textures>
                   │    ├── 📁pending_invite
                   │    │    └── 🎨<textures>
                   │    ├── 📁player_list
                   │    │    └── 🎨<textures>
                   │    ├── 📁popup
                   │    │    └── 🎨<textures>
                   │    ├── 📁realm_status
                   │    │    └── 🎨<textures>
                   │    ├── 📁recipe_book
                   │    │    └── 🎨<textures>
                   │    ├── 📁server_list
                   │    │    └── 🎨<textures>
                   │    ├── 📁social_interactions
                   │    │    └── 🎨<textures>
                   │    ├── 📁spectator
                   │    │    └── 🎨<textures>
                   │    ├── 📁statistics
                   │    │    └── 🎨<textures>
                   │    ├── 📁toast
                   │    │    └── 🎨<textures>
                   │    ├── 📁tooltip
                   │    │    └── 🎨<textures>
                   │    ├── 📁transferable_list
                   │    │    └── 🎨<textures>
                   │    ├── 📁widget
                   │    │    └── 🎨<textures>
                   │    └── 📁world_list
                   │         └── 🎨<textures>
                   ├── 📁title
                   │    ├── 📁background
                   │    │    └── 🎨<textures>
                   │    └── 🎨<textures>
                   └── 🎨<textures>
```
