#ISS priest on death turns into a Necromancer

26 messages · Page 1 of 1 (latest)

glossy saffron
#

I want to make Priests turn into necromancers after they have been killed by an undead mob. Any help is greatly appricieated.

    let entity = event.level.createEntity('irons_spellbooks:necromancer')
    entity.setPos(event.entity.pos)
    entity.spawn()
})```
stray jettyBOT
#

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

wet palm
# glossy saffron I want to make Priests turn into necromancers after they have been killed by an ...

try this

const $ResourceKey = Java.loadClass("net.minecraft.resources.ResourceKey")
const $TagKey = Java.loadClass("net.minecraft.tags.TagKey")
const $EntityType = $ResourceKey.createRegistryKey("entity_type")
const IS_UNDEAD = $TagKey.create($EntityType, "minecraft:undead")
ServerEvents.tags("entity_type", event=>{
    const zombies = [
        "minecraft:drowned",
        "minecraft:husk",
        "minecraft:zoglin",
        "minecraft:zombie",
        "minecraft:zombie_horse",
        "minecraft:zombie_villager",
        "minecraft:zombified_piglin"
    ]
    const undead = [
        "#minecraft:skeletons",
        "#minecraft:zombies",
        "minecraft:phantom",
        "minecraft:wither"
    ]

    event.add("minecraft:zombies", zombies)
    event.add("minecraft:undead", undead)
})
EntityEvents.death('irons_spellbooks:priest', event => {
    let {source:{actual}, entity:{pos}, level} = event
    if(!actual) return;
    if(!actual.entityType.is(IS_UNDEAD)) return;
    let necromancer = level.createEntity('irons_spellbooks:necromancer')
    necromancer.setPos(pos)
    necromancer.spawn()
})
glossy saffron
#

that didn't work unfortunately

tacit ravineBOT
#

Paste version of message.txt from @glossy saffron

wet palm
#

and you should send server.log

tacit ravineBOT
#

Please send your KubeJS server log. It can be found at /minecraft/logs/kubejs/server.log.
If you are on 1.18 or 1.16 it will be called server.txt.
Please send the file directly, without links or snippets.

glossy saffron
glossy saffron
tacit ravineBOT
#

Paste version of server.log from @glossy saffron

wet palm
#

looks more like a result of /kjs reload server_scripts?

#

try rejoining the world

glossy saffron
wet palm
glossy saffron
#

nothing has worked so far

tacit ravineBOT
#

Paste version of server.log from @glossy saffron

wet palm
#

alright. I assumed your code worked so I just did some modification to add the undead filter

glossy saffron
#

no my bad I should have said something earlier

wet palm
#

Unfortunately I am going to have a meeting and some other stuffs. I'd work on this when I get back serveral hours later.

glossy saffron
#

ok

wet palm
# glossy saffron ok

I am away from my computer, but I just found some old threads with createEntity. I think you can try .setPosition instead of .setPos

glossy saffron
#

that worked

wet palm
#

Glad to hear that. If everything's fine now, please remember to close the ticket