Modular Routers & Carry On 1st person item rendering
desht opened this issue ยท 5 comments
Hi, Modular Routers author here. You might have noticed a comment on Curseforge from SilverDarkBlade regarding (1st person) rendering problems when holding carryable blocks (plain white or completely missing textures for the carried block).
I've done some research, and discovered that Modular Routers particle rendering code is definitely related to this problem, although I haven't figured out whether it's me or you at fault yet :) Anyway, the specific line that causes the problems is https://github.com/desht/ModularRouters/blob/MC1.12-master/src/main/java/me/desht/modularrouters/client/fx/FXSparkle.java#L61 :
Minecraft.getMinecraft().renderEngine.bindTexture(particles);
Comment that out, and the problem disappears.
This code is called during particle drawing, which is run from a RenderWorldLastEvent
event handler.
I guess the question is, why does binding a texture to do some drawing work affect your rendering of held blocks? I haven't looked at your code, but I presume you're rendering the block from a RenderWorldLastEvent
handler which runs after mine? And somehow that bound texture is messing the rendering up?
Anyway, thought I'd put this here and see if you have a better idea about it than me...
Interesting... I'm rendering twice, once for first and once for third person.
The render calls are made during RenderHandEvent
and RenderPlayerEvent.Post
.
When these events are fired, an IBakedModel is fetched and rendered using Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(ItemStack, World, EntityPlayer);
Now I'm wondering, do your blocks not have item textures? Or no ItemBlocks at all?
I don't think it's related to item textures for my router blocks specifically - the bug affects all held items (e.g. an RFTools block). Other than chests, which seem to render fine - but I know they have some special rendering...
I don't think it's relevant, but my routers do use a custom baked model because they can be camouflaged. But under normal circumstances, that custom baked model just returns the parent model (i.e. the router's real baked model). Only when camouflaged does it return the model of the camo block being used.
No, I'm pretty sure it's down to that bindTexture()
call I make in the particle rendering code. If I comment that, all your rendering is fine (but my particle rendering breaks, of course...)
You know, now that I think about It, I've seen this weird bug where the textures are somehow pulled from anywhere on the sheet, but only for other players in multiplayer. This seems related. Do you have some screenshots of how this looks like?
Sorry, don't have any screenshots to hand right now, but I'll try to get some soon. But basically, any carried items either don't render at all in 1st person (they're fine in 3rd person), or they render with the right shape but a blank white texture.
Hey @desht, thank you so much for your help! I managed to fix it, I had forgotten to bind the Block-Texturemap!