Hello !
I have been trying to make a "simple" item that, when used :
Finds the nearest player in a range
Sends a snowball in its direction if a player was found
Sends a message in chat if no player was found in range
I achieved some sort of success by using this :
List<Entity> entities = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getBoundingBox().expand(50000.0D, 50000.0D, 50000.0D));
Then, I iterated through the list using instanceof like the bad encapsulator I am. Little I knew that it would make the game freeze a few seeconds each time I used the item AND would have a ridiculously low range.
I tried using a lot of other stuff, but no luck, so I'm asking you Forge experts :)
Thanks for reading me,
alternis