npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nxg-org/mineflayer-smooth-look

v0.3.0

Published

Interpolated looking for mineflayer

Downloads

24

Readme

mineflayer-smooth-look

Example:

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.

"Why is the default duration so long?"

Some of the function intervals may vary wildly. For example, the default tween function I used is TWEEN.Easing.Elastic.Out, which snaps to the destination almost immediately (even with 1000ms given), only to overshoot -> re-adjust back to the destination for the rest of the 1000ms. Mileage will vary wildly depending on what easing function you use.

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.
smoothLook.lookAt(target, duration = 1000, force = true)
  • target: A Vec3 instance, giving the location of whatever you want to look at.
    • For entities: do entity.position
  • duration: The amount of time needed to complete the look.
  • force: Whether or not to start the tween immediately, or after all others finish.

smoothLook.lookTowards(direction, duration = 1000, force = true)

  • direction: A Vec3 instance, indicating x, y, and z.
  • duration: The amount of time needed to complete the look.
  • force: Whether or not to start the tween immediately, or after all others finish.

smoothLook.look(yaw, pitch, duration = 1000, force = true)

  • yaw: A number.
  • pitch: A number.
  • duration: The amount of time needed to complete the look.
  • force: Whether or not to start the tween immediately, or after all others finish.

monkeyPatch(bot)

  • bot: The mineflayer bot. Monkey patches the bot's current look and lookAt to use the smoothLook plugin automatically.