Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved][1.14.4] Multipart model; Conditional texture?
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 2
imacatlolol

[Solved][1.14.4] Multipart model; Conditional texture?

By imacatlolol, November 13 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

imacatlolol    15

imacatlolol

imacatlolol    15

  • Stone Miner
  • imacatlolol
  • Forge Modder
  • 15
  • 53 posts
Posted November 13 (edited)

I have a multipart model for a block with a lot of states (maybe too many, but that's another issue). In it, some of the block state properties needs to be able to change the texture of the model. Ideally I'd add conditions in the multipart model definition to set the texture appropriately, but it seems like this feature isn't available.

 

Since I'd prefer not to make a hundred or so new model JSONs just to do what I want (since that would increase load time and make things tough for resource pack makers), is there a good workaround for what I'm trying to achieve?

Edited November 15 by imacatlolol
  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Okmeis    1

Okmeis

Okmeis    1

  • Tree Puncher
  • Okmeis
  • Members
  • 1
  • 11 posts
Posted November 13

If I understand you right, I think I have a similar issue at the moment ^^

  • Quote

Share this post


Link to post
Share on other sites

imacatlolol    15

imacatlolol

imacatlolol    15

  • Stone Miner
  • imacatlolol
  • Forge Modder
  • 15
  • 53 posts
Posted November 15 (edited)

Bumping, if that's alright.

One of my ideas for a solution would be to assign it a dedicated texture map that contains all of the variants, then somehow offset the UVs in a custom baked model. Not sure how to go about offsetting things like that, if that's even the best idea.

Edited November 15 by imacatlolol
Clarity
  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    277

Cadiboo

Cadiboo    277

  • Reality Controller
  • Cadiboo
  • Members
  • 277
  • 3303 posts
Posted November 15
11 hours ago, imacatlolol said:

One of my ideas for a solution would be to assign it a dedicated texture map that contains all of the variants, then somehow offset the UVs in a custom baked model. Not sure how to go about offsetting things like that, if that's even the best idea.

I recommend against making your own texture map. Also, baked models I’ve always point into the block texture map, you would have to stitch your own texture map into the block texture map. I think that the best thing to do is to make the json files. Also, metadata (blockstate files) should be kept separate from data (model files).

  • Quote

Share this post


Link to post
Share on other sites

imacatlolol    15

imacatlolol

imacatlolol    15

  • Stone Miner
  • imacatlolol
  • Forge Modder
  • 15
  • 53 posts
Posted November 15
1 hour ago, Cadiboo said:

I recommend against making your own texture map. Also, baked models I’ve always point into the block texture map, you would have to stitch your own texture map into the block texture map.

For clarity, my idea there was to have a single set of model jsons and do this, which would (from what I understand) ensure all variants are stitched onto the block texture map, even if they aren't directly referenced in the variant models. Since it does ruin the space efficiency of the generated texture atlas, I would probably instead look into the TextureStitchEvent to see if I can insert the textures there.

1 hour ago, Cadiboo said:

I think that the best thing to do is to make the json files.

As suggested, I tried making all of the json files. It gives me the desired effect, of course, but it also added a significant (i.e. noticeable/non-trivial) increase in loading time. It also turned my filesystem into spaghetti, forcing me to use subdirectories just store all of the variants for each json model to not clog things up. This is all for just one complex block, which means the problem could compound if I ever want to add similarly detailed multipart blocks.

 

This is really just an edge/corner-case issue, so using the normal route for this wouldn't be the end of the world, but I'd really prefer a less painful route. On the topic of baked models, something like this might be an option, especially if I use the TextureStitchEvent as I'd mentioned.

  • Quote

Share this post


Link to post
Share on other sites

imacatlolol    15

imacatlolol

imacatlolol    15

  • Stone Miner
  • imacatlolol
  • Forge Modder
  • 15
  • 53 posts
Posted November 15

After a bit of digging and testing, I've determined a solution that is adequate, though not very clean. (Pinging @Okmeis so they can see if this works for them)

  • Add all needed textures to the atlas using TextureStitchEvent.Pre.
  • In ModelBakeEvent, grab all existing registered models relating to the block from the registry, then wrap each state's model in a custom baked model and replace the registry entry.
    • The custom baked model can then use the handy vanilla BakedQuadRetextured to "change" the texture of the wrapped model's quads.

This feels kind of hack-ish, but it does produce the desired results with a minimal impact on load times and no file-spaghetti. I'm sure a superior solution can be found, so I'm happy to try other ideas.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 2
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • The_Unkown675
      Can't connect to own server; No syncable config

      By The_Unkown675 · Posted 8 minutes ago

      Server debug file - https://paste.gg/p/anonymous/0671148362b5476fbce55b8922262dad Latest log file -https://paste.gg/p/anonymous/bab7c2b3ca0947df9b10bce9c2632c22 Hope this helps! If you need anything else please let me know, I'll be happy to help, thank you for your help!
    • diesieben07
      Forge 1.12.2 crashes and wont load world!

      By diesieben07 · Posted 9 minutes ago

      In the future please always post the debug.log. From the excerpt you posted it looks like your world got corrupted. Restore from backup.
    • diesieben07
      Clean forge installer

      By diesieben07 · Posted 12 minutes ago

      Only ever download Forge from https://files.minecraftforge.net/. Any other site offering Forge downloads is illegitimate.   There is no Forge version for 1.15 at this time. Be patient.
    • DragonITA
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA · Posted 16 minutes ago

      To extends the HorseModel i need replace the LivingEntity with the AbstractHorseEntity.
    • CrashDbo
      [1.12.2] Water Crafting with dropped items like AE2

      By CrashDbo · Posted 16 minutes ago

      Thanks for the Advise, I will look at both ways and see what will work best.
  • Topics

    • The_Unkown675
      2
      Can't connect to own server; No syncable config

      By The_Unkown675
      Started 18 hours ago

    • PolarBr0
      1
      Forge 1.12.2 crashes and wont load world!

      By PolarBr0
      Started 29 minutes ago

    • Rick57
      1
      Clean forge installer

      By Rick57
      Started 3 hours ago

    • DragonITA
      44
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started Monday at 10:06 AM

    • CrashDbo
      3
      [1.12.2] Water Crafting with dropped items like AE2

      By CrashDbo
      Started 17 hours ago

  • Who's Online (See full list)

    • OxyWorlds
    • diesieben07
    • CrashDbo
    • ShetiPhian
    • PolarBr0
    • Redstoneguy129
    • lopiy
    • AmateurHalibut
    • AdieCraft
    • Draco18s
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved][1.14.4] Multipart model; Conditional texture?
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community