#Looking for a useful method

27 messages · Page 1 of 1 (latest)

wind gyro
#

what was the method that returned a list of all entities where you can give it a string for a filter like ingame with the @e[whatever] to get a list of mobs with certain conditions

arctic totemBOT
#

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

warm stratus
#

iirc that doesn't exist anymore

#

use level.getEntities().filter()

#

the only method similar to what you're thinking of requires an AABB

warm stratus
wind gyro
warm stratus
#

kubejs

wind gyro
#

but then why was it removed ._.

warm stratus
#

not sure

wind gyro
#

who do i yell at

#

it was very useful

warm stratus
#

last time i remember that existing was in 1.18.2

wind gyro
#

this approach will comparatively tank performance....

warm stratus
#

not necessarily

#

if it was called on server and not level then that's a different story

#

but usually filtering through entities (even on level tick) shouldn't cause any performance drops

wind gyro
#

it would be level

#

hm

warm stratus
#

you could try this if you really want at most microscopic changes in performance

let entities = level.getAllEntities().iterator()
while (entities.hasNext()) {
    let entity = entities.next()
    // code
}
wind gyro
#

my concern for performance was just the iteration itself, going through all the mobs and checking xyz data about them

warm stratus
#

i do that a lot in my own code and it didn't make it any slower

#

minecraft itself even does it

wind gyro
#

i see i see

#

i'll stick with that then