Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LivingEntityRenderer.AddLayers hard casts to LivingEntityRenderer, crashing when renderers are replaced #9683

Closed
MehVahdJukaar opened this issue Jul 25, 2023 · 1 comment · Fixed by neoforged/NeoForge#510

Comments

@MehVahdJukaar
Copy link

MehVahdJukaar commented Jul 25, 2023

Noticed in mc 1.19.2 latest forge. Probably in 1.20 too
Basically if a mod were to (somehow) replace a living entity renderer with one that is not extending LivingEntityRenderer, the event add layer function, when called by another mod, would crash due to unsafe cast incorrectly blaming the latter mod.
Note that my main concern here is my mod (which used add layer event) being blamed and not the other one incase replacing renderers is done incorrectly

@MehVahdJukaar MehVahdJukaar added the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Jul 25, 2023
@LexManos
Copy link
Member

Your post is very confusing. Would be better if you used the actual class names and/or produced a stacktrace shows the actual issue. But I think I understand what you're talking about. net.minecraftforge.client.event.EntityRenderersEvent.AddLayers.getSkin(Model) and net.minecraftforge.client.event.EntityRenderersEvent.AddLayers.getRenderer(EntityType<? extends T>) have generic return types that extend LivingEntityRenderer where as their backing maps only extend EntityRenderer so if someone were to NOT use the event, and register their renders directly to the vanilla fields somehow, then a class cast exception could be thrown.

@autoforge autoforge bot removed the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants