The IFacing Interface allows you to get an IBlockPos's possible directions.

It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
import crafttweaker.world.IFacing;

The Facing interface has 6 static methods that return the said direction.
It also has one more that takes the direction as String input (e.g. "NORTH")

ZenScript
Copy
crafttweaker.world.IFacing.north()
crafttweaker.world.IFacing.east()
crafttweaker.world.IFacing.south()
crafttweaker.world.IFacing.west()
crafttweaker.world.IFacing.down()
crafttweaker.world.IFacing.up()


crafttweaker.world.IFacing.fromString(String name);

不带参数的 ZenGetters/ZenMethods

Link to 不带参数的-zengetterszenmethods

ZenGetterZenMethod返回值类型
ZenGetter
name(名称)
ZenMethod
getName()
返回值类型
string
ZenGetter
rotateY
ZenMethod
rotateY()
返回值类型
IFacing
ZenGetter
opposite
ZenMethod
opposite()
返回值类型
IFacing

Comparing two Facings

Link to comparing-two-facings

You can compare two facings using the standart comparing Operators == != < > <= >= Alternatively, you can use the function, though the function returns an int that is 0 if they are equal.

ZenScript
Copy
//Returns true or false
facingOne == facingTwo;

//Returns 0 if they are equal
facingOne.compare(facingTwo);

Getting from Entities

Link to getting-from-entities

IFacing.getDirectionFromEntityLiving(IBlockPos pos, IEntityLivingBase placer);

The static method returns an IFacing from IEntityLivingBase. The method is often used to determine the facing of some blocks when placed by players, like piston, observer, command block, etc. Unlike the horizontalFacing getter of IEntity, the method can return UP and DOWN. And it always returns the opposite value of the getter.