Class RecipeRegistration

java.lang.Object
ke.ric.api.registration.RecipeRegistration

public class RecipeRegistration extends Object
API for registering custom recipes programmatically. Addon recipes are stored separately and can be browsed in the cookbook under their addon's category. Usage:
api.recipes().register(RecipeRegistration.builder()
    .id("STOMP_GRAPES")
    .addonId("distillery")           // Groups recipes by addon
    .stationName("Stomping Tub")     // Display name for the station
    .stationTexture("http://...")    // Optional texture for station icon
    .output("GRAPE_MUST")
    .processingTime(300)             // 15 seconds (in ticks)
    .addIngredient("RENOIT_GRAPE", true, 4)  // Required, up to 4);
  • Method Details

    • register

      public boolean register(RecipeRegistration.AddonRecipeBuilder builder)
      Register an addon recipe.
      Parameters:
      builder - The recipe builder
      Returns:
      true if registered successfully
    • registerAll

      public void registerAll(RecipeRegistration.AddonRecipeBuilder... builders)
      Register multiple recipes at once.
    • registerOutputDecorator

      public void registerOutputDecorator(String addonId, String recipeId, RecipeOutputDecorator decorator)
      Unregister an addon's recipes.
    • hasOutputDecorator

      public boolean hasOutputDecorator(String addonId, String recipeId)
    • unregisterAddon

      public void unregisterAddon(String addonId)
    • suppress

      public void suppress(String addonId, String recipeId, int overrideStrength)
      Suppress a recipe while the owning addon remains registered. Suppressions use the same override-strength arbitration as replacement recipes and are removed by unregisterAddon(String).
    • registerFromFile

      public int registerFromFile(File recipeFile, String defaultAddonId)
      Register addon recipes from an editable JSON file.
    • registeredIds

      public Set<String> registeredIds(String addonId)
      Return recipe IDs owned by an addon after override arbitration.
    • inspectFile

      public static RecipeRegistration.RecipeFileInspection inspectFile(File recipeFile, String defaultAddonId, Predicate<String> customItemExists)
      Parse an editable addon recipe file through Core's runtime parser and validate every typed item reference without changing registered state.
    • registerOutputHandler

      public void registerOutputHandler(String recipeId, CustomOutputHandler handler)
      Register a custom output handler for a specific recipe. When the recipe is crafted, this handler will be called instead of the standard output creation. This allows addons to preserve metadata from input items (like LiquidProfile for brewing). Example usage:
      api.recipes().registerOutputHandler("BOIL_GRAIN_WORT", (recipe, inputs) -> {
          // Extract data from input
          LiquidProfile profile = LiquidProfile.loadFromItem(inputs.get(0));
          
          // Create proper output with preserved data
          ItemStack output = api.createItem("BOILED_GRAIN_WORT");
          profile.saveToItem(output);
          return output;
      });
      
      Parameters:
      recipeId - The recipe ID (case-insensitive)
      handler - The handler that creates the output item from inputs
    • unregisterOutputHandler

      public void unregisterOutputHandler(String recipeId)
      Unregister a custom output handler.
    • registerEligibilityPredicate

      public void registerEligibilityPredicate(String recipeId, RecipeEligibilityPredicate predicate)
      Register an addon-owned eligibility gate. The gate runs after ordinary ingredient matching but before a station reserves any inputs.
    • unregisterEligibilityPredicate

      public void unregisterEligibilityPredicate(String recipeId)
    • builder

      public static RecipeRegistration.AddonRecipeBuilder builder()
      Create a new recipe builder.
    • vanillaItemMatcher

      public static RuleMatcher vanillaItemMatcher(String materialId)
      Create a vanilla-material rule matcher.
    • customItemMatcher

      public static RuleMatcher customItemMatcher(String customItemId)
      Create a Heirloom custom-item rule matcher.
    • action

      public static RecipeAction action(String type, String key, String value)
      Create a rule action.
    • visualAction

      public static RecipeAction visualAction(String visualId)
      Create a provider-neutral visual swap action.
    • nameAction

      public static RecipeAction nameAction(String displayName)
      Create a display-name override action.