mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Reduce the chances of there being a NPE here
This commit is contained in:
parent
c2a959f031
commit
42670af93b
1 changed files with 4 additions and 4 deletions
|
@ -146,16 +146,16 @@ public class EntityPhysics<T extends Owned<? extends Entity>> 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue