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

tomate-loaders

v2.0.2

Published

Provides metadata for minecraft modloaders

Downloads

17

Readme

Tomate Loaders

Tomate Loaders is a JavaScript library designed to facilitate the management and launching of Minecraft game instances with different mod loaders, specifically Fabric, Quilt, Forge and NeoForge. This README.md provides an overview of how to use Tomate Loaders in your own projects.

Installation

To use Tomate Loaders in your project, you can install it via npm:

npm install tomate-loaders

Usage

Vanilla

If you only need to ever launch Vanilla Minecraft you should use MCLC directly. This is just here for a consistant api

Launch vanilla Minecraft

import { vanilla } from 'tomate-loaders';
import { Client, Authenticator } from 'minecraft-launcher-core';

// Create a Minecraft launcher instance
const launcher = new Client();

// Get the launch configuration for Fabric
const launchConfig = await vanilla.getMCLCLaunchConfig({
  gameVersion: '1.20.2',
  rootPath: './minecraft',
});

launcher.launch({
  ...launchConfig,
  authorization: Authenticator.getAuth('username'), // You can use https://www.npmjs.com/package/msmc for microsoft auth
  memory: {
    min: 2000,
    max: 5000,
  },
  javaPath: 'javaw',
});

Quilt

Quilt has the same api in Tomate Loaders. Just replace the import { fabric } from 'tomate-loaders' with import { quilt } from 'tomate-loaders'

Fabric

Tomate Loaders provides functionality for working with the Fabric mod loader. Here's how you can use it in your project:

Get Profile

import { fabric } from 'tomate-loaders';
import { Client, Authenticator } from 'minecraft-launcher-core';

// Get a list of available Fabric loaders
const loaders = await fabric.getLoaders();

// Get a Fabric profile for a specific Minecraft version and loader
const profile = await fabric.getProfile('1.19.4', loaders[0].version);

Launch Minecraft with fabric (it will download the profile for you automatically)

import { fabric } from 'tomate-loaders';
import { Client, Authenticator } from 'minecraft-launcher-core';

// Create a Minecraft launcher instance
const launcher = new Client();

// Get the launch configuration for Fabric
const launchConfig = await fabric.getMCLCLaunchConfig({
  gameVersion: '1.20.2',
  rootPath: './minecraft',
});

launcher.launch({
  ...launchConfig,
  authorization: Authenticator.getAuth('username'), // You can use https://www.npmjs.com/package/msmc for microsoft auth
  memory: {
    min: 2000,
    max: 5000,
  },
  javaPath: 'javaw',
});

Forge

Tomate Loaders also supports working with the Forge mod loader. Here's how you can use it in your project:

Download Forge for a specific Minecraft version

import { forge } from 'tomate-loaders';

await forge.downloadForge('./forge.jar', '1.19.2');

Launch Minecraft with Forge (it will download forge for you automatically)

import { forge } from 'tomate-loaders';

// Create a Minecraft launcher instance
const launcher = new Client();

// Get the launch configuration for Forge
const launchConfig = await forge.getMCLCLaunchConfig({
  gameVersion: '1.20.2',
  rootPath: './minecraft',
});

launcher.launch({
  ...launchConfig,
  authorization: Authenticator.getAuth('username'), // You can use https://www.npmjs.com/package/msmc for microsoft auth
  memory: {
    min: 2000,
    max: 5000,
  },
  javaPath: 'javaw',
});

NeoForge

NeoForge works just like forge.

Loader id

Each modloader has an unique id

console.log(fabric.id); // "fabric"
const fabric = loader('fabric');

TomateMods loader config

You can get the loader config for tomate-mods for any of the mod loaders like this:

const fabricLoader = fabric.tomateModsModLoader;

Liner

Liner is super usefull for parsing the output of the minecraft client. It collects the output of the minecraft client and calls the function specified, when encountering a new line.

To simply output what the client does you can do the following:

import { liner } from 'tomate-loaders';

launcher.on('data', liner(console.log));