Skip to content

How to create a texture pack

Daniel García edited this page Mar 19, 2023 · 4 revisions

How to setup

In order to set up your texture pack, you can use the sample structure from this repo https://github.com/dannegm/BlockEntities/tree/main/assets/texturepack

As you can see, you will need the following scructure

.
├── assets
│   ├── blockentities
│   │   ├── models
│   │   │   └── item/
│   │   └── textures
│   │       └── block/
│   └── minecraft
│       └── models
│           └── item
│               └── stone.json
├── pack.mcmeta
└── pack.png

As you can notice, there is a stone.json file, this will be the block that we going to work with it in order to create our custom block. This is because, we are going to add the custom_model_data field to this block.

Creating new block

As previous step, you will need to create a texture of 16x16 pixels that will be the appareance of your block. Save this texture inside the assets/blockentities/textures/block folder. ex:

.
└── assets
    └── blockentities
        └── textures
            └── block
                └── myblock.png

Then, you need to create a new JSON file with the same name of your texture into the assets/blockentities/models/item folder, ex:

.
└── assets
    └── blockentities
        └── models
            └── item
                └── myblock.json

So, you must to have similar folder structure to:

.
├── BlockEntitiesTexturePack.zip
├── assets
│   ├── blockentities
│   │   ├── models
│   │   │   └── item
│   │   │       └── myblock.json
│   │   └── textures
│   │       └── block
│   │           └── myblock.png
│   └── minecraft
│       └── models
│           └── item
│               └── stone.json
├── pack.mcmeta
└── pack.png

Into you new file, you will need to set the following content:

{
    "parent": "minecraft:block/cube_all",
    "textures": {
        "all": "blockentities:block/myblock"
    }
}

Let's explain this:

  • "parent": "minecraft:block/cube_all" is the base minecraft cube that will set us the given texture for all the sides of the cube, usefull if you don't any experience creating custom textures.
  • "blockentities:block/myblock" is the path of the given texture where, blockentities is the folder namesspace and our root texture folder, block is the folder where the texture is located insde assets/blockentities/textures and myblock is the name of the desired texture.

If you have some more experience creating textures or using BlockBench, you can try to creating more complex and amazing things 😄

Register new block

In order to assign your new texture to our BlockEnity, you will need to modify the assets/minecraft/models/item/stone.json file. Into the content of thi file will found something like this:

{
    "parent": "minecraft:block/stone",
    "overrides": [
        ...
    ]
}

Into the overrides array will need to append the following code in order to register you new block in the texture pack

{
    "predicate": {
        "custom_model_data": 1000
    },
    "model": "blockentities:item/myblock"
}

Let's review this:

  • "custom_model_data": 1000 is the value that will allow us to assign the texture to our custom block, this should match with the plugins/BlockEntities/config.yml file. You can find more information about that in Block Configuration section.
  • "model": "blockentities:item/myblock" is the path to our myblock.json file, where blockentities: is the folder namespace and item/myblock is path to the json file.

Note: You will need to make sure that custom_model_data value should be unique

Hosting texturepack

Once you hace your texturepack ready, will need to compress in a zip and upload to some hosting, I'd recommend you to use MCPacks that is free and easy to use.

Configure your server

You will need to open your server.properties file and modify the follwing two lines that MCPack provided to you

resource-pack=<url of your texturepack>
resource-pack-sha1=<hashcode of your texturepack>

You can also may find the sample texture pack of this plugin here: Download Sample TexturePack