
Rendering error with painted glowstone and dark pressure plates
HenryLoenwind opened this issue ยท 6 comments
Ok, the problem is:
When rendering a painted block, the the task is relayed to the renderer of the block that is the paint source. To fool that renderer, the World is wrapped with a wrapper that will return the paint sources for all blocks instead of the painted blocks. However, the pressure plates are painted with full blocks. so when the RedSand renderer asks the pressure plate if it isOpaqueCube(), the question will actually be relayed to the RedSand (or LapizBlock) block. They will say "yes" (where the pressure plate would have said "no"), so the RedSand renderer that is rendering the PaintedGlowstone will see no reason to render that side.
Solutions:
(1) Change the wrapper to only wrap for the block that is being rendered. This would break things like connected textures and rendering-based multi-blocks between painted blocks.
(2) Let it wrap the returned block objects in a block wrapper that changes the response for isOpaqueCube(). This may break countless things as it is legal in Minecraft to compare block objects for identity.
(3) For the standard RenderBlocks, set the flag renderAllFaces. This would work for all blocks that are rendered with that one, but custom rendering may still fail.
(4) On-demand ASM-wrap all isOpaqueCube() methods when they are on an object that is to be returned by the wrapper. Functionality-wise the perfect solution, but very, very tricky to implement.
(5) Not allow non-cube paintedWhatevers to be painted with isOpaqueCube() blocks. That would work wonderfully, but limit the user immensely.
I'm leaning towards (3). It is a quick thing to implement and would catch a good portion of cases. Alternatively using (2) only for the case of non-cube paintedBlock painted with full-cube block might work well, too.
can't you use a more simple renderer for such non opaque blocks? (i tried to find the render code from enderIO but no luck so far, the carpenters pressure plates code looks so simple and seems to work without problems) ... i must admit there are probably blocks that would benefit from connected textures as non opaque version, but do you even have something like paintable fences or any other "tile blocks" except pressure plates?
The problem is not as much the renderer. It is the "fake world" that is used to render painted blocks. In that "fake world" all painted blocks are replaced by the blocks they are painted as. Not just the currently rendered block, but all of them.
In the picture above, that world contains 5 red sand block in the back row and a lapis block, a red sand block and a dark pressure plate in the front row. Now the lapiz and red sand in the front row are full blocks, so the blocks in the back row think "hey, we don't need to render that side"---same as the sandstone blocks of the floor don't need to render their top sides under the painted glowstone or their other 5 sides where there's more sandstone.
Now on one hand we want to present that fake world to the block that is being rendered, on the other hand it doesn't work for non-full blocks that are adjacent to a painted block.
And yes, for "simple" blocks like the sand above (that's blocks that are solid and have just 6 textures), we can tell the vanilla renderer to just render all 6 sides without checking the neighbors (that's solution 3). I'm confident that that'll also work for some of the more complex vanilla blocks like slabs, stair, hoppers, but it won't work for modded blocks with their own renderers. At least if they do check their sides. Many don't and just always render all sided (not good for fps, but hey, even we are that lazy with our machines). That is why I'm leaning towards that solution. It's a "95% fixed for 1% of the work" kind of solution.
Go put some connected texture blocks from chisel into a carpenters block and see if they connect. They won't. Carpenters blocks' code is "cleaner" but only because it is less robust.
PS: @mindforger I just read your comment a second time, here's what I missed the first time:
It is not the renderer of the pressure plate that is failing. it is the renderer of the painted glowstone (or any other painted full block).
Yes, Ender IO also can paint carpets, fences, fence gates, slabs, stairs, cobblestone walls and a couple of Ender IO machines (buffers, travel anchor, ...).
@tterrag1098 yeah i knwo that but i was totally not aware that you can paint other half-blocks too ... i considered an alternative renderer JUST for the pressure plate but this would obviously fail on other half blocks then :P