KubeJS (Old)

KubeJS (Old)

3M Downloads

Getting entities in a world by filter returns empty list

mathgeniuszach opened this issue ยท 0 comments

commented

Consider the script:

onEvent("block.place", event => {
    console.info(event.server.getWorld("minecraft:the_end").getEntities('@e').size())
})

This should print the number of loaded entities in the end dimension. However, this actually prints 0 when the dimension is loaded.
I believe the issue is with ServerWorldJS.java#L96, where

return createEntityList(new EntitySelectorParser(new StringReader(filter), true).getSelector().findEntities(new WorldCommandSender(this)));

should probably be

return createEntityList(new EntitySelectorParser(new StringReader(filter), true).parse().findEntities(new WorldCommandSender(this)));

Replacing this line of code fixes the issue for me, though there could be a better solution.