/stonecutter-recipe-tags

Allows for creating stonecutter recipes with tags, saving on JSON files.

Primary LanguageJavaMIT LicenseMIT

Stonecutter Recipe Tags

Info

This Fabric/Forge mod allows for creation of stonecutter recipes through tags. Any item in these tags can be crafted into any other item in the same tag. This allows for large decreases in JSON files and recipe counts, cutting file counts and reducing lag.

Use

Setup

To get started, add this mod to your development environment.

repositories {
  maven { url "https://api.modrinth.com/maven" }
}

dependencies {
  modImplementation "maven.modrinth:stonecutter_recipe_tags:<version>"
  include "maven.modrinth:stonecutter_recipe_tags:<version>"
}

Replace <version> with the latest version number found on the mod page.

Basics

StonecutterRecipeTagManager is where all the magic happens. However, most of the time you won't even need to touch it. To create a recipe tag, start by creating a subfolder in your mod's item tags directory. This subfolder should be named stonecutter_recipes. File structure should look something like this:
resources/data/modid/tags/items/stonecutter_recipes/
Any tag inside this folder will automatically be registered as a recipe tag.

Item Counts

Every item has a count associated with it used in crafting. This number should be how many of this item is needed for one block to be made. For example, for plain blocks this number is 1, while for slabs it is 2. To add a custom amount, use StonecutterRecipeTagManager#registerItemCraftCount.
Example use case: quarter slabs would return 4.

Advanced

StonecutterRecipeTagManager has a few other methods which can be utilized.
registerOrGet/register: Allows for manual registration of recipe tags. Should not be needed, but is provided just in case. Tags added through this method do not persist through resource reloads.
getRecipeTags: Returns a list of all recipe tags the given item is in.
registerItemCraftCount: As stated above, allows for registration of custom crafting amounts.
getItemCraftCount: Gets the crafting count for the given item. If no custom amount has been set, returns 2 for slabs, and 1 for all other blocks.
toSyncPacket: Creates an S2C packet that can be sent to clients to manually synchronize their stonecutter recipe tags.