#One-Entity Selective getEntitiesWithin
18 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
(Im most probably incorrect, sorry im a newbie in here) So .filter(ent => ent.isPlayer())[0]?
let entities = level.getEntitiesWithin(AABB.of(player.x - area, player.y - 1.5, player.z - area, player.x + area, player.y + 1.5, player.z + area)).filter(ent => ent.isPlayer())
I got this example from a previous post
So how would the filter part be?
entities[0]
let entities[0] = level.getEntitiesWithin(AABB.of(player.x - area, player.y - 1.5, player.z - area, player.x + area, player.y + 1.5, player.z + area)).filter(ent => ent.isPlayer())
And it basically picks the first entity that appears when checking the area, right?
let entity = level.getEntitiesWithin(blah blah).filter(ent => ent.isPlayer)[0]
or save the list to a variable then use what lexxie said
dont combine them
yes, tho first is pretty random. dont expect the closest or anything. just one of them
I was actually wondering about that. If it picked randomly or by distance. Thanks for the response!
I will close the ticket later when i test it. Im not at my pc at the moment
Anyways, thanks for the help!