[TUTORIAL] Random Textures, Random Texture Rotation

Started by FredLeon on

Topic category: User side tutorials

Last seen on 17:03, 1. Mar 2024
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] Random Textures, Random Texture Rotation
Thu, 10/06/2022 - 21:43 (edited)

[TUTORIAL] Random Textures, Random Texture Rotation

This is something I wanted to do but couldn't find anything on the Mcreator forums, after some help from a friend I finally managed to get it.

This Tutorial will explain:

- How to have placed blocks (Naturally generated too) have a random texture rotation (Ex: Sand, Grass block)

-How to use random textures for blocks (Different texture variations)

 

Process:

You may need to lock your mod element for the block you want to edit.

After locking that element, you will have to open two .json files.

This .json file will render the block textures, here we will add all the variants and rotations

This .json file is the block model, it normally includes the block texture and breaking particles.

 

Random Texture Rotation:

Here is an example for a block that has 4 variants, each one with a 90 degree rotation. When a block is placed in-game, one of these variants will be picked.

To add a variant, you'll need to turn "" into an array by putting all the models inside of square brackets [ ]. Every variant is inside of curly brackets { }, DON'T FORGET TO ADD A COMMA AT THE END OF EACH CLOSING CURLY BRACKET EXCEPT THE LAST ONE!

Inside the curly brackets there will be a "model" and one or multiple rotation variables ("x", "y" and "z") which will rotate the block model, y Roation is recommended for normal random texture rotation (Ex: Sand, Grass Block, etc..), anything with x and z rotation may be done at the user's own risk!

Block models are stored inside of Resources/Assets/ModName/models/block

After adding all rotations, save all the files and test it in-game. If everything goes right, you will see random rotations in your textures. If your block displays a missing texture (Magenta and Black checkerboard texture), it means you have an error in your code (most likely a typo, check your code carefully).

Random Texture variants:

Adding texture variants works the same as adding new rotation variants.

First navigate to your block models folder (shown above) and create a new .json file, name it accordingly. Go to the block model .json file of the block you want to edit, copy and paste all the code into the new file you made before.

Edit the texture name inside of the texture field (Single texture blocks have "all", multi-texture blocks will use "north", "south", "west", etc...), you can find your texture name by going in the textures tab in Mcreator and hovering your mouse over the desired texture.

Once you have made your edits, save the file and go to the .json file that contains all the variants.

Like with random texture rotations, add a new variant with the model name being the name of the new file you created and edited before

After adding all texture variants, save all the files and test it in-game. If everything goes right, you will see random textures on your blocks. If your block displays a missing texture (Magenta and Black checkerboard texture), it means you have an error in your code (most likely a typo, check your code carefully).

End:

The deal is done, you have finally added your texture variants and rotations, pat yourself on the back and take a break.

Edited by FredLeon on Thu, 10/06/2022 - 21:43
Last seen on 17:03, 1. Mar 2024
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Version with images that…
Thu, 10/06/2022 - 21:35

Version with images that will hopefully load