Angel of Vengeance

Angel of Vengeance

870k Downloads

ClassCastException in AoVUIBar.render() when view entity is not an EntityPlayer

CplPibald opened this issue ยท 2 comments

commented

Minecraft client crashes in AoV hotbar render function when trying to ride a ThermalDynamics viaduct.

When riding a viaduct, ThermalDynamics sets the Minecraft render view entity to a custom Camera entity cofh.thermaldynamics.duct.entity.Camera. This line in AoVUIBar.render() is triggering a ClassCastException, causing the client to crash.

EntityPlayer entityplayer = (EntityPlayer) mc.getRenderViewEntity();

Recommended fix is to not attempt to render the hotbar when getRenderViewEntity() instanceof EntityPlayer is false.

Stack trace:

java.lang.ClassCastException: cofh.thermaldynamics.duct.entity.Camera cannot be cast to net.minecraft.entity.player.EntityPlayer
	at Tamaized.AoV.gui.client.AoVUIBar.render(AoVUIBar.java:38)
	at Tamaized.AoV.gui.client.AoVOverlay.RenderAoVData(AoVOverlay.java:49)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_40_AoVOverlay_RenderAoVData_RenderGameOverlayEvent.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
commented

I tried removing the (EntityPlayer) mc.getRenderViewEntity() line and that seemed to fix the crash. Per code inspection, the function does not appear to use the entityplayer variable at all.

commented

Yup, i'll be getting around to it when I have time, iirc I copied something over from vanilla or I was doing something with caps before and never bothered to clean it up.