Package org.cyclops.cyclopscore.helper
Class CraftingHelpers
java.lang.Object
org.cyclops.cyclopscore.helper.CraftingHelpers
Several convenience functions for crafting.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
TfindClientRecipe
(net.minecraft.core.RegistryAccess registryAccess, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.crafting.RecipeType<T> recipeType, int index) static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Optional<T>findRecipeCached
(net.minecraft.world.item.crafting.RecipeType<T> recipeType, C inventoryCrafting, net.minecraft.world.level.Level world, boolean uniqueInventory) A cache-based variant ofRecipeManager.getRecipeFor(RecipeType, Container, Level)
.static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Collection<T>findRecipes
(net.minecraft.world.level.Level world, net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Optional<T>findServerRecipe
(net.minecraft.world.item.crafting.RecipeType<T> recipeType, C container, net.minecraft.world.level.Level world) static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Collection<T>findServerRecipes
(net.minecraft.server.level.ServerLevel world, net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Collection<T>findServerRecipes
(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Optional<T>getClientRecipe
(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType, net.minecraft.resources.ResourceLocation recipeName) static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Collection<T>getClientRecipes
(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) static net.minecraft.world.item.crafting.RecipeManager
static <C extends net.minecraft.world.Container,
T extends net.minecraft.world.item.crafting.Recipe<C>>
Optional<T>getServerRecipe
(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType, net.minecraft.resources.ResourceLocation recipeName) static void
load()
static void
onRecipesLoaded
(net.minecraftforge.client.event.RecipesUpdatedEvent event)
-
Constructor Details
-
CraftingHelpers
public CraftingHelpers()
-
-
Method Details
-
load
public static void load() -
onRecipesLoaded
public static void onRecipesLoaded(net.minecraftforge.client.event.RecipesUpdatedEvent event) -
findRecipes
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Collection<T> findRecipes(net.minecraft.world.level.Level world, net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) -
getRecipeManager
public static net.minecraft.world.item.crafting.RecipeManager getRecipeManager() -
getServerRecipe
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Optional<T> getServerRecipe(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType, net.minecraft.resources.ResourceLocation recipeName) -
findServerRecipe
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Optional<T> findServerRecipe(net.minecraft.world.item.crafting.RecipeType<T> recipeType, C container, net.minecraft.world.level.Level world) -
findServerRecipes
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Collection<T> findServerRecipes(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) -
findServerRecipes
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Collection<T> findServerRecipes(net.minecraft.server.level.ServerLevel world, net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) -
getClientRecipe
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Optional<T> getClientRecipe(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType, net.minecraft.resources.ResourceLocation recipeName) -
getClientRecipes
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Collection<T> getClientRecipes(net.minecraft.world.item.crafting.RecipeType<? extends T> recipeType) -
findClientRecipe
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> T findClientRecipe(net.minecraft.core.RegistryAccess registryAccess, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.crafting.RecipeType<T> recipeType, int index) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
findRecipeCached
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> Optional<T> findRecipeCached(net.minecraft.world.item.crafting.RecipeType<T> recipeType, C inventoryCrafting, net.minecraft.world.level.Level world, boolean uniqueInventory) A cache-based variant ofRecipeManager.getRecipeFor(RecipeType, Container, Level)
.- Type Parameters:
C
- The inventory type.T
- The recipe type.- Parameters:
recipeType
- The recipe type.inventoryCrafting
- The crafting inventory.world
- The world.uniqueInventory
- If inventoryCrafting is a unique instance that can be cached safely. Otherwise a deep copy will be taken.- Returns:
- The optional recipe if one was found.
-