Use TileEntitySpecialRenderer instead of RenderWorldLastEvent
Techjar opened this issue ยท 4 comments
I don't really understand why you're using RenderWorldLastEvent, and ASMing into the EntityRenderer class to make the frustum a field, just so you can cull stuff yourself. It looks like what you're doing could be just as easily done using a TESR, and avoid the ASM entirely since Forge culls TESRs for you, therefore making your mod more compatible with other mods. If you have a valid reason for the way you're currently doing it, please tell me.
Chunk sector culling would result in the fastener tile entity not rendering while off screen and this is a problem since the cord needs to be rendered in all the chunks it's in that are on screen.
Fair enough. Although, I didn't think the TESR culling was based on chunk sectors, I thought that was only for normal block renders. Aren't TESRs just culled based on the frustum?
The only tile entities that have a chance to render based on if their bounding box is in the camera's frustum are those which are in chunks that have been deemed visible which is taken from the RenderGlobal#renderInfos.
In 1.9+ TESRs have an isGlobalRenderer function that they can override to return true
which puts them in a separate render list that gets iterated through after regular tile entity rendering. I would utilize that when I update Fairy Lights to a new version. The vanilla blocks which use this are beacons, end gateways, and structure blocks.