Posted October 14, 20205 yr Hey modders! I'm looking to find out if it's possible for me to toggle individual parts of a .obj block model via the java code. The block in question will be a TileEntity because it needs to function, so I'm assuming a TESR may be in order? I've been away from the modding scene for a while, and as a result have forgotten how these are set up. Besides, the code has changed significantly since last time and I don't want to assume it's the same, and the documentation is untrustworthy and out-of-date. Not only that, but I don't know if a TESR is the way to go. TLDR: The .obj model comprises of multiple objects, some of which I want to control the visibility of (just a simple toggle on/off) from Java. What would be the best approach to doing this? As an added bonus, is there a way I can control cullable faces? When using "detectCullableFaces": true and placing multiple of my block next to one another, touching faces are culled in a way that doesn't look right, and it's not a backface problem in the model because I always check those. The model isn't super high poly-count so I could get away with disabling cullable faces which leaves the model looking correct, but I would like the block to be optimised if I can. Thanks in advance for any help.
October 15, 20205 yr You may want to take a look at this example here: https://wiki.mcjty.eu/modding/index.php?title=Render_Block_TESR_/_OBJ-1.12 Its for 1.12 but the idea is still valid in the most recent versions...you can see it is rendering different parts of an OBJ model, one that is static and one that is rotating around the Y axis. As for the culling problem, if your block is not a full cube, you have to tell that to the game, otherwise it will still consider it as a full cube and it will not render the faces of adiacent block because it thinks they cannot be seen. So you have to set an appropriate voxel shape for your block. You can look at other vanilla non full-cube blocks to see how they are handled Edited October 15, 20205 yr by Beethoven92 Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
October 16, 20205 yr Author 18 hours ago, Beethoven92 said: You may want to take a look at this example here: https://wiki.mcjty.eu/modding/index.php?title=Render_Block_TESR_/_OBJ-1.12 Its for 1.12 but the idea is still valid in the most recent versions...you can see it is rendering different parts of an OBJ model, one that is static and one that is rotating around the Y axis. As for the culling problem, if your block is not a full cube, you have to tell that to the game, otherwise it will still consider it as a full cube and it will not render the faces of adiacent block because it thinks they cannot be seen. So you have to set an appropriate voxel shape for your block. You can look at other vanilla non full-cube blocks to see how they are handled Aha, perfect find, thank you! I'll look into it
October 16, 20205 yr Author Alright, I was able to attach a TileEntityRenderer to my block, however if I override render() and leave the function empty, it seems to still be rendering the block as default. I checked with logging and it is being called. Why could this be? I'm not calling the super.
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.