#Is it possible to require a certain weapon to kill an entity?

11 messages · Page 1 of 1 (latest)

cursive mural
#

If I wanted to require that the killing blow on the ender dragon be from an Iron Sword would that be possible to do with Kubejs?

fair willowBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

latent sable
#

I think its only possible with drops

#

in loot tables I think you can specify required tool/weapon

#

so you could have the dragon drop some custom item

#

actually I think I misunderstood your question

#

you want to prevent damage to dragon from other item than your sword?

#
EntityEvents.hurt('minecraft:ender_dragon', event => {
  if(event.source.actual && event.source.actual.player && event.source.actual.mainHandItem.id !== 'minecraft:diamond_sword') {
    event.cancel();
  }
})
#

something like this maybe

hot mango
#

maybe listen to death instead of hurt

latent sable
#

Good point. Not sure if cancelling death works in every case, especially complicated entity like dragon tho