#createEntity on the player

4 messages · Page 1 of 1 (latest)

peak flame
#

Hi!
Trying to create an event that spawns lightning on top of the player when consumed.
The code spawns lightning just fine but I do not know how to get it to target the player.

Current xyz values are just from testing

ItemEvents.foodEaten(event => {
    if (['kubejs.fastwater_bottle'].includes(event.item.id)) return
    let lightning = event.level.createEntity('lightning_bolt')
    lightning.x += -1327
    lightning.y += 152
    lightning.z += -437
    lightning.spawn()
})

much thanks!

graceful coralBOT
#

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

misty shore
#

lightning.x = event.player.x?

peak flame
#

GAH thank you so much. brain is fried from digging through wikis. many thanks!