facing method

Execute facing(
  1. dynamic target, {
  2. Facing facing = Facing.eyes,
})

Sets the execution rotation so that it faces a location or an entity's feet or eyes. Example:

Execute.facing(
	Entity.player(), // or Location...
	facing: Facing.feet // optional
	children: List<Widget> [
		Command('/say I get executed')
	]
)
⇒ execute facing entity @p feet run say I get executed

Implementation

Execute facing(dynamic target, {Facing facing = Facing.eyes}) {
  if (target is Location) {
    return _addArgumentRet('facing $target');
  }
  if (target is Entity) {
    return _addArgumentRet('facing entity $target ${facing.name}');
  }
  throw ('Please insert either a Location or an Entity into Execute.facing');
}