I have a script set up as follows:
onEvent('block.right_click', (event) => {
if (event.level.dimension !== 'minecraft:overworld') return
var zombie = event.block.createEntity('minecraft:zombie')
zombie.tags.add('special_zombie')
zombie.spawn()
var entities = event.server.getEntities(`@e[type=zombie,tag=special_zombie]`)
console.log(entities.length)
})
So basically, this should run once when you click a block, spawning a zombie, then the console.log should print 1 since only one zombie spawned with the tag, but this does not happen. Instead 2 zombies spawn, then the console will log 3 and 6 consecutively.
I have a script set up as follows:
So basically, this should run once when you click a block, spawning a zombie, then the console.log should print 1 since only one zombie spawned with the tag, but this does not happen. Instead 2 zombies spawn, then the console will log 3 and 6 consecutively.