A Position in Minecraft consists of 3 values: x, y and z.
A Position3f Object stores a position using those three values.

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import crafttweaker.util.Position3f;

Getting a Position3f object

Link to getting-a-position3f-object

You can get such an object using:

  • The position ZenGetter on a IPlayer object
  • The Position3f constructor below
  • The IBlockPos Position3f caster.

Position3f constructor

Link to position3f-constructor

You can create a Position3f object yourself by using the following method:

ZenScript
Copy
crafttweaker.util.Position3f.create(float x, float y, float z);

The First method allows you to create a position at the given coordinates.

ZenGetters and ZenSetters

Link to zengetters-and-zensetters

ZenGetterZenSetter描述
ZenGetter
x
ZenSetter
x
描述
Returns the position's x value
ZenGetter
y
ZenSetter
y
描述
Returns the position's y value
ZenGetter
z
ZenSetter
z
描述
Returns the position's z value

Casting as IBlockPos

Link to casting-as-iblockpos

You can use the two ways below to cast a Position3f Object to an IBlockPos Object: Remember, for casting you need to import the type you want to cast to unless you use the full name.

ZenScript
Copy
posThree.asBlockPos();
posThree as IBlockPos;