Package dev.boze.api.event
Class EventRotate
java.lang.Object
dev.boze.api.event.CancellableEvent
dev.boze.api.event.EventRotate
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhether the client is already rotating.floatThe pitch rotation valuefloatThe yaw rotation value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EventRotateget(InteractionMode mode, float yaw, float pitch, boolean clientRotating) Gets the event instancegetMode()Gets the interaction modebooleanisFree()Returns whether this rotation event is free to modify.voidrotate(net.minecraft.util.math.Vec3d target) Calculates and sets the rotation to face the specified position.voidrotate(net.minecraft.util.math.Vec3d eyes, net.minecraft.util.math.Vec3d target) Calculates and sets the rotation to face the specified position from the given eye position.Methods inherited from class dev.boze.api.event.CancellableEvent
cancel, isCancelled, setCancelled
-
Field Details
-
yaw
public float yawThe yaw rotation value -
pitch
public float pitchThe pitch rotation value -
clientRotating
public boolean clientRotatingWhether the client is already rotating. If true, modifying yaw/pitch can break client modules.
-
-
Constructor Details
-
EventRotate
public EventRotate()
-
-
Method Details
-
get
Gets the event instance- Parameters:
mode- The interaction modeyaw- The yaw valuepitch- The pitch valueclientRotating- Whether the client is already rotating- Returns:
- The event instance
-
getMode
Gets the interaction mode- Returns:
- The interaction mode
-
isFree
public boolean isFree()Returns whether this rotation event is free to modify. A rotation event is free if it's not cancelled and the client is not already rotating.- Returns:
- true if the rotation can be safely modified, false otherwise
-
rotate
public void rotate(net.minecraft.util.math.Vec3d eyes, net.minecraft.util.math.Vec3d target) Calculates and sets the rotation to face the specified position from the given eye position. This method should only be called whenisFree()returns true.- Parameters:
eyes- The eye position to calculate fromtarget- The target position to rotate towards
-
rotate
public void rotate(net.minecraft.util.math.Vec3d target) Calculates and sets the rotation to face the specified position. This method should only be called whenisFree()returns true.- Parameters:
target- The target position to rotate towards
-