IFacing
Link to ifacing
The IFacing Interface allows you to get an IBlockPos's possible directions.
パッケージのインポート
Link to パッケージのインポート
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 | 戻り値 |
---|---|---|
ZenGetter name | ZenMethod getName() | 戻り値 string |
ZenGetter rotateY | ZenMethod rotateY() | 戻り値 IFacing |
ZenGetter opposite | ZenMethod opposite() | 戻り値 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.