From 42670af93ba9541442fd768ff1bb53279d498489 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 26 Feb 2021 13:41:19 +0200 Subject: [PATCH] Reduce the chances of there being a NPE here --- .../com/minelittlepony/unicopia/entity/EntityPhysics.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java index 8c14516d..bbaa16ac 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java @@ -146,16 +146,16 @@ public class EntityPhysics> implements Physics if (master instanceof LivingEntity) { - if (((LivingEntity)master).isSleeping()) { - return 1; - } - if (((LivingEntity)master).getAttributes() == null) { // may be null due to order of execution in the constructor. // Will have the default (1) here in any case, so it's safe to ignore the attribute at this point. return getBaseGravityModifier(); } + if (((LivingEntity)master).isSleeping()) { + return 1; + } + return getBaseGravityModifier() * (float)((LivingEntity)master).getAttributeValue(PlayerAttributes.ENTITY_GRAVTY_MODIFIER); }