IFacing
Link to ifacing
The IFacing Interface allows you to get an IBlockPos's possible directions.
Importing the package
Link to importing-the-package
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;
Enumerations
Link to enumerations
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 Copycrafttweaker.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 without parameters
Link to zengetterszenmethods-without-parameters
ZenGetter | ZenMethod | Return Type |
---|---|---|
ZenGetter name | ZenMethod getName() | Return Type string |
ZenGetter rotateY | ZenMethod rotateY() | Return Type IFacing |
ZenGetter opposite | ZenMethod opposite() | Return Type IFacing |
Other methods
Link to other-methods
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.