mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 03:26:44 +01:00
Fixed Living.getOrEmpty and fixed the amulet crashing
This commit is contained in:
parent
65cf691242
commit
8a88596c67
2 changed files with 7 additions and 3 deletions
|
@ -273,12 +273,12 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
updateVelocity(entity);
|
||||
}
|
||||
|
||||
public static Optional<Living<?>> getOrEmpty(LivingEntity entity) {
|
||||
return PonyContainer.of(entity).map(a -> a instanceof Living ? (Living<?>)a.get() : null);
|
||||
public static Optional<Living<?>> getOrEmpty(Entity entity) {
|
||||
return PonyContainer.of(entity).map(PonyContainer::get).map(a -> a instanceof Living ? (Living<?>)a : null);
|
||||
}
|
||||
|
||||
public static Living<?> living(Entity entity) {
|
||||
return entity instanceof LivingEntity ? getOrEmpty((LivingEntity)entity).orElse(null) : null;
|
||||
return getOrEmpty(entity).orElse(null);
|
||||
}
|
||||
|
||||
public static void updateVelocity(Entity entity) {
|
||||
|
|
|
@ -150,6 +150,10 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
|||
|
||||
Living<?> living = Living.living(entity);
|
||||
|
||||
if (living == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!living.getArmour().contains(this)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue