TransformComponent
Position and rotation of an entity in the world.
Access
Section titled “Access”TransformComponent transform = store.getComponent(ref, TransformComponent.getComponentType());Position
Section titled “Position”// read positionVector3d pos = transform.getPosition();double x = pos.getX();double y = pos.getY();double z = pos.getZ();
// modify (Vector3d is mutable)pos.assign(newX, newY, newZ);
// teleport (handles chunk transitions gracefully)transform.teleportPosition(new Vector3d(x, y, z));Rotation
Section titled “Rotation”// read rotation (pitch, yaw, roll)Vector3f rot = transform.getRotation();float pitch = rot.getPitch(); // Xfloat yaw = rot.getYaw(); // Yfloat roll = rot.getRoll(); // Z
// modifyrot.setYaw(newYaw);rot.setPitch(newPitch);
// teleport rotationtransform.teleportRotation(new Vector3f(pitch, yaw, roll));Teleporting
Section titled “Teleporting”teleportPosition() / teleportRotation() are low-level methods for repositioning entities. They handle chunk boundary transitions but do NOT send client packets or record teleport history. Use these only for non-player entities or internal ECS systems.
// move a non-player entitytransform.teleportPosition(targetPosition);transform.teleportRotation(targetRotation);