Jump to content

[1.15.2] Applying random textures to the block model


Ragna Aarok

Recommended Posts

I'm trying to make a column block that has random textures on all four of its sides. The closest I've been able to get with this is by choosing a random model from the blockstate like this:

{
  "variants":{
    "axis=y":[{"model":"modid:block/model1","weight":2},
    {"model":"modid:block/model2","weight":2},
    {"model":"modid:block/model3","weight":1}],
    "axis=z":[{"model":"modid:block/model1","weight":2,"x":90},
    {"model":"modid:block/model2","weight":2,"x":90},
    {"model":"modid:block/model3","weight":1,"x":90}],
    "axis=x":[{"model":"modid:block/model1","weight":2,"x":90,"y":90},
    {"model":"modid:block/model2","weight":2,"x":90,"y":90},
    {"model":"modid:block/model3","weight":1,"x":90,"y":90}]
  }
}

This, however, results in the models being picked randomly, but the textures on their sides are all the same. I thought I could try changing the block model to look similar to my blockstate, but either it's not possible, or I cannot seem to get the formatting right... Any help? Here's what I've got so far on my block model for reference.

{
  "parent":"block/cube_column",
  "textures":{
    "end":"modid:blocks/texture_top",
    "side":[{"textures":"modid:blocks/texture_side1","weight":2},
    {"textures":"modid:blocks/texture_side2","weight":2},
    {"textures":"modid:blocks/texture_side3","weight":1}]
  }
}

Thanks in advance!

Link to comment
Share on other sites

Howdy

You could perhaps use a multipart block, similar to this

https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/resources/assets/minecraftbyexample/blockstates/mbe03b_block_3dweb_registry_name.json

One multipart for each side, always true (so that all four sides show), with a random block model for each side.  If multipart lets you use random models for each part, that will probably give you what you want.

 

If that doesn't work, you could use a dynamic blockmodel

eg working examples here (but much more complicated than just using blockstate)

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe04_block_dynamic_block_models

 

-TGG

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.