Null check knockback event
This commit is contained in:
parent
7b650a2af4
commit
fe0d058160
|
@ -51,7 +51,6 @@ import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.npc.NPCRegistry;
|
|
||||||
import net.citizensnpcs.api.util.BoundingBox;
|
import net.citizensnpcs.api.util.BoundingBox;
|
||||||
import net.citizensnpcs.api.util.EntityDim;
|
import net.citizensnpcs.api.util.EntityDim;
|
||||||
import net.citizensnpcs.api.util.Messaging;
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
|
@ -113,6 +112,8 @@ public class NMS {
|
||||||
|
|
||||||
public static void callKnockbackEvent(NPC npc, float strength, double dx, double dz,
|
public static void callKnockbackEvent(NPC npc, float strength, double dx, double dz,
|
||||||
Consumer<NPCKnockbackEvent> cb) {
|
Consumer<NPCKnockbackEvent> cb) {
|
||||||
|
if (npc.getEntity() == null)
|
||||||
|
return;
|
||||||
if (SUPPORT_KNOCKBACK_RESISTANCE && npc.getEntity() instanceof LivingEntity) {
|
if (SUPPORT_KNOCKBACK_RESISTANCE && npc.getEntity() instanceof LivingEntity) {
|
||||||
try {
|
try {
|
||||||
AttributeInstance attribute = ((LivingEntity) npc.getEntity())
|
AttributeInstance attribute = ((LivingEntity) npc.getEntity())
|
||||||
|
@ -689,8 +690,8 @@ public class NMS {
|
||||||
BRIDGE.removeFromWorld(entity);
|
BRIDGE.removeFromWorld(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
|
public static void removeHookIfNecessary(FishHook entity) {
|
||||||
BRIDGE.removeHookIfNecessary(npcRegistry, entity);
|
BRIDGE.removeHookIfNecessary(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void replaceTracker(Entity entity) {
|
public static void replaceTracker(Entity entity) {
|
||||||
|
|
Loading…
Reference in New Issue