Crash when using visible-entities
Closed this issue ยท 4 comments
Hi,
I am the developer of visible-entities and recently got a bug report about an incompatibility between VisibleEntities and EntityCulling - ToBinio/visible-entities#9
Based on what I can see, the problem seems to caused by:
My mod adds a custom EntityRenderer for interactions, including its own RenderState.
But EntityCulling does only create the default vanilla EntityRenderState which then crashes the game since the interaction's specific renderState was expected.
Could this be fixed in someway?
Either by calling the createRenderState() if available or by not using an interaction?
If you have an idea how does could be fixed from my side, I would also love to hear that!
Tbh, I didn't yet have much time to look into your code, so I am unsure of what a possible solution would be
Thanks in advance!
Hey there. The Interaction Entity is used exactly because it is an entity without a renderer. That's also why createRenderState() is not used, since that would just cause unnecessary overhead for something that does nothing. Usually you could just fix this with an instanceof check, the issue here is, that the EntityRenderState gets shoved into your custom renderer by Minecraft and causes the crash before you can check it. We also can't use a InteractionEntityRenderState, since that doesn't exist. Maybe you can change your InteractionEntityRenderer to accept any EntityRenderState, and then just instanceof check if it's your custom InteractionEntityRenderState?
I would also like to mention that creating a new render state for interaction entities (and markers) is kinda pointless. As EntityRenderState already stores the dimensions of the entity in the width and height fields.
Maybe you can change your InteractionEntityRenderer to accept any EntityRenderState, and then just instanceof check if it's your custom InteractionEntityRenderState?
Don't love the solution, but it's an easy fix, so I implemented it
Thanks a lot for the quick answers!