Package org.moddingx.libx.crafting
Class RecipeHelper
java.lang.Object
org.moddingx.libx.crafting.RecipeHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <I extends net.minecraft.world.item.crafting.RecipeInput,
T extends net.minecraft.world.item.crafting.Recipe<I>>
booleanisItemValidInput
(net.minecraft.world.item.crafting.RecipeManager rm, net.minecraft.world.item.crafting.RecipeType<T> recipeType, net.minecraft.world.item.ItemStack stack) Gets whether anItemStack
is a valid input for at least one recipe of a given recipe type.static boolean
matches
(net.minecraft.world.item.crafting.Recipe<?> recipe, List<net.minecraft.world.item.ItemStack> stacks, boolean exactMatch) Checks whether all the ingredients of a recipe are present in a list ofItemStack
s.static List
<net.minecraft.world.item.ItemStack> Takes a list ofItemStacks
and stacks them up so multiple ItemStacks that can be stacked are transformed into one.
-
Constructor Details
-
RecipeHelper
public RecipeHelper()
-
-
Method Details
-
isItemValidInput
public static <I extends net.minecraft.world.item.crafting.RecipeInput,T extends net.minecraft.world.item.crafting.Recipe<I>> boolean isItemValidInput(net.minecraft.world.item.crafting.RecipeManager rm, net.minecraft.world.item.crafting.RecipeType<T> recipeType, net.minecraft.world.item.ItemStack stack) Gets whether anItemStack
is a valid input for at least one recipe of a given recipe type.- Parameters:
rm
- The recipe manager to use. You can get one from a world.
-
matches
public static boolean matches(net.minecraft.world.item.crafting.Recipe<?> recipe, List<net.minecraft.world.item.ItemStack> stacks, boolean exactMatch) Checks whether all the ingredients of a recipe are present in a list ofItemStack
s. This does not check that all ingredients are on different slots.- Parameters:
exactMatch
- When this is true this will return false if the stack list contains more items than the recipe requires.
-
stackUp
public static List<net.minecraft.world.item.ItemStack> stackUp(List<net.minecraft.world.item.ItemStack> stacks) Takes a list ofItemStacks
and stacks them up so multiple ItemStacks that can be stacked are transformed into one.
-