a3626a / HungryAnimals

Minecraft mod hungry animals
12 stars 2 forks source link

[crash] [mod interaction] Problem with cast to EntityPlayer #30

Closed Siphalor closed 6 years ago

Siphalor commented 6 years ago

In a self-created modpack I came recently across a strange bug:

I am using the Dissolution mod which allows players after death to possess hostile mob's bodies.

The problem is that for checking whether the debug glass is equipped in DebugOverlayHandler.java:73 you're casting the render view entity to an EntityPlayer. But other mods such as Dissolution are not forced to extend EntityPlayer so the game crashes with a message like this:

java.lang.ClassCastException: ladysnake.dissolution.common.entity.minion.EntityMinionZombie cannot be cast to net.minecraft.entity.player.EntityPlayer
    at oortcloud.hungryanimals.items.gui.DebugOverlayHandler.onUpdate(DebugOverlayHandler.java:75)

Maybe you could firstly check whether it extends or even better if possible you could use an alternate class such as EntityMob (i'm not quite sure whether this class provides getHeldItem()).

a3626a commented 6 years ago

Yes, as you suggested, it can be easily solved. thank you for your report.

a3626a commented 6 years ago

50464958fe2632a5070a27a64b27158f4c899732

https://minecraft.curseforge.com/projects/hungryanimals/files/2566516