Fixed black holes not affecting items

This commit is contained in:
Sollace 2023-09-03 21:01:51 +01:00
parent 2ec17ae9aa
commit 9f791b9692
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
4 changed files with 5 additions and 4 deletions

View file

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

View file

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

View file

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

View file

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