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

lc-lib

v1.0.30

Published

Library to access Lunar Client's Asset WebSocket easily

Downloads

134

Readme

WARNING: This library is stale right now due to a update in Lunar Client's internals, we don't plan on recoding for that update, but we may do a rework for v2 when Lunar v3 releases.

LCLib

A library to access the Lunar Client Assets WebSocket easily and quickly, comes with:

  • Automatic State Handling
  • Reconnects
  • Unmatched Speed
  • Reliable Anti-Crashing Systems
  • Built-In Utilities for you to use

Getting Started

Before you begin, I recommend installing the typed-emitter npm package along with this one as it helps a lot with event names and arguments.

First off, install the package by simply running npm install lc-lib. Once it installs, go to your main file and import it with either of these ways:

// ES6
import * as Lunar from 'lc-lib';

// CommonJS
const Lunar = require('lc-lib');

Now, you can create a client:

const client = new Lunar.Client({
	// Enable if you want to see built-in logging details from the library, useful for debugging and testing
	debug: false,
});

Next up, you need to get a Microsoft OR Minecraft Access Token, and then you need to initiate the Client, connect, and wait for the connected event before running any code:

const userState = {
	arch: 'x64',
	branch: 'master',
	clothCloak: 'false',
	gitCommit: 'd5e1bcee71328b1885a0365ea1c079b12b0dc4ee',
	hatHeightOffset:
		'[{"id":3520,"height":0.0},{"id":2628,"height":0.0},{"id":3471,"height":0.0},{"id":3472,"height":0.0},{"id":2583,"height":0.0},{"id":2584,"height":0.0},{"id":2526,"height":0.0},{"id":2527,"height":0.0},{"id":2528,"height":0.0},{"id":2856,"height":0.0},{"id":2540,"height":0.0},{"id":2541,"height":0.0},{"id":2542,"height":0.0},{"id":3438,"height":0.0},{"id":2543,"height":0.0},{"id":3439,"height":0.0},{"id":2544,"height":0.0},{"id":2545,"height":0.0},{"id":2424,"height":0.0},{"id":2490,"height":0.0},{"id":2491,"height":0.0},{"id":2492,"height":0.0},{"id":2493,"height":0.0},{"id":2494,"height":0.0},{"id":2558,"height":0.0},{"id":2559,"height":0.0},{"id":3519,"height":0.0}]',
	hwid: 'not supplied',
	launcherVersion: 'not supplied',
	lunarPlusColor: '-1',
	os: 'Windows',
	server: '',
	showHatsOverHelmet: 'false',
	showHatsOverSkinLayer: 'true',
	version: 'v1_8',
	flipShoulderPet: 'false',
	ichorModules: 'common,optifine,lunar',
	showOverBoots: 'true',
	showOverChestplate: 'true',
	showOverLeggings: 'true',
};

// Init and Connect

// - Microsoft Access Token
await client.init(access_token);

// - Minecraft Access Token
await client.init(access_token, true);

client.connect(userState);

// Waiting for connected event (not necessary if you await the client.connect() method)

client.on('connected', () => {
	// Code Here
});

client.on('otherListener', (arg1, arg2) => console.log(arg1, arg2));

View the full documentation

And now you're ready to go!

Good luck on your journey exploring the Lunar Client Backend, and I hope you don't suffer as much as I did while making this!

Credits:

  • LunarSocket by Solar Tweaks for the Packet declarations and reading/writing, although I did change a lot with my findings
  • MinecraftJS for the UUID and BufWrapper Packages which really helped in development and made it MUCH easier
  • Leoo for helping out a lot during the testing phase and keeping me mentally sane (at least somewhat)