As
@Lego_freak1999 Said. Skript has a built in aliases system which can also define the rotation/data value of a block if it has multiple data values. It changes the data value of any block and what that changes varies on the block/material. You can fix what numbers change to what data value of the block it in your aliases if needed. This automatically works for every block/material no matter if it has a data value. You just have to play around with aliases to get what you want.
For default aliases this should work:
code_language.skript:
set block at {Game.Position::BANNER} to wall banner:1 #north
set block at {Game.Position::BANNER} to wall banner:3 #south
set block at {Game.Position::BANNER} to wall banner:4 #west
set block at {Game.Position::BANNER} to wall banner:5 #east
Don't ask why it skips the number 2. It's Skript lol. More like Skipt am I right? lol
quality pun.
And if you want to calculate stuff live, I have also made a function to make this easier on a user.
code_language.skript:
function getDirectionalBlock(i: item, d: direction) :: item:
set {_block::north} to 1
set {_block::south} to 3
set {_block::west} to 4
set {_block::east} to 5
return "%{_i}%:%{_block::%{_d}%}%" parsed as item
Example:
code_language.skript:
set block at {Game.Position::BANNER} to getDirectionalBlock(wall banner, west)
I have also made a function to get the opposing direction of a direction
code_language.skript:
function getOppositeDirection(d: direction) :: direction:
set {_s} to "%{_d}%"
loop {_s} split at "and":
if {_direction} is not set:
set {_direction} to "%numbers in loop-value%" parsed as number
set {_final} to loop-value
else if "%the numbers in loop-value%" parsed as number > {_direction}:
set {_direction} to "%numbers in loop-value%" parsed as number
set {_final} to loop-value
if {_final} contains "north":
return north
else if {_final} contains "east":
return east
else if {_final} contains "south":
return south
else if {_final} contains "west":
return west
Example:
code_language.skript:
set block at {Game.Position::BANNER} to getDirectionalBlock(wall banner, getOppositeDirection(facing of player))
This function above needs Skellett and if you want better directional I suggest using SkQuery for the "direction from" expression.
Example using SkQuery:
This example will make it so the chest block will always look at a player
code_language.skript:
function getOppositeDirection(d: direction) :: direction:
set {_s} to "%{_d}%"
loop {_s} split at "and":
if {_direction} is not set:
set {_direction} to "%numbers in loop-value%" parsed as number
set {_final} to loop-value
else if "%the numbers in loop-value%" parsed as number > {_direction}:
set {_direction} to "%numbers in loop-value%" parsed as number
set {_final} to loop-value
if {_final} contains "north":
return north
else if {_final} contains "east":
return east
else if {_final} contains "south":
return south
else if {_final} contains "west":
return west
function getDirectionalBlock(i: item, d: direction) :: item:
set {_block::north} to 1
set {_block::south} to 3
set {_block::west} to 4
set {_block::east} to 5
return "%{_i}%:%{_block::%{_d}%}%" parsed as item
command /lookatme:
trigger:
set {_direction} to direction from target block to player
set {_opposite} to getOppositeDirection({_direction})
set {_block} to getDirectionalBlock(chest, {_opposite})
set target block to {_block}
A banner block does have up to 8 different directional positions (Not the wall banner though) so you will have to play around with that, as my function doesn't support 8 dimensional sides.