As the title says, I am trying to make blocks whose textures are randomly generated when a new world is created. Right now I have a couple blocks with two textures: a base texture, and an ore "overlay" texture.
When a world is created I want the game to randomly choose from an array, or folder, of textures, and apply it to those blocks permanently for that world.
From what I understand, if you want multiple textures for a block, you usually put variants in the blockstate json file. Unfortunately I have no idea how to randomize that at world generation with json, without creating a buttload of preset textures before hand.
If I could just do something like this It would make it way easier:
public static Texture[] baseTextures = new Texture{Texture1.png, Texture2.png...., Texture20.png, etc...};
public static Texture[] oreTextures = new Texture{oreTexture1.png, oreTexture2.png...., oreTexture50.png, etc...};
Random r1 = new Random.nextInt(baseTextures.length);
Random r2 = new Random.nextInt(oreTextures.length);
myBlock.setBaseTexture(baseTextures[r1]);
myBlock.setOreTexture(oreTextures[r2]);
As the title says, I am trying to make blocks whose textures are randomly generated when a new world is created. Right now I have a couple blocks with two textures: a base texture, and an ore "overlay" texture.
When a world is created I want the game to randomly choose from an array, or folder, of textures, and apply it to those blocks permanently for that world.
From what I understand, if you want multiple textures for a block, you usually put variants in the blockstate json file. Unfortunately I have no idea how to randomize that at world generation with json, without creating a buttload of preset textures before hand.
If I could just do something like this It would make it way easier:
(obviously pseudo code, but you get the idea)
Any Ideas on where to start?