Adding Custom Textures to Blocks - jojodmo/CustomItems GitHub Wiki
check out the wiki page about automatic resource pack generation
We recommend that you use CustomItems to automatically generate your resource pack for you. For more informationThere are two ways to create custom textures for blocks — one that is simple and easy to use, and another that is a little more involved, but allows you to pack all of your textures into a very small file.
How do block textures work?
- new blocks use the vanilla unused mushroom stem block variations: this can create issues in constructions made using those unusual variations and look buggy if you place two mushroom blocks side-by-side, So using custom blocks means any mushroom blocks place in survival will take on the wrong texture.
- A way around this is to have the mushroom blocks not placable, or when the player breaks a mushroom block give them a custom block.
The easy-to-use method supports up to 159 textures, and the advanced method supports unlimited textures.
Easy-to-use method (recommended)
Here's some example files that includes a resource pack and a few Custom Item examples (blueGemOre.yml is a custom-textured block). This file works for 1.14 and above only:
click to download 1.14 and above
You can set the texture ID of a block by setting "textureID" under the block's "texture" key:
name: "CUI Diamond Block"
item:
material: "minecraft:DIAMOND_BLOCK"
displayName: "&bCUI Diamond Block"
canBeUsedGenerically: false
canBePlaced: true
block:
texture:
# Corresponds to /assets/minecraft/textures/block/custom/block042.png
textureID: 42
And that's all! whatever you set textureID to is the file that the block corresponds to in /assets/minecraft/textures/block/custom.
Each png file is prefixed by "block" and then the textureID, with leading zeros so that the id is exactly three numbers long:
Texture ID 1 corresponds to /assets/minecraft/textures/block/custom/block001.png Texture ID 9 corresponds to /assets/minecraft/textures/block/custom/block009.png Texture ID 10 corresponds to /assets/minecraft/textures/block/custom/block010.png Texture ID 99 corresponds to /assets/minecraft/textures/block/custom/block099.png Texture ID 100 corresponds to /assets/minecraft/textures/block/custom/block100.png Texture ID 160 corresponds to /assets/minecraft/textures/block/custom/block160.png
If you want to create an advanced block model, you'll need to modify the block's model file, which is located in the /assets/minecraft/models/block/custom folder. Again, they will be titled with their texture ID, so if a block has the texture ID "42", it's model will be at /assets/minecraft/models/block/custom/042.json
. only modify the model files if you're sure you know what you're doing. You probably won't permanently screw anything up, but you'll need to un-do your changes if the resource pack breaks.
This method supports up to 160 textures. If you need more custom block textures, look into the advanced method below, which supports unlimited textures.
Fallback Textures
If you have fallback textures enabled ("doFallbackTextures" is "true" in your config.yml), you can set the fallback texture of your block to a native Minecraft block like "minecraft:DIAMOND_BLOCK" or "minecraft:GLOWSTONE". Any player who doesn't have your resource pack downloaded will instead see your block's fallback texture! Just set "fallback" to the Minecraft block under "texture" under "block":
block:
texture:
textureID: 42
# Players without your resource pack downloaded will see your custom
# Block as a diamond block!
fallback: "minecraft:DIAMOND_BLOCK"
And that's it!
Advanced method (recommended for advanced users only)
You can set the custom texture of a block by setting "texture" under the "block" key of the item yml file:
name: "CUI Golden Block"
item:
material: "minecraft:DIAMOND_BLOCK"
displayName: "&bCUI Golden Block"
canBeUsedGenerically: false
canBePlaced: true
block:
texture:
format: "expanded"
textureID: 42
color: "00aaff"
For this format, you need to set "format" to "expanded" under "texture"
To get started creating your own block textures, you may want to use an online tool, like this one: https://codecrafted.net/blockdesigner. If you have another tool you like to use, great! Go ahead and use that! If you know how to create resource packs, even better! Just read the section below For Advanced Users Only
The website already has everything set up that needs to be set up! Just note that the resource pack generated only works on MC 1.12 — you'll have to modify it to work on MC 1.13+ or older versions (you need to edit the leather_boots.json file), and you'll need to use the correct "textureID" for the texture you'd like. You'll also likely need to take advantage of "layers" which are explained below.
Here's some example files that includes a resource pack and a few Custom Item examples (purpleGemOre.yml is a custom-textured block). This file works for 1.14 and above only:
click to download 1.14 and above
Super-advanced: For Advanced Users Only
If you're an advanced user and have a lot of knowledge on making resource packs, then this section is for you!
If you're using the "expanded" texture format above, you can have all of the following under the texture key
oldTextureFormat — optional boolean (default false) — whether or not the old texture format should be used: This has no effect in versions under MC 1.14, but if used on Minecraft 1.14, this will make textureID act on the item's damage rather than it's NBT tag CustomModelData
textureID — required number — the texture id of the item. In 1.14+, this is the item's CustomModelData tag. In versions below 1.14 (or if oldTextureFormat is set to true), this is the damage of the item
material — optional string (default "LEATHER_BOOTS") — the native Minecraft item that this texture should be applied to. You should only change this if you know what you're doing. Note that the material must be some type of leather armor in order for the "color" key below to work.
color — optional color (if not set, the result will be a brownish color) — the color applied to the texture, in hex format (see referencing colors in the item yml quick reference)
In addition to all this, you can also specify up to three layers for the block texture, so that you can significantly reduce the size of your resource pack and use the same textures for different blocks (and change the colors of the textures using the "color" key):
block:
texture:
format: expanded
layer0:
textureID: 13
material: "minecraft:LEATHER_BOOTS"
oldTextureFormat: false
color: "444444"
layer1:
textureID: 31
color: "00AAFF"
layer2:
textureID: 37
color: "33AAFF"