Jump to content

aligator

Members
  • Posts

    1
  • Joined

  • Last visited

aligator's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. 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 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
×
×
  • Create New...

Important Information

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