From 1f59f81489204b7ec74b8d993ad7f9d93cf112cc Mon Sep 17 00:00:00 2001 From: bconlon Date: Sat, 5 Dec 2020 21:57:50 -0800 Subject: [PATCH] Added a null check, this might fix a crash with inebriation. --- .../entities/effects/PotionInebriation.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gildedgames/the_aether/entities/effects/PotionInebriation.java b/src/main/java/com/gildedgames/the_aether/entities/effects/PotionInebriation.java index ddb8a50..244cb70 100644 --- a/src/main/java/com/gildedgames/the_aether/entities/effects/PotionInebriation.java +++ b/src/main/java/com/gildedgames/the_aether/entities/effects/PotionInebriation.java @@ -43,22 +43,24 @@ public class PotionInebriation extends Potion @Override public void performEffect(EntityLivingBase entityLivingBaseIn, int amplifier) { - this.distractEntity(entityLivingBaseIn); - - if (this.duration % 50 == 0) + if (entityLivingBaseIn != null) { - entityLivingBaseIn.attackEntityFrom(new DamageSource("inebriation"), 1.0F); - } + this.distractEntity(entityLivingBaseIn); - if (entityLivingBaseIn instanceof EntityPlayer) - { - if (this.duration >= 500) + if (this.duration % 50 == 0) { - ((PlayerAether) AetherAPI.get((EntityPlayer) entityLivingBaseIn)).setPoisoned(); - AetherNetwork.sendToAll(new PacketSendPoison((EntityPlayer) entityLivingBaseIn)); + entityLivingBaseIn.attackEntityFrom(new DamageSource("inebriation"), 1.0F); + } + + if (entityLivingBaseIn instanceof EntityPlayer) + { + if (this.duration >= 500) + { + ((PlayerAether) AetherAPI.get((EntityPlayer) entityLivingBaseIn)).setPoisoned(); + AetherNetwork.sendToAll(new PacketSendPoison((EntityPlayer) entityLivingBaseIn)); + } } } - } public void distractEntity(EntityLivingBase entityLivingBaseIn)