Stevertus / mcscript

A programming language for Minecraft Vanilla
https://mcscript.stevertus.com
MIT License
236 stars 17 forks source link

a way of getting the target of parent entity from the child entity #49

Open jLn0n opened 9 months ago

jLn0n commented 9 months ago

currently, im struggling doing this:

asat(@a) {
    var slimeKilled @s = 0

    if ('entity @s[nbt={SelectedItem:{id:"minecraft:stick",Count:1b}}]') {
        raycast(10, "air", entity @e[type=slime]) {
            /kill @s
            slimeKilled @s = 1 // @s points to the raycasted entity instead of parent entity (player)
        }
        if (slimeKilled @s == 1) {
            /say Oops, you killed a slime (accedentally).
            slimeKilled @s = 0
        }
    }
}

is there a way of getting the player?