#how to use spawnEntity?

1 messages · Page 1 of 1 (latest)

wispy cobalt
#

I have error
const cow = player.spawnEntity("minecraft:cow",{x: 0, y: 0, z: 0 });

wispy cobalt
#
import {world} from '@minecraft/server';

world.afterEvents.blockBreak.subscribe((event) => {
    const overworld = world.getDimension("overworld");
    const player = event.player;
    const block = event.brokenBlockPermutation.type.id;
    const cow = player.dimension.spawnEntity("minecraft:cow",{x: 0, y: 0, z: 0 });
    player.runCommand(`say ${block}`)
});
#

New error:/

small quest
#

0 0 0 is not a loaded chunk

#

You either go to 0 0 0 to spawn it

#

Or add a ticking area

#

Where you will spawn the entity

#

Before you actually spawn it

#

Then you remove it after it spawns