mcscript icon indicating copy to clipboard operation
mcscript copied to clipboard

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

Open jLn0n opened this issue 2 years ago • 0 comments

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?

jLn0n avatar Dec 31 '23 09:12 jLn0n