Jump to content

Recommended Posts

Posted

I'd like to have a block model rotate at 16 different rotations, like signs; but I don't want to have a TESR because I don't want this block to have a tile entity (for various reasons). It seems the block state and model files can only specify rotations in increments of 90 degrees, meaning only 4 possible rotations, not 16. What's the best way to go about making this work? (Note: I already have the block state set like signs with a 16-integer ROTATION property, and that all works fine; it's just the model I need help with.)

I thought briefly about creating 16 textures, each one rotated by 22.5 degrees, and overriding the model's texture using Forge's blockstate format; but I'm no artist, so it's well beyond my abilities to rotate an image 22.5 degrees without introducing massive blur. That's why I'd like to do the rotations programmatically, somehow, if at all possible. I just can't seem to find a way to do that?

What's the best way to get this done?

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted (edited)

You can use B3D or OBJ models for this, though you will require  one model for each state (which will bloat your mods filesize)

You can also create an ICustomModelLoader, which loads a custom (dummy) IModel, which loads an IBakedModel. This is where you can get access to the blockstate, and in IBakedModel::getQuads, create a list of BakedQuads, which determines how to render what.
You're gonna have to get the default non-rotated model, get it's quads, rotate them, and return that. As for how you're going to rotate them, you can look in TRSRTransformation how vanilla handles 90 degree angles, or look up other sources.

 

Due note, to optimize the second option, only rotate each state once. Once you've rotated, stick the List<BakedQuad> in another list, which is sorted according to the rotational property of the model (rotation 0 = 0 degrees, rotation 1 = 22.5 degrees etc) and in the mentioned IBakedModel::getQuads, check if you have the model for rotation X. If you do, get it from the list. If you don't, make it, and add to list.

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

Yikes... Rendering code has always been my weakest area, and this sounds... complicated. I'll take a stab at it when I get a chance and I'll see what I can come up with; I'll probably end up posting more questions in this topic as I run into issues >_< . Thank you for pointing me in the right direction!

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted
3 hours ago, quadraxis said:

The Forge blockstate format is specified here: https://gist.github.com/RainWarrior/0618131f51b8d37b80a6

 

Also, from looking at the vanilla wiki: https://minecraft.gamepedia.com/Model#Block_models, you can 'offset' the rotation of model elements in 22.5 degree increments.

Ay! So it's just the blockstate rotation that must be in 90-degree increments? Dang it, I wish I'd known that before I posted this topic... Thank you! That will be the first thing I try :)

Whatever Minecraft needs, it is most likely not yet another tool tier.

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.