Skip to content

Crash due to failing to do a cast when the raider check if it should steal. #42

@mmarquezs

Description

@mmarquezs

Hi,
It seems like an easy fix, basically here and maybe in other places there isn't a check to see if that item it's actually an ItemArmor before doing the casting:

else if (itemarmor.damageReduceAmount == ((ItemArmor)itemarmor1.getItem()).damageReduceAmount)

In my case there was an ItemSkull on the raider (not sure if that's normal) that when the raider tried to check if it should steal, it crashed the server with this error:
( https://pastebin.com/JuQPHUgu )
java.lang.ClassCastException: net.minecraft.item.ItemSkull cannot be cast to net.minecraft.item.ItemArmor at com.gendeathrow.pmobs.entity.ai.EntityAIStealItemInv.shouldStealItem(EntityAIStealItemInv.java:209) at com.gendeathrow.pmobs.entity.ai.EntityAIStealItemInv.func_75246_d(EntityAIStealItemInv.java:129) at net.minecraft.entity.ai.EntityAITasks.func_75774_a(SourceFile:129) at com.bloodnbonesgaming.calmdownzombieguy.EntityAITasksOverride.func_75774_a(EntityAITasksOverride.java:29) at net.minecraft.entity.EntityLiving.func_70626_be(EntityLiving.java:763) at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2359) at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:577) at net.minecraft.entity.monster.EntityMob.func_70636_d(EntityMob.java:45) at com.gendeathrow.pmobs.entity.mob.EntityRaiderBase.func_70636_d(EntityRaiderBase.java:219) at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2179) at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:295) at net.minecraft.entity.monster.EntityMob.func_70071_h_(EntityMob.java:50) at net.minecraft.world.World.func_72866_a(World.java:1996) at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:832) at net.minecraft.world.World.func_72870_g(World.java:1958) at net.minecraft.world.World.func_72939_s(World.java:1762) at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767) at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) at java.lang.Thread.run(Thread.java:748)

If I said something wrong please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions