1.0.30 • Published 12 months ago

lc-lib v1.0.30

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

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)
1.0.29

12 months ago

1.0.28

12 months ago

1.0.30

12 months ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago