Fixed Living.getOrEmpty and fixed the amulet crashing

This commit is contained in:
Sollace 2022-12-09 22:16:54 +00:00
parent 65cf691242
commit 8a88596c67
2 changed files with 7 additions and 3 deletions

View file

@ -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) {

View file

@ -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;
}