Jump to content

Recommended Posts

Posted

hi,

I need the 3d-data for the blocks.

What I tried so far is using the.getQuads() method on the IBakedModel.
This worked somehow, but I didn't get all models and some were not complete (e.g. for stairs some faces were missing).

Instead I got this (paste into OpenSCAD and press F5 to generate the model) https://bpaste.net/show/7a81359c837e

Bildschirmfoto_2018-12-23_22-46-11.png.378bec2cdf9d5a7c3277b6fad04331bd.png

The data is provided in a two dimensional array and the seccond dimension contains either one face from the lower block and one from the upper or only one face, in which case there is no way to know from which of the two blocks it is.

 

What I need in this example of the stairs is the size and position of the bottom, bigger block and the size and position of the smaller top block.

 

 

So the best option would be now to the data from the blockstate-.json and model-.json files where Minecraft also initially gets the data.
I hoped that it it is possible to get the already parsed data from Minecraft somehow, because then it would be compatible with all mods.
The other option would be to somehow replicate the resource loading and load the blocks myself.

After some time I got it somehow working for most vanilla blocks. But  I used a very hacky way by manually loading the resources with
 

ResourceLocation location = blockState.getBlock().getRegistryName();
InputStream in = classloader.getResourceAsStream("assets/" + location.getResourceDomain() + "/blockstates/" + location.getResourcePath() + ".json");
ModelBlockDefinition def = ModelBlockDefinition.parseFromReader(new InputStreamReader(in, StandardCharsets.UTF_8), location);

...
  
ModelBlock block = ModelBlock.deserialize(reader);

and so on. The rotation (which is in the blockstates-files) was only accessible with reflection (or parsing of the names of the ModelRotation-Enum which would be also a bad way.)...

And for multiblocks I also had to use a special loading procedure.

After all it works somehow for many blocks, but not for all blocks and maybe not for modded blocks (haven't tried this yet).

One problem with this is that some blocks use a different location for the resources. Like "deadbush" which uses the location "dead_bush" and because of this I cannot get the right json with .getRegistryName()

 

 

Is there any way to get either the correct ResourceLocation or even better to get the ready to use Block 3D data and rotation?

 

Thank you,

aligator

Posted

What are you trying to achieve? I.e. what are you going to use these models for

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.