#resolved

1 messages · Page 1 of 1 (latest)

primal sky
#

You can do it using scripting

#

?scriptapi

soft juniper
primal sky
soft juniper
primal sky
# soft juniper can you give me a exemple of what it would look like?
import * as mc from '@minecraft/server'

mc.world.afterEvents.entityDie.subscribe(data => {
    if (data.deadEntity.typeId == "minecraft:pig"){
        mc.world.sendMessage("Pig has been slain");
    }
})

Not sure this will work cuz haven't tested it
But if it works it will print "Pig has been slain" in chat every time a pig was killed (no matter what was the source of damage)

You can specify the source using data.damageSource.typeId

primal sky
soft juniper
primal sky
#

Yes you can add it to your addon, just mention the dependencies in your manifest and create the main.js file in /scripta

soft juniper
#

like that?

primal sky
soft juniper
#

thanks

primal sky