Class CustomBrewRecipeRegister

java.lang.Object
me.emafire003.dev.custombrewrecipes.CustomBrewRecipeRegister

public class CustomBrewRecipeRegister extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    equalsNbt(net.minecraft.item.ItemStack item, net.minecraft.item.Item recipe_item, @Nullable net.minecraft.nbt.NbtElement recipe_nbt_value, @Nullable String recipe_nbt_field)
    Used to check if an itemstack and an item share the same NBT data.
    static boolean
    equalsNbt(net.minecraft.item.ItemStack recipe_item, net.minecraft.item.ItemStack item)
    Checks if two itemstacks have the same NBT.
    static List<CustomBrewRecipeRegister.CustomRecipe<net.minecraft.item.Item>>
     
     
    static boolean
    isValidCustomInput(net.minecraft.item.ItemStack item)
    Used (internally) to check if an item is a valid input/base, like a bottle or an akward potion.
    static void
    registerCustomRecipe(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output)
    Use this method to register new recipes using custom items!
    static void
    registerCustomRecipeFieldOnlyNbt(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output, @Nullable String input_nbt_field, @Nullable String ingredient_nbt_field, @Nullable net.minecraft.nbt.NbtCompound output_nbt)
    Use this method to register new recipes using custom items.
    static void
    registerCustomRecipeNbt(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output, @Nullable net.minecraft.nbt.NbtCompound input_nbt, @Nullable net.minecraft.nbt.NbtCompound ingredient_nbt, @Nullable net.minecraft.nbt.NbtCompound output_nbt)
    Use this method to register new recipes using custom items.
    static void
    registerCustomRecipeNbt(net.minecraft.item.ItemStack input, net.minecraft.item.ItemStack ingredient, net.minecraft.item.ItemStack output)
    Use this method to register new recipes using custom items!
    static void
    registerCustomRecipeNbtField(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output, @Nullable String input_nbt_field, @Nullable net.minecraft.nbt.NbtElement input_nbt_value, @Nullable String ingredient_nbt_field, @Nullable net.minecraft.nbt.NbtElement ingredient_nbt_value, @Nullable net.minecraft.nbt.NbtCompound output_nbt)
    Use this method to register new recipes using custom items.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CustomBrewRecipeRegister

      public CustomBrewRecipeRegister()
  • Method Details

    • registerCustomRecipe

      public static void registerCustomRecipe(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output)
      Use this method to register new recipes using custom items! Call this on initialization!
      Parameters:
      input - The input item, the "base" item like a water_bottle for normal recipes
      ingredient - The ingredient item, like spider's eye, glowstone dust ecc
      output - The output item, the one that will result from this recipe
    • registerCustomRecipeNbt

      public static void registerCustomRecipeNbt(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output, @Nullable @Nullable net.minecraft.nbt.NbtCompound input_nbt, @Nullable @Nullable net.minecraft.nbt.NbtCompound ingredient_nbt, @Nullable @Nullable net.minecraft.nbt.NbtCompound output_nbt)
      Use this method to register new recipes using custom items. This also supports nbt! Call this on initialization!
      Parameters:
      input - The input item, the "base" item like a water_bottle for normal recipes
      ingredient - The ingredient item, like spider's eye, glowstone dust ecc
      output - The output item, the one that will result from this recipe
      input_nbt - An NBT compound that will be attached to the input item. Use null if you don't want to add NBT to this item
      ingredient_nbt - An NBT compound that will be attached to the ingredient item. Use null if you don't want to add NBT to this item
      output_nbt - An NBT compound that will be attached to the output item. Use null if you don't want to add NBT to this item
    • registerCustomRecipeFieldOnlyNbt

      public static void registerCustomRecipeFieldOnlyNbt(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output, @Nullable @Nullable String input_nbt_field, @Nullable @Nullable String ingredient_nbt_field, @Nullable @Nullable net.minecraft.nbt.NbtCompound output_nbt)
      Use this method to register new recipes using custom items. This also supports nbt, but in a different way: it will check only for the presence of a field, and not its values. For example a Glass Bottle with an NBT field of "filledWith" might have values of "air", "water", "random_stuff" or whatever and still be valid. The output item will still need a nbt compound value thogh! Call this on initialization!
      Parameters:
      input - The input item, the "base" item like a water_bottle for normal recipes
      ingredient - The ingredient item, like spider's eye, glowstone dust ecc
      output - The output item, the one that will result from this recipe
      input_nbt_field - A String that corresponds to a field that must be present on the item, regardless of its value
      ingredient_nbt_field - A String that corresponds to a field that must be present on the item, regardless of its value
      output_nbt - An NBT compound that will be attached to the output item. Use null if you don't want to add NBT to this item
    • registerCustomRecipeNbtField

      public static void registerCustomRecipeNbtField(net.minecraft.item.Item input, net.minecraft.item.Item ingredient, net.minecraft.item.Item output, @Nullable @Nullable String input_nbt_field, @Nullable @Nullable net.minecraft.nbt.NbtElement input_nbt_value, @Nullable @Nullable String ingredient_nbt_field, @Nullable @Nullable net.minecraft.nbt.NbtElement ingredient_nbt_value, @Nullable @Nullable net.minecraft.nbt.NbtCompound output_nbt)
      Use this method to register new recipes using custom items. This also supports nbt, but in a different way: it will check for the presence of a field, its values. For example a Glass Bottle with an NBT field of "filledWith" might have values of "air", "water", "random_stuff" or whatever and only "air" will be valid. If the NBT also contains other fieldds, they will be ignored. The output item will still need a nbt compound value! Call this on initialization!
      Parameters:
      input - The input item, the "base" item like a water_bottle for normal recipes
      ingredient - The ingredient item, like spider's eye, glowstone dust ecc
      output - The output item, the one that will result from this recipe
      input_nbt_field - A String that corresponds to a field that must be present on the item, regardless of its value
      input_nbt_value - An NBTElement that will need to correspond the value stored inside the specified field
      ingredient_nbt_field - A String that corresponds to a field that must be present on the item, regardless of its value
      ingredient_nbt_value - An NBTElement that will need to correspond the value stored inside the specified field
      output_nbt - An NBT compound that will be attached to the output item. Use null if you don't want to add NBT to this item
    • registerCustomRecipeNbt

      public static void registerCustomRecipeNbt(net.minecraft.item.ItemStack input, net.minecraft.item.ItemStack ingredient, net.minecraft.item.ItemStack output)
      Use this method to register new recipes using custom items! This also supports nbt! Call this on initialization!
      Parameters:
      input - The input itemstack, the "base" item like a water_bottle for normal recipes. This should already have NBT set by you.
      ingredient - The ingredient itemstack, like spider's eye, glowstone dust ecc. This should already have NBT set by you.
      output - The output itemstack, the one that will result from this recipe. This should already have NBT set by you.
    • isValidCustomInput

      public static boolean isValidCustomInput(net.minecraft.item.ItemStack item)
      Used (internally) to check if an item is a valid input/base, like a bottle or an akward potion. Also checks for nbt if necessary.
      Parameters:
      item - The item to test as a valid input
      Returns:
      true if the item is a valid input
    • equalsNbt

      public static boolean equalsNbt(net.minecraft.item.ItemStack recipe_item, net.minecraft.item.ItemStack item)
      Checks if two itemstacks have the same NBT. Or not, if they shouldn't have any NBT data
    • equalsNbt

      public static boolean equalsNbt(net.minecraft.item.ItemStack item, net.minecraft.item.Item recipe_item, @Nullable @Nullable net.minecraft.nbt.NbtElement recipe_nbt_value, @Nullable @Nullable String recipe_nbt_field)
      Used to check if an itemstack and an item share the same NBT data. This also applies to not having nbt data. This is also used to check if the itemstack has an NBT field present, but not necessarily have the same values as well
      Parameters:
      item - The itemstack that is used and should have nbt data
      recipe_item - The item from the recipe
      recipe_nbt_value - An NBTElement value that will need to correspond either to the whole NBTCompound of the item, or to a value stored in a filed if the next parameter isn't null
      recipe_nbt_field - A String representing the field that has to be present on the item if the above parameter is null, or if isn't the filed to check the value of.
      Returns:
      true if the item from the stack and the one from the recipe have the same nbt, or don't have nbt.
    • getCustomRecipes

      public static List<CustomBrewRecipeRegister.CustomRecipe<net.minecraft.item.Item>> getCustomRecipes()
    • getCustomRecipesNBTMap

      public static List<CustomBrewRecipeRegister.CustomRecipeV2> getCustomRecipesNBTMap()