When using Better Mob Combat 1.3.0 with MineColonies 1.20.1-1.1.985-snapshot, a NullPointerException occurs when a knight NPC attempts to attack with a null target. The crash happens in the KnightCombatAI.getAttackDamage method when accessing this.target.m_6336()_.
Reproduction Steps
- Install Minecraft 1.20.1 with Forge 47.4.4
- Add Better Mob Combat 1.3.0 and MineColonies 1.20.1-1.1.985-snapshot
3.Create a colony with 2 knight NPCs
4.Put one mob and then trigger knights' combat behavior
5.Observe crash when knight tries to attack with another having killed the mob.
Environment Information
Minecraft Version: 1.20.1
Forge Version: 47.4.4
Better Mob Combat Version: 1.3.0
MineColonies Version: 1.20.1-1.1.985-snapshot
Java Version: 17.0.1
Crash Log Snippet
java.lang.NullPointerException:`` Cannot invoke "net.minecraft.world.entity.LivingEntity.m_6336_()" because "this.target" is null at com.minecolonies.core.entity.ai.workers.guard.KnightCombatAI.getAttackDamage(KnightCombatAI.java:269) at com.minecolonies.core.entity.ai.workers.guard.KnightCombatAI.doAttack(KnightCombatAI.java:160) at me.Thelnfamous1.bettermobcombat.logic.MobCombatHelper.lambda$processAttack$0(MobCombatHelper.java:169) at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:102)`
When using Better Mob Combat 1.3.0 with MineColonies 1.20.1-1.1.985-snapshot, a NullPointerException occurs when a knight NPC attempts to attack with a null target. The crash happens in the KnightCombatAI.getAttackDamage method when accessing this.target.m_6336()_.
Reproduction Steps
3.Create a colony with 2 knight NPCs
4.Put one mob and then trigger knights' combat behavior
5.Observe crash when knight tries to attack with another having killed the mob.
Environment Information
Minecraft Version: 1.20.1
Forge Version: 47.4.4
Better Mob Combat Version: 1.3.0
MineColonies Version: 1.20.1-1.1.985-snapshot
Java Version: 17.0.1
Crash Log Snippet
java.lang.NullPointerException:`` Cannot invoke "net.minecraft.world.entity.LivingEntity.m_6336_()" because "this.target" is null at com.minecolonies.core.entity.ai.workers.guard.KnightCombatAI.getAttackDamage(KnightCombatAI.java:269) at com.minecolonies.core.entity.ai.workers.guard.KnightCombatAI.doAttack(KnightCombatAI.java:160) at me.Thelnfamous1.bettermobcombat.logic.MobCombatHelper.lambda$processAttack$0(MobCombatHelper.java:169) atnet.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:102)`