#How can I get the entities within N blocks of a position?

10 messages · Page 1 of 1 (latest)

meager sleet
#

BlockContainerJS has a method playersInRadius, but not entitiesInRadius

echo fractalBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

quick nebula
#

if you have access to the Level you can use
level.getEntitiesOfClass(Class<T> clazz, AABB area, Predicate filter)

#

using the AABB to check a square around your position and then the predicate to check the distance

meager sleet
lucid folio
#

This might help you

tacit sonnetBOT
#

[Quote ➤](#archived-example-scripts message) Inworld Crafting 9000™️ by @lucid folio :nkoGiggle:

Allows for inworld crafting by throwing items on a block, the detection radius is 1.5blocks from the center of the block.
Once you have the recipe ingredients added, right-click the block with the Recipe Activation Item, and it will give you the output.
Will return any items that are not used in recipes, so you will not accidentally lose anything.
The third image will show the range of the crafting surface.

Crafting with NBT might be a bit wonky, that is still work in progress, use with caution.

Any fixes/updates/changes will be added and pinned in the thread

median kernel
#

AABB.of(1,2,3,4,5,6)

#

i believe LevelJS has a getEntitiesWithin method

#

or, if you want a circular radius, use LevelJS#getEntities that takes an entity filter and use the distance thingy from that