Class CrucibleRecipe

java.lang.Object
com.hbm_m.recipe.CrucibleRecipe
Direct Known Subclasses:
CrucibleAlloyingRecipe

public class CrucibleRecipe extends Object
Modern port of legacy CrucibleRecipe extends GenericRecipe.

Each recipe has a name (used as a translation key), a display icon, a frequency (relative weight for JEI ordering) and immutable input / output item lists.

MaterialStack TODO: The legacy class stored MaterialStack[] arrays so that amounts were expressed in the Mats unit system (mB-like). Once com.hbm_m.inventory.material.Mats and MaterialStack are ported, replace List<ItemStack> with MaterialStack[] and restore getInputAmount().

Builder usage (mirrors legacy API):


 CrucibleRecipe recipe = new CrucibleRecipe("steel_alloy")
         .setup(1, new ItemStack(ModItems.INGOT_STEEL.get()))
         .inputs(ironStack, carbonStack)
         .outputs(steelStack);
 
  • Field Details

    • name

      public final String name
      Internal identifier / translation-key base (mirrors GenericRecipe.name).
    • frequency

      public int frequency
      Relative processing frequency / weight. Higher values mean the recipe is attempted more often in random-pick scenarios. Default: 1.
  • Constructor Details

    • CrucibleRecipe

      public CrucibleRecipe(String name)
  • Method Details

    • setup

      public CrucibleRecipe setup(int frequency, net.minecraft.world.item.ItemStack icon)
      Sets the frequency weight and the display icon.
      Parameters:
      frequency - relative weight (≥ 1)
      icon - display ItemStack shown in JEI / recipe selector
      Returns:
      this for chaining
    • inputs

      public CrucibleRecipe inputs(net.minecraft.world.item.ItemStack... inputs)
      Sets the input item list. Defensive copy is made.
    • inputs

      public CrucibleRecipe inputs(List<net.minecraft.world.item.ItemStack> inputs)
      Sets the input item list from an existing collection. Defensive copy is made.
    • outputs

      public CrucibleRecipe outputs(net.minecraft.world.item.ItemStack... outputs)
      Sets the output item list. Defensive copy is made.
    • outputs

      public CrucibleRecipe outputs(List<net.minecraft.world.item.ItemStack> outputs)
      Sets the output item list from an existing collection. Defensive copy is made.
    • getInputs

      public List<net.minecraft.world.item.ItemStack> getInputs()
    • getOutputs

      public List<net.minecraft.world.item.ItemStack> getOutputs()
    • getIcon

      public net.minecraft.world.item.ItemStack getIcon()
    • getInputAmount

      public int getInputAmount()
      Returns the total number of input items across all input stacks. In the legacy code this summed MaterialStack.amount values; here it sums ItemStack.getCount() as a placeholder.

      TODO: once MaterialStack is ported, sum MaterialStack.amount instead.

    • getLocalizedName

      public String getLocalizedName()
      Returns a human-readable name derived from the recipe's name key.