Skip to content

Entity creation duplicates entities - 1.18.1 #261

Description

@TheQKnight

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.18This issue applies to Minecraft 1.18.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions