Home Commands Examples Getting Started With Scripts Global Keywords

UseOnContext

Importing the class

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 at the very top of the file.

script.zs
import crafttweaker.api.item.UseOnContext;

Methods

Return Type: Vec3

script.zs
// UseOnContext.getClickLocation() as Vec3
myUseOnContext.getClickLocation();

Return Type: Direction

script.zs
// UseOnContext.getClickedFace() as Direction
myUseOnContext.getClickedFace();

Return Type: BlockPos

script.zs
// UseOnContext.getClickedPos() as BlockPos
myUseOnContext.getClickedPos();

Return Type: InteractionHand

script.zs
// UseOnContext.getHand() as InteractionHand
myUseOnContext.getHand();

Return Type: Direction

script.zs
// UseOnContext.getHorizontalDirection() as Direction
myUseOnContext.getHorizontalDirection();

Return Type: ItemStack

script.zs
// UseOnContext.getItemInHand() as ItemStack
myUseOnContext.getItemInHand();

Return Type: Level

script.zs
// UseOnContext.getLevel() as Level
myUseOnContext.getLevel();

Return Type: Player?

script.zs
// UseOnContext.getPlayer() as Player?
myUseOnContext.getPlayer();

Return Type: float

script.zs
// UseOnContext.getRotation() as float
myUseOnContext.getRotation();

Return Type: boolean

script.zs
// UseOnContext.isInside() as boolean
myUseOnContext.isInside();

Return Type: boolean

script.zs
// UseOnContext.isSecondaryUseActive() as boolean
myUseOnContext.isSecondaryUseActive();

Properties

NameTypeHas GetterHas Setter
Name
clickLocation
Type
Vec3
Has Getter
true
Has Setter
false
Name
clickedFace
Type
Direction
Has Getter
true
Has Setter
false
Name
clickedPos
Type
BlockPos
Has Getter
true
Has Setter
false
Name
hand
Type
InteractionHand
Has Getter
true
Has Setter
false
Name
horizontalDirection
Type
Direction
Has Getter
true
Has Setter
false
Name
isInside
Type
boolean
Has Getter
true
Has Setter
false
Name
isSecondaryUseActive
Type
boolean
Has Getter
true
Has Setter
false
Name
itemInHand
Type
ItemStack
Has Getter
true
Has Setter
false
Name
level
Type
Level
Has Getter
true
Has Setter
false
Name
player
Type
Player?
Has Getter
true
Has Setter
false
Name
rotation
Type
float
Has Getter
true
Has Setter
false