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

craftingrecipes

v2.0.0

Published

recipes for crafting items with inventory and itempile

Downloads

16

Readme

craftingrecipes

Recipes for crafting items with inventory and itempile.

Build Status

Used by:

Recipe Classes

All recipe classes implement:

  • computeOutput(inventory): returns an ItemPile for the crafting result of the given inventory input ingredients, or undefined
  • matches(inventory): returns true if this recipe matches the given ingredients
  • craft(inventory): consumes input ingredients from inventory and returns ItemPile result, or undefined if doesn't match

The following recipe classes are implemented in this module:

  • AmorphousRecipe: ingredients are accepted in any order
  • PositionalRecipe: ingredients must match at certain positions

You can define your own recipe classes as long as they extend Recipe (see voxel-pickaxe's repair recipe for an example).

Recipe Lists

RecipeList manages a list of recipes and can search an inventory against each of them. This is the ordinary use case of this module. Register your recipes in RecipeList then result = craft(inventory) to search and craft.

craftingrecipes can be loaded through voxel-plugins for a centralized recipe list shared amongst multiple plugins.

Crafting Thesaurus

CraftingThesaurus provides a mapping from a convenient general name to a specific item name of that category. This is used to allow different items, all of the same general "type", to be used as crafting inputs. Amorphous and positional recipes automatically support the thesaurus.

The thesaurus is useful when you have interchangeable items, for example, different species of wood, all usable in the same recipes (or different kinds of dyes, also intended to be interchangeable, etc.). The general name "wood.log" can be registered for "logOak", "logBirch", and future potential items, then wood.log can be specified in a recipe definition as ingredients, and when matching the recipe against this ingredient, any of the listed items can be used.

For known registered names used by other plugins, see the wiki.

Examples

See unit tests

License

MIT