396: Is player looking at an entity. Updated for 1.21. [Minecraft Map Making]

Subscribers:
3,590
Published on ● Video Link: https://www.youtube.com/watch?v=KaggjVf0mpA



Minecraft
Game:
Minecraft (2011)
Duration: 0:00
278 views
13


Membership:    / @infernaldevice  
Ep396: Using predicates to check if the player is looking at an entity.

00:00 Intro
03:05 Predicate - sheep
04:30 Predicate - tagged entity
05:40 Predicate - tagged player
06:05 Predicate - any entity
06:25 Predicate - inverted tagged entity
08:10 Using the predicates
14:20 Combining - entity without tag
16:50 Waffling

Version: 1.21

1.19 Version - Episode 92:    • 92: Detect player looking at entity [...  

Requested by: purple_the_guy_who_makes_g

Commands, builds, hacks and ideas for people making their own Minecraft maps.

Check out my collabs on Coppit's channel:    / coppitj  

Join the CoppitCraft server that I play on and the Discord where I hang out.
Server IP: 51.81.246.145:25588
Discord:   / discord  

The following commands are prefixed with three letters which represent the settings of the command block. E.g IUN: = Impulse Unconditional Needs_Redstone. These prefixes need to be removed if copying the commands.

Since angled brackets are not allowed in YouTube descriptions you will have to replace "greater than" and "less than" with the appropriate angled bracket.

Commands used:

Controller - sheep:
RUA: execute as @a if predicate {"condition":"minecraft:entity_properties","entity":"this","predicate":{"type_specific":{"type":"minecraft:player","looking_at":{"type":"minecraft:sheep"}}}} run say hi

Controller - tagged entity:
RUA: execute as @a if predicate {"condition":"minecraft:entity_properties","entity":"this","predicate":{"type_specific":{"type":"minecraft:player","looking_at":{"nbt":"{Tags:[\"target\"]}"}}}} run say hi

Controller - tagged player:
RUA: execute as @a if predicate {"condition":"minecraft:entity_properties","entity":"this","predicate":{"type_specific":{"type":"minecraft:player","looking_at":{"type":"minecraft:player","nbt":"{Tags:[\"target\"]}"}}}} run say hi

Controller - any entity:
RUA: execute as @a if predicate {"condition":"minecraft:entity_properties","entity":"this","predicate":{"type_specific":{"type":"minecraft:player","looking_at":{}}}} run say Looking at any entity.

Controller - entity without tag:
RUA: execute as @a if predicate [{"condition":"minecraft:entity_properties","entity":"this","predicate":{"type_specific":{"type":"minecraft:player","looking_at":{}}}}, {"condition":"minecraft:inverted","term":{"condition":"minecraft:entity_properties","entity":"this","predicate":{"type_specific":{"type":"minecraft:player","looking_at":{"nbt":"{Tags:[\"target\"]}"}}}}}] run say Looking at entity without the tag.







Other Statistics

Minecraft Statistics For Infernal Device

At present, Infernal Device has 181,722 views spread across 860 videos for Minecraft, accounting for over 10 days of watchable video on his channel. This is 94.82% of the total watchable video for Minecraft on Infernal Device's YouTube channel.