mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +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 (master instanceof LivingEntity) {
|
||||||
if (((LivingEntity)master).isSleeping()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((LivingEntity)master).getAttributes() == null) {
|
if (((LivingEntity)master).getAttributes() == null) {
|
||||||
// may be null due to order of execution in the constructor.
|
// 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.
|
// Will have the default (1) here in any case, so it's safe to ignore the attribute at this point.
|
||||||
return getBaseGravityModifier();
|
return getBaseGravityModifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (((LivingEntity)master).isSleeping()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return getBaseGravityModifier() * (float)((LivingEntity)master).getAttributeValue(PlayerAttributes.ENTITY_GRAVTY_MODIFIER);
|
return getBaseGravityModifier() * (float)((LivingEntity)master).getAttributeValue(PlayerAttributes.ENTITY_GRAVTY_MODIFIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue