Here are four command suggestions, changed to be distinct from each other and reasonably simple to implement.
The commands are specialized towards the view-direction and field-of-view of entities.
/raycast <distance> <accuracy> <chained command>
Given the current entity @s
, shoot a ray out of its eyes, with the given accuracy
, and execute the chained command
at the position of whatever was hit (block or entity). If no block or entity has been hit, or we reached the maximum distance
, return a result of 0
.
-
The
accuracy
argument is a value between0
(ray goes anywhere within the FoV) and1
(maximum accuracy). -
Optional: A
face
argument that can be one offorward
,backward
,left
,right
,up
ordown
, that changes in which direction the ray is fired, instead of always firing out of the entities eyes. -
Optional: Add a parameter to specify the amount of rays to be shot.
/raymarch <face> <distance> [skip_air] <chained command>
Given the current entity @s
, march along a ray out of its eyes and execute the chained command
for every block that it passes, using @s
with a different position, until it hits the distance
limit. It returns the number of blocks it executed the command at.
-
The
skip_air
argument makes the command skip air blocks. -
Optional: A
face
argument that can be one offorward
,backward
,left
,right
,up
ordown
, that changes in which direction the ray is fired, instead of always firing out of the entities eyes.
/raytrace <entity> <chained command>
Given the current entity @s
, trace a ray from its head, to every selected entity
, and execute the chained command
at its position, but only if the ray does not hit any blocks. Returns the count of successfull traces.
A command that tests if some entity is in the Field-Of-View of another entity.
The are two possible versions of this command.
Version A: /in_fov <entity> <chained command>
With this version, the chained command will only be executed if the selected entity
is within the Field-Of-View of the @s
.
Version B: /in_fov <entity>
With this version, the command will return a value of 1
if the selected entity is within the Field-Of-View of the @s
entity, and 0
if not. If @s
does not have a FoV, return 0.
Tell me what you think!
Final Note: These commands are not particularly hard to implement, with most of the groundwork already being in place (judging from the MCP-decompiled Minecraft code). The biggest problem is getting free time to add them (that is: implementing, documenting, unit testing(?) and bug fixing).