Majrusz's Progressive Difficulty

Majrusz's Progressive Difficulty

2M Downloads

Trying to cast to EntityLiving

PaperTriangle opened this issue ยท 2 comments

commented

Check instanceof Entity before trying to cast to EntityLiving.

java.lang.ClassCastException: net.minecraft.entity.projectile.FireballEntity cannot be cast to net.minecraft.entity.LivingEntity
at com.majruszs_difficulty.events.when_damaged.WhenDamagedEvent.onAttack(WhenDamagedEvent.java:33) ~[majruszs_difficulty:1.0] {re:classloading}
at net.minecraftforge.eventbus.ASMEventHandler_395_WhenDamagedEvent_onAttack_LivingHurtEvent.invoke(.dynamic) ~[?:?] {}
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.5-service.jar:?] {}
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.5-service.jar:?] {}
at net.minecraftforge.common.ForgeHooks.onLivingHurt(ForgeHooks.java:343) ~[forge:?] {re:classloading,re:mixin}
at net.minecraft.entity.LivingEntity.func_70665_d(LivingEntity.java:1472) ~[?:?]

It looks like Entities that are not an EntityLiving can show up in this event through event.getSource().getTrueSource().

commented

I have also experienced this it seems to be any projectile that is shot from a not Living entity like dispenser to a Living Entity like a player.

Attached are the crash reports from the server.

crash-2021-01-16_02.36.49-server.txt
crash-2021-01-16_02.45.39-server.txt

commented

Thanks for your feedback! This has been fixed and in the latest update 0.3.2 there should not be problem with that anymore.