Fix potential NullPointerException
This commit is contained in:
parent
c565eb24f4
commit
3362f69cab
1 changed files with 3 additions and 1 deletions
|
@ -83,7 +83,8 @@ public class OtherModHandler {
|
||||||
final Class<?> finalCustomNPCsIEntity = customNPCsIEntity;
|
final Class<?> finalCustomNPCsIEntity = customNPCsIEntity;
|
||||||
|
|
||||||
customNPCsEventBus.addListener(EventPriority.LOWEST, true, (event) -> {
|
customNPCsEventBus.addListener(EventPriority.LOWEST, true, (event) -> {
|
||||||
if (finalCustomNPCsPlayerHurtEvent.isInstance(event)) {
|
if (finalCustomNPCsPlayerHurtEvent.isInstance(event)
|
||||||
|
&& TurnBasedMinecraftMod.proxy.getAttackingEntity() != null) {
|
||||||
Field damageSourceField;
|
Field damageSourceField;
|
||||||
try {
|
try {
|
||||||
damageSourceField = finalCustomNPCsPlayerHurtEvent.getField("damageSource");
|
damageSourceField = finalCustomNPCsPlayerHurtEvent.getField("damageSource");
|
||||||
|
@ -167,6 +168,7 @@ public class OtherModHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
TurnBasedMinecraftMod.logger.info("Enabled NpcAPI handling of Player damaged event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue