mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed black holes not affecting items
This commit is contained in:
parent
2ec17ae9aa
commit
9f791b9692
4 changed files with 5 additions and 4 deletions
|
@ -30,8 +30,9 @@ public interface EquinePredicates {
|
|||
Predicate<Entity> IS_CASTER = e -> !e.isRemoved() && (e instanceof Caster || IS_PLAYER.test(e));
|
||||
Predicate<Entity> IS_PLACED_SPELL = e -> e instanceof Caster && !e.isRemoved();
|
||||
|
||||
Predicate<Entity> IS_MAGIC_IMMUNE = EntityPredicates.VALID_LIVING_ENTITY.negate().or(e -> e instanceof MagicImmune);
|
||||
Predicate<Entity> IS_MAGIC_IMMUNE = e -> (e instanceof MagicImmune || !(e instanceof LivingEntity)) && !(e instanceof ItemEntity);
|
||||
Predicate<Entity> EXCEPT_MAGIC_IMMUNE = IS_MAGIC_IMMUNE.negate();
|
||||
Predicate<Entity> VALID_LIVING_AND_NOT_MAGIC_IMMUNE = EntityPredicates.VALID_LIVING_ENTITY.and(EXCEPT_MAGIC_IMMUNE);
|
||||
|
||||
Predicate<LivingEntity> HAS_WANT_IT_NEED_IT = e -> {
|
||||
return EnchantmentHelper.getEquipmentLevel(UEnchantments.WANT_IT_NEED_IT, e) > 0
|
||||
|
|
|
@ -49,7 +49,7 @@ public class CarryAbility implements Ability<Hit> {
|
|||
|
||||
protected LivingEntity findRider(PlayerEntity player, World w) {
|
||||
return TraceHelper.<LivingEntity>findEntity(player, 10, 1, hit -> {
|
||||
return EquinePredicates.EXCEPT_MAGIC_IMMUNE.test(hit) && !player.isConnectedThroughVehicle(hit);
|
||||
return EquinePredicates.VALID_LIVING_AND_NOT_MAGIC_IMMUNE.test(hit) && !player.isConnectedThroughVehicle(hit);
|
||||
}).orElse(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public class UnicornCastingAbility extends AbstractSpellCastingAbility {
|
|||
} else {
|
||||
player.setAnimation(Animation.ARMS_UP, Animation.Recipient.HUMAN);
|
||||
if (s instanceof HomingSpell homer) {
|
||||
TraceHelper.findEntity(player.asEntity(), homer.getRange(player), 1, EquinePredicates.EXCEPT_MAGIC_IMMUNE).ifPresent(homer::setTarget);
|
||||
TraceHelper.findEntity(player.asEntity(), homer.getRange(player), 1, EquinePredicates.VALID_LIVING_AND_NOT_MAGIC_IMMUNE).ifPresent(homer::setTarget);
|
||||
}
|
||||
player.playSound(USounds.SPELL_CAST_SUCCESS, 0.05F, 2.2F);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class UnicornProjectileAbility extends AbstractSpellCastingAbility {
|
|||
projectile.setHydrophobic();
|
||||
|
||||
if (spell instanceof HomingSpell homer) {
|
||||
TraceHelper.findEntity(player.asEntity(), homer.getRange(player), 1, EquinePredicates.EXCEPT_MAGIC_IMMUNE).filter(((HomingSpell)spell)::setTarget).ifPresent(projectile::setHomingTarget);
|
||||
TraceHelper.findEntity(player.asEntity(), homer.getRange(player), 1, EquinePredicates.VALID_LIVING_AND_NOT_MAGIC_IMMUNE).filter(((HomingSpell)spell)::setTarget).ifPresent(projectile::setHomingTarget);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue