1.9 KiB
IScriptEntity.unlockRotation
c.send(c.getSubject().getName() + "'s motion is (" + motion.x + ", " + motion.y + ", " + motion.z + ")");
setMotion
void setMotion(double x, double y, double z)
Set entity's motion.
var motion = c.getSubject().getMotion();
if (motion.y < 0) { // Reverse the falling motion into a jumping up motion c.getSubject().setMotion(motion.x, -motion.y, motion.z); }
addMotion
void addMotion(double x, double y, double z)
Set entity's server-sided motion. (.setMotion() causes rubber banding) Adds to the current velocity of the entity.
// Throw all items in the air for each (var item in c.getServer().getEntities("@e[type=item]")) { item.addVelocity(0, 0.3, 0); }
getRotations
ScriptVector getRotations()
Get entity's rotation (x is pitch, y is yaw, and z is yaw head, if entity is living base).
var rotations = c.getSubject().getRotations(); var pitch = rotations.x; var yaw = rotations.y; var yaw_head = rotations.z;
c.send(c.getSubject().getName() + "'s rotations are (" + pitch + ", " + yaw + ", " + yaw_head + ")");
setRotations
void setRotations(float pitch, float yaw, float yawHead)
Set entity's rotation.
// Make entity look at west c.getSubject().setRotations(0, 0, 0);
getPitch
float getPitch()
Get entity's pitch (vertical rotation).
getYaw
float getYaw()
Get entity's yaw (horizontal rotation).
getYawHead
float getYawHead()
Get entity's head yaw.
getLook
ScriptVector getLook()
Get a vector in which direction entity looks.
var look = c.getSubject().getLook();
c.getSubject().setMotion(look.x * 0.5, look.y * 0.5, look.z * 0.5);
getEyeHeight
float getEyeHeight()
Returns the eye height of the entity.