Posted December 15, 20213 yr It's a short line I am having an issue with: List<LivingEntity> entities = player.getLevel().getNearbyEntities(LivingEntity.class, player.getBoundingBox().inflate(5,0,5), LivingEntity::isAlive); On the LivingEntity::isAlive part where it says "is not a functional interface" Any suggestions?
December 15, 20213 yr Author 3 hours ago, Luis_ST said: you need a EntityPredicate and not a Function How can I do that?
December 15, 20213 yr Author 7 hours ago, diesieben07 said: Incorrect. Look at the parameters of getNearbyEntities. There is no predicate parameter. You can pass one indirectly using the TargetingConditions parameter. I'm still a bit lost, here is a picture just in case: https://imgur.com/a/50EZf6l
December 15, 20213 yr Author 9 minutes ago, diesieben07 said: I am deeply sorry and apologize, my java knowledge isn't the best but sometimes simple stuff like these confuse me but can do other complex stuff, I've put this and pretty sure this is wrong as well, could you maybe please show me the correct way List<LivingEntity> entities = player.getLevel().getNearbyEntities(LivingEntity.class, TargetingConditions.DEFAULT, player.getBoundingBox().inflate(5,0,5), LivingEntity::isAlive);
December 15, 20213 yr 7 hours ago, diesieben07 said: Incorrect. Look at the parameters of getNearbyEntities. There is no predicate parameter. it was the 1.16.5 name for TargetingConditions 16 minutes ago, Feroov said: I'm still a bit lost, here is a picture just in case: I'm not sure which method you use, since there is only one method in Level with the name getNearbyEntities and it requires 4 parameters: getNearbyEntities(Class<T>, TargetingConditions, LivingEntity, AABB) and not getNearbyEntities(Class<T>, AABB, TargetingConditions)
December 15, 20213 yr Author 7 minutes ago, Luis_ST said: it was the 1.16.5 name for TargetingConditions I'm not sure which method you use, since there is only one method in Level with the name getNearbyEntities and it requires 4 parameters: getNearbyEntities(Class<T>, TargetingConditions, LivingEntity, AABB) and not getNearbyEntities(Class<T>, AABB, TargetingConditions) Yes it worked now, thank you so so much for all who helped appreciate it
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.