KubeJS (Old)

KubeJS (Old)

3M Downloads

About server.getEntities()

blacksheep-lzx opened this issue ยท 0 comments

commented

Minecraft Version

1.18.2

KubeJS Version

1802.5.5-build.550

Rhino Version

1802.2.1-build.240

Architectury Version

4.9.84

Forge/Fabric Version

Fabric 0.14.10

Describe your issue

Code:

onEvent("item.right_click", (event) => {
if (event.item == 'minecraft:ghast_tear')
{
entity = event.server.getEntities("@e[type=minecraft:item]").forEach(entity => {
if (entity.item == "minecraft:sand")
{
entity.kill()
event.server.runCommandSilent(say mark!)
}
})
}
})

description:

When I throw a sand, right-click Ghast Tear to trigger the event, the command '/say mark!' execute three times.
Only one sand, As expected, it should only be executed once,

Crash report/logs

No response