Posted April 24, 20196 yr Hi! I have a throwing entity that get the closest player where it landed. The problem is that i want it to ignore itself (this.getThrower), and itself I guess it's more a Java problem than a Forge one but i don't understand how i can do it, so here's what i did (And it's not working because it's ticking itself (the throwing entity)) EntityPlayer thrower = (EntityPlayer) this.getThrower(); Predicate isThrower = Predicate.isEqual(thrower); EntityPlayer nearplayer = world.getClosestPlayer(wherehit.getX(), wherehit.getY(), wherehit.getZ(), 25, (com.google.common.base.Predicate<Entity>) isThrower.negate());
April 24, 20196 yr Predicate is just a functional interface that takes a given argument and returns true or false. You can learn more about finctional interfaces and lambdas here So in your case something like e -> e != thrower && e != this would work just fine. Also don't bump, this is not a chat room. Your post is within the top 10 recent posts, there is no reason to bump it.
April 24, 20196 yr Author 2 minutes ago, V0idWa1k3r said: Predicate is just a functional interface that takes a given argument and returns true or false. You can learn more about finctional interfaces and lambdas here So in your case something like e -> e != thrower && e != this would work just fine. Also don't bump, this is not a chat room. Your post is within the top 10 recent posts, there is no reason to bump it. Thanks dude im gonna try that (And sorry for the useless bump)
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.