Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers

Position 3f

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

Importing the package

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

You can get such an object using:

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

Position3f constructor

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

script.zs
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

ZenGetterZenSetterDescription
ZenGetter
x
ZenSetter
x
Description
Returns the position’s x value
ZenGetter
y
ZenSetter
y
Description
Returns the position’s y value
ZenGetter
z
ZenSetter
z
Description
Returns the position’s z value

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.

script.zs
posThree.asBlockPos();
posThree as IBlockPos;