I'm trying to make NPCs seem like they're sleeping in bed, but I have some problems with a bed's direction.
See, the locationtag.direction does not work on beds. It's always south. To get the direction, I need to use locationtag.material.direction, which will return NORTH, EAST, SOUTH, or WEST. Now... annoyingly enough, these directions don't work like direction.vector... you can't apply .vector to this (it just gives an error).
So, does anyone know how to get the vector from a bed's direction, so that I can face the NPC away from the bed?
#(JustinS) Bed direction to vector
20 messages · Page 1 of 1 (latest)
(JustinS) Bed direction to vector
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
Currently using <map[north=<location[0,0,-1]>;east=<location[1,0,0]>;south=<location[0,0,1]>;west=<location[-1,0,0]>].get[<player.cursor_on.material.direction.to_lowercase>]> but this is so extremely cursed, please let me know if there's a better way
i mean nothin wrong with that
although direction to vector as a helper tag wouldn't hurt I suppose
I guess this would be a feature request then? Very very simple pr I think
Changed to Feature
Thread is now a Feature thread. This indicates a request for a new feature to the plugin, that both (A) does not already exist and (B) reasonably can be added. If you are unsure whether this applies, use </helpthread:1028674284870180883> to change back to a normal help thread.
!tag LocationTag.direction
Returns the compass direction between two locations.
If no second location is specified, returns the direction of the location.
Example returns include "north", "southwest", ...
Group
math
Returns
ElementTag
!tag Materialtag.direction
Returns the current facing direction for a directional material (like a door or a bed).
This includes materials that Spigot classifies as "directional", "orientable", or "rotatable", as well as rails, dripstone, and jigsaw blocks.
Output is a direction name like "NORTH", or an axis like "X", or a rail direction like "ASCENDING_NORTH".
Group
properties
Returns
ElementTag
Mechanism
MaterialTag.direction
See, the locationtag.direction does not work on beds. It's always south
this only will returnsouthbecause you're using the location without a proper yaw in the locationtag
a player's location has yaw, the location a material is at does not typically have a yaw or pitch to reference (it defaults to zero)
south is Z+, which is also yaw: 0
you want the bed's location's material's direction
I need to use
locationtag.material.direction, which will return NORTH, EAST, SOUTH, or WEST. Now... annoyingly enough, these directions don't work likedirection.vector... you can't apply.vectorto this (it just gives an error).
oh i see
<map[north=<location[0,0,-1]>;east=<location[1,0,0]>;south=<location[0,0,1]>;west=<location[-1,0,0]>] is a bit rough, you could alternatively for the moment have a data key on your script or a data script container to reference?
my_script:
data:
directions:
north: 0,0,-1
east: 1,0,0
south: 0,0,1
west: -1,0,0
this would let you do any of:
<script.data_key[data.directions.<[direction]>]><script[my_script].data_key[data.directions.<[direction]>]>- and:
- define directions <script[my_script].data_key[data.directions]>`
- define vector <[directions].get[<[direction]>]>