Minecraft / Blogs

How To Make a Resource Pack with Randomized Textures (VANILLA)

  • 29
  • 16
  • playlist_add
  • share
  • more_horiz
avatar usa
Level 38 : Artisan Artist
109
• Link to a resource pack with this tutorial already done: http://goo.gl/CK9vuh

• If a file name has "/" after it, it is a folder. If it is not a folder, it will have its file extension.

Hello! With the arrival of 1.8, you can now use alternate blocks. Granted they are not turned off in the settings, this allows people using your resource pack to see multiple, randmized textures for individual blocks.

1. File setup
In 1.8, the file setup goes as follows for resource packs:

/resourcepack/
assets/
blockstates/
#see sec. 2
font/
lang/
models/
#see sec. 3
blocks/
#see sec 3.1
items/
#see sec 3.2
texts/
textures/
blocks/
#see sec. 4
pack.mcmeta
pack.png

2. blockstates
The folder "blockstates" holds a .json file for every single block and variant of block in the game. These files point to the model (.json file), which will be found in "models/block". The files, by default, should somewhat resemble this for most blocks in the "blockstates" folder (we are using coal ore as an example):

/blockstates/coal_ore.json

{
"variants":{
"normal":{"model":"coal_ore"}
}
}

This is pointing to a model (a .json file) in the file "models / blocks" called "coal_ore.json".

This is fine and dandy if you just want one texture for the block, but we want multiple (alternate) textures. In preparation for this, we will add square brackets around our model (soon to be models):

/blockstates/coal_ore.json

{
"variants":{
"normal":[
{"model":"coal_ore"}
]
}
}

What we did was turn "normal" into an array, or a list. This allows us to point to multiple models for this one block.

Now we will tell Minecraft that the models (or .json files) it is looking for are in a folder called "coal_ore", and that the first is called "0", the second called "1", and the third "2". (assuming you have 3 different textures) You can name these whatever you want, but make sure the model name and its name in the blockstates folder match up. If you didn't change the name, it should look like this:

/blockstates/coal_ore.json

{
"variants":{
"normal":[
{"model":"coal_ore/0"},
{"model":"coal_ore/1"},
{"model":"coal_ore/2"},
"__comment":"The value for the model tag MUST be consistent with the name of the .json file in the folder models/blocks/coal_ore! This is CRUCIAL!"
]
}
}

NOTE: You cannot rename or put any file in a folder in blockstates. The game expects these files to be here. If it does not find a file here, be it because you deleted it or put it in a folder, it will use the default file in its place.

In blockstates, you can also define something called "weight". This makes it so that some models will be shown more often than others. If "0" is our main texture, for instance, and we would like for this model to be displayed more often than the other two, then we can do this:

/blockstates/coal_ore.json

{
"variants":{
"normal":[
{"model":"coal_ore/0","weight":120},
{"model":"coal_ore/1"},
{"model":"coal_ore/2"}
]
}
}

Note that the number is not in quotes. The number is turned into a percentage, so you cannot use deimals. The default value is 1 (which turns to 100%).

3. models
Models has 2 folders: blocks, and items. "Blocks" determine how they are rendered when placed, while "items" determines how they are rendered in your inventory.

3.1. blocks
"Blocks" contains all the models (.json files) for every tile in the game. Some blocks have multiple tiles, such as beds, and thus will have multiple models (.json files).

What we want to do is make a seperate folder inside "models/blocks/" for our coal ore models. In our case, it will be called "coal_ore", and we will move the "coal_ore.json" file, which should already be inside the "blocks" folder, to our "coal_ore" folder.

So instead of our file structure looking like this:

/blocks
coal_ore.json

we will have this:

/blocks
/coal_ore (new folder)
coal_ore.json

We will then rename the .json file "0", and then duplucate it so we have one for every texture we have. In our case, we have 3, so we will duplucate it twice (because we still have the original file, which adds up to 3). Our file structure should resemble this:

/blocks
/coal_ore
0.json (formerly named "coal_ore.json")
1.json (dupe of 0)
2.json (dupe of 0)

We will then go inside of each of these files and change point to where we will have our textures. This is the default file:

/models/blocks/coal_ore.json:

{
"parent": "block/cube_all", "__comment":"cube_all is the parent model (.json file)",
"textures":{
"all": "blocks/coal_ore"
}
}

Ours will look like this since we plan on putting our alternate textures (.png files) in a new folder, that being "/textures/blocks/coal_ore/" and naming them "0","1", and "2". Keep in mind we have already put these models (.json files) in a folder called "coal_ore" to help us stay organized.

/models/blocks/coal_ore/0.json:

{
"parent": "block/cube_all",
"textures": {
"all": "blocks/coal_ore/0"
}
}

/models/blocks/coal_ore/1.json:

{
"parent": "block/cube_all",
"textures": {
"all": "blocks/coal_ore/1"
}
}

/models/blocks/coal_ore/2.json:

{
"parent": "block/cube_all",
"textures": {
"all": "blocks/coal_ore/2"
}
}

3.2. items
I don't really need to go over this in great detail. If put your texture in a folder, it will no longer show in the inventory unless you point to it again in its .json file in the "items" folder, which is in the "models" folder.

In our case, it would look like this:

/models/item/coal_ore.json:

{
"parent": "block/coal_ore/0",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

As you can see, you can also change how your character holds the block with the "display" tag.

4. blocks
Located in "textures", "blocks" is where your block textures (.png files) are put.

For us, since we are making alternate textures for "coal_ore", we will make a folder called "coal_ore" and put all of our textures in there. The file structure looks like this by default:

/blocks
coal_ore.png

This is what it should look like for us:

/blocks
/coal_ore
0.png
1.png
2.png

You're done! Good job- give yourself a pat on the back. It can be somewhat confusing the first time, but do a few more blocks and you will most definitely get the hang of it.

If you enjoyed the tutorial, I would appreciate it greatly if you diamonded / favorited / subscribed. I plan on doing more resource pack tutorials in the near future!v
v
Tags

3 Update Logs

Update #3 : 10/12/2014 4:58:07 pmOct 12, 2014

added a download link for a resource pack with this already done so you can follow along more easily.
LOAD MORE LOGS

Comments : 40

Login or register to post a comment.

Show Comments

1 - 40 of 40

Nice Tutorial! Really helped me! :D

I will use this for my Adventure Map!

EDIT:



I would love to see a WORKING updated version of this....

EDIT EDIT:

And it would be nice to repair the download link ._.
  • usa
  • Level 38
  • Artisan Artist
  • October 19, 2016, 9:12 pm
sorry, the obama administration has been very busy with supporting hillary clinton's campaign, we may update this tutorial after the election is done and everything has settled down.
lol. thx :D
  • Suphacker_Tem
  • Level 2
  • Apprentice Network
  • September 1, 2016, 2:18 pm
this is rlly outdated
You're not supposed to put the .json files or the .png files IN FOLDERS just put them next to each other. the files don't work
I'm having problems with randomizing animated textures... Any help?

Even if you can't thanks. :D
hey there, thi tutorial helped me, but i keep getting the purple and black texture, and I even checked if all the brackets where correct, i am not a programmer but i checked if for every opening was a closing :) Is there something i am doing wrong? does the place where the brackets are make any difference? in the items file i also changed it to; /block/coal_ore/0 but that only changed the item in my hand from the basic texture to the purple and black one... any help?

still thanks either way :D
  • usa
  • Level 38
  • Artisan Artist
  • May 31, 2016, 3:06 pm
don't put the "/" in front of "block/coal_ore/0" ever. check to make sure thats not your problem.
checked it, removed it, and still shows the same problem..
thanks for the fast reply anyway
having a little trouble. im trying to do this with iron doors and i managed to get it to work with the bottom half, but when i edited the .json files for the top halves of the door, nothing worked. i just get the purple and black checkers.

i can message you a copy of the files if you like? they're quite long so i wont type them here 

Thanks :D
  • usa
  • Level 38
  • Artisan Artist
  • January 17, 2016, 4:12 pm
hello, sorry, I am not active on this website by any standard, hope youve found a solution by now. if you are seeing a checkerboard black and purple pattern it is most likely a syntax error. check for any unnecessary punctuation, make sure your brackets are zeroed out, etc.
How would you do this with a block like, say, stairs? I'm working on some custom stair models for an adventure map I'm working on, but I need the textures of them to be random.
  • usa
  • Level 38
  • Artisan Artist
  • August 27, 2015, 6:22 pm
exactly the same as any other block. make a couple textures, make a couple model files (also where your custom models will be) pointing to those textures, then edit the blockstate file to point to the model files. the only thing different about stairs is in the vanilla texture pack they do not have their own textures, but if you follow my tutorial that will not make any difference at all.
  • derborgus
  • Level 1
  • New Miner
  • July 11, 2015, 5:26 pm
The link for the pre-done resource pack is broken.
  • usa
  • Level 38
  • Artisan Artist
  • August 27, 2015, 6:23 pm
you can look at my texture pack "antediluvian" and I use the exact same files in it even down to the textures. the only difference is you also get the other blocks and stuff, but if anything it's better. more examples to follow. :)
  • FiftyWalrus
  • Level 53
  • Grandmaster Toast
  • May 3, 2015, 5:21 am
This tutorial is awesome, I used it to learn the basics and modified Default to include the 3000+ JSON files and 900+ textures required to add 4x variants.  It took me 62 hours and was done entirely on live stream.

http://www.planetminecraft.com/texture_pack/default-plus-variation-3308486/

Hopefully it can serve as an example and a basis for others to use when making variant base resource packs in the future.

Thanks for the tutorial!.
  • usa
  • Level 38
  • Artisan Artist
  • May 3, 2015, 5:11 pm
that's awesome! happy you made use of the tutorial
  • Morsmorse
  • Level 1
  • New Miner
  • April 16, 2015, 8:23 am
Hey!

Thanks for that awesome tutorial!
But unfortunately it didn't quite work for me...

I did everything as you said. But
in game it only shows me those ugly, purple/black squared texture (-> http://puu.sh/hg4dX/235b1ab071.jpg) Do you know how that can be?

- Mors
  • usa
  • Level 38
  • Artisan Artist
  • April 16, 2015, 3:43 pm
hello!!
when I encountered this problem it was almost always because in one of my files related to that block there was an extra comma at the end of an array (list). check to make sure you're not missing any punctuation or have any extra punctuation
  • Mr_minakill
  • Level 23
  • Expert Miner
  • April 12, 2015, 11:30 am
Hi how to change to other variants if im not using textures like a random?
  • usa
  • Level 38
  • Artisan Artist
  • April 14, 2015, 1:21 pm
you cannot specify which texture you want to use where. it is always random. (unfortunately)
  • Cypher777
  • Level 38
  • Artisan Grump
  • April 8, 2015, 9:28 pm
Hi Steve!
Thank you for this tutorial, I greatly appreciate it! This is still a feature I am trying to gain expertise in and I had a related question for you.
In the Sphax PureBDcraft pack he uses several random grass textures. These seem to include a rotation setting (maybe?) as well as an overlay layer (flowers with transparency). I was wondering if you could enlighten me on these settings? I pasted his related .json file below for reference. Is the Y a rotated variation? I was thinking it was however each Y variation is also a different texture file so that didn't make sense to me. Also, I don't see any reference in the .json to his overlay files (bdc_grass_top_overlay1). I'm only running a default client, no mods that could affect these things like optifine or CTM.
Again, thank you for helping us utilize all the potential features that could make our texture packs amazing! :D

{
"__comment": "Designed by Sphax for PureBDcraft - bdcraft.net",
"variants": {
"snowy=false": [
{ "model": "grass_normal" },
{ "model": "bdc_grass_normal01", "weight": 37, "y": 90 },
{ "model": "bdc_grass_normal02", "weight": 40, "y": 180 },
{ "model": "bdc_grass_normal03", "weight": 40, "y": 270 },
{ "model": "bdc_grass_normal04", "weight": 40 },
{ "model": "bdc_grass_normal05", "weight": 40 },
{ "model": "bdc_grass_normal06", "weight": 2 },
{ "model": "bdc_grass_normal07", "weight": 1 }
],
"snowy=true": { "model": "grass_snowed" }
}
}
  • usa
  • Level 38
  • Artisan Artist
  • April 9, 2015, 6:03 pm
I just saw I did not go over rotating models in my tutorial, sorry about that.
"y" is used to spin the model like a spinning top (or like a merry go round). "z" (could be "x", I havent played around with this in a while) spins it on its side.

example:
..."{ "model": "bdc_grass_normal01", "weight": 37, "y": 90 },"... 
this is using a model called "bdc_grass_normal01" and then taking it and spinning it 90 degrees.

you could change it to this:
..."{ "model": "bdc_grass_normal01", "weight": 37, "z": 90 },"...
and then any instance of grass using that model will be flopped on its side.

hope that helps!
  • Alses
  • Level 5
  • Apprentice Architect
  • January 28, 2015, 2:13 pm
Hi, could I have some help? I've been using the same method but for some reason it have never worked for bricks and I've tried both bricks and plain brick as the .json's name in the blockstate folder but neither work. Everything is set up properly (checked so many times I lost count) so I've no idea why it isn't behaving. Have you had any similar issue?
  • usa
  • Level 38
  • Artisan Artist
  • January 29, 2015, 11:42 am
I'm not sure what your issue is. If you could go into further detail about how it's acting up (is the default texture showing, is it purple/black, etc) that would help.
if it's showing the default texture, in my experience it's most likely a problem with file names / file structure. make sure everything is named correctly and everything is pointing to the correct names.
if it's purple/black, in my experience it is most likely a syntax error. I would check your arrays (lists marked off with [ and ]) to make sure you dont have any extra commas or anything funny like that.
Please tell me if I am correct or way off.  If I wanted to use a different texture for the top and bottom of one of the varients would I just add those texture file names to that varients file defining top and bottom and then add them to my textures folder?
  • usa
  • Level 38
  • Artisan Artist
  • November 11, 2014, 5:43 pm
I think you are correct. You would make a new model.json file for the alternate model, then define "up" as your top texture and "down"  for the bottom texture. As long as you have consistent names across the board and you put the right file directory, you should be okay.
This was so very helpful for me, I'm new at this and it helped me understand so easily. Please do more of this kind of tutorial.  Your examples and explination of the code were great.  I learn well that way.

Again thaks so much!
  • usa
  • Level 38
  • Artisan Artist
  • November 11, 2014, 5:44 pm
I'm very very happy I could help, I may make more tutorials for resource pack stuff in the future.
  • zob
  • Level 48
  • Master Button Pusher
  • October 22, 2014, 7:22 am
Good tutorial, I'm sure it'll help me alot once I get to make random textures. The default random blocks look pretty derpy with my textures.
  • usa
  • Level 38
  • Artisan Artist
  • October 22, 2014, 12:34 pm
if you make 'em all in the same session then that typically fixes that problem. For me, I change things like how I hold the pen slightly between sessions so if I dont make all my alternate blocks in one go, they dont look right.
good luck though!
  • zob
  • Level 48
  • Master Button Pusher
  • October 22, 2014, 1:02 pm
That's not really the problem, I have a hard time doing the models right ^^. I always mess up the file structure and get checkered purple/black blocks when I edit them by hand.
  • usa
  • Level 38
  • Artisan Artist
  • October 22, 2014, 1:09 pm
maybe I should make a quick tutorial on that some day.
My only major suggestion, would be to make a video, or add screenshots with arrows. Another great thing, would be to put a download link to the example you explained. This way, we can look at the actual files you use to create a pack like this.
  • usa
  • Level 38
  • Artisan Artist
  • October 12, 2014, 12:39 pm
the download link is a fantastic idea! I'll do that right now!
edit: just finished!
Nice! :D
  • WTFshady
  • Level 31
  • Artisan Dragonborn
  • October 12, 2014, 2:03 am
Nice. You should make a video too.
  • usa
  • Level 38
  • Artisan Artist
  • October 12, 2014, 6:53 am
I may end up doing that.
  • KennedyShu
  • Level 1
  • New Miner
  • October 11, 2014, 8:08 pm
This is great, but I hope you can specify more clearly(frequently) which .json file goes in which folder.


Adding screenshots(or even a video) will really help a lot.


Other than this being somewhat difficult to comprehend(at least for me) this is very helpful, thank you.
  • usa
  • Level 38
  • Artisan Artist
  • October 11, 2014, 9:28 pm
It is somewhat wordy, I agree. I am going to continue updating it to make it easier to read.

Edit: just updated it, maybe it's a little better already.

1 - 40 of 40

Show Comments

Search

Browse

Site

© 2010 - 2018
planetminecraft.com

Welcome