# @nxg-org/mineflayer-smooth-look

> Interpolated looking for mineflayer

Latest version **1.2.4** (published 2025-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nxg-org/mineflayer-smooth-look
pnpm add @nxg-org/mineflayer-smooth-look
yarn add @nxg-org/mineflayer-smooth-look
bun add @nxg-org/mineflayer-smooth-look
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2025-09-04 |
| First published | 2023-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 21.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | GenerelSchwerz |
| Maintainers | generel_schwerz, rob9315 |

## Links

- npm: https://www.npmjs.com/package/@nxg-org/mineflayer-smooth-look
- npm.io page: https://npm.io/package/@nxg-org/mineflayer-smooth-look

## Dependencies (3)

- [three](https://npm.io/package/three.md) ^0.149.0
- [@types/three](https://npm.io/package/@types/three.md) ^0.149.0
- [@tweenjs/tween.js](https://npm.io/package/@tweenjs/tween.js.md) ^18.6.4

## Recent versions

- 1.2.4 (latest) — 2025-09-04
- 1.2.3 — 2025-09-04
- 1.2.2 — 2025-09-04
- 1.2.1 — 2025-09-04
- 1.2.0 — 2025-09-04
- 1.1.3 — 2025-05-29
- 1.1.2 — 2025-03-24
- 1.1.1 — 2025-03-24
- 1.1.0 — 2025-03-24
- 1.0.3 — 2025-02-28
- 1.0.2 — 2025-02-28
- 1.0.1 — 2024-08-20
- 1.0.0 — 2024-08-20
- 0.3.1 — 2024-08-20
- 0.3.0 — 2024-01-18
- … 7 more at https://npm.io/package/@nxg-org/mineflayer-smooth-look/versions

## README

# mineflayer-smooth-look


### Example:
```js
const {loader} = require("@nxg-org/mineflayer-smooth-look");
const {createBot} = require("mineflayer");
const {Vec3} = require("vec3");


const bot = createBot({...});
bot.loadPlugin(loader);


bot.smoothLook.lookAt(target /* entity position */)
bot.smoothLook.lookTowards(new Vec3(0, 0, 0) /* direction */)
bot.smoothLook.look(yaw, pitch)
```



### Notes:

"Why is force default to true?"

Well, The alternative is to append the latest tween to the list of tweens that have not completed yet. Naturally, most tweening will occur over the span than more than one tick. Yet someone will definitely look at an entity every tick. If force is false, the bot will take `duration * # of calls` to complete the look. If force is true, it will only take `duration` ms to complete.

If you want to use this plugin while also retaining the ability to instantly snap to look at something, do not monkeypatch this plugin in and call `bot.smoothLook.look` or `bot.smoothLook.lookAt` instead.


### API:


#### smoothLook.setEasing(func)
- `func`: A function for interpolating movements. These are provided by `@tweenjs/tween.js`. 
I highly recommend you look at those instead. The default is `TWEEN.Easing.Elastic.Out`.

Example:
```js
const {loader} = require("@nxg-org/mineflayer-smooth-look");
const {createBot} = require("mineflayer");
const {Vec3} = require("vec3");
const TWEEN = require("@tweenjs/tween.js");

const bot = createBot({...});
bot.loadPlugin(loader);

bot.smoothLook.setEasing(TWEEN.Easing.Quadratic.InOut);
```



##### smoothLook.lookAt(target, force = true, goodEnoughDot = 1)
- `target`: A `Vec3` instance,  giving the location of whatever you want to look at.
    - For entities: do `entity.position`
- `force`: Whether or not to start the tween immediately, or after all others finish.
- `goodEnoughDot`: The dot product of the current look direction and the target direction. If the dot product is greater than this value, the tween will not start. This is to prevent the bot from looking at the target if it is already looking at it.

- Returns `Promise<void>`.
    - Resolves when the tween is finished.

Example:
```js
const {loader} = require("@nxg-org/mineflayer-smooth-look");
const {createBot} = require("mineflayer");
const {Vec3} = require("vec3");

const bot = createBot({...});
bot.loadPlugin(loader);

await bot.smoothLook.lookAt(new Vec3(0, 0, 0), true, 0.99);
```



#### smoothLook.lookTowards(direction, force = true, goodEnoughDot = 1)
- `direction`: A `Vec3` instance, indicating `x`, `y`, and `z`.
- `force`: Whether or not to start the tween immediately, or after all others finish.
- `goodEnoughDot`: The dot product of the current look direction and the target direction. If the dot product is greater than this value, the tween will not start. This is to prevent the bot from looking at the target if it is already looking at it.

- Returns `Promise<void>`.
    - Resolves when the tween is finished.

Example:
```js

const {loader} = require("@nxg-org/mineflayer-smooth-look");
const {createBot} = require("mineflayer");

const bot = createBot({...});
bot.loadPlugin(loader);

const entity = bot.nearestEntity();

const direction = entity.position.clone().minus(bot.entity.position);

await bot.smoothLook.lookTowards(direction, true, 0.99);
```


#### smoothLook.look(yaw, pitch, force = true, goodEnoughDot = 1)
- `yaw`: A number.
- `pitch`: A number.
- `force`: Whether or not to start the tween immediately, or after all others finish.
- `goodEnoughDot`: The dot product of the current look direction and the target direction. If the dot product is greater than this value, the tween will not start. This is to prevent the bot from looking at the target if it is already looking at it.

- Returns `Promise<void>`.
    - Resolves when the tween is finished.

Example:
```js
const {loader} = require("@nxg-org/mineflayer-smooth-look");
const {createBot} = require("mineflayer");

const bot = createBot({...});
bot.loadPlugin(loader);

await bot.smoothLook.look(0, 0, true, 0.99);
```



#### monkeyPatch(bot)
- `bot`: The mineflayer bot.
Monkey patches the bot's current look and lookAt to use the smoothLook plugin automatically.

Example:
```js
const {monkeyPatch} = require("@nxg-org/mineflayer-smooth-look");
const {createBot} = require("mineflayer");

const bot = createBot({...});
monkeyPatch(bot);
```

---
_Source: https://npm.io/package/@nxg-org/mineflayer-smooth-look · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
