mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 00:07:37 +00:00
37 lines
991 B
Java
37 lines
991 B
Java
package team.chisel.utils;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.crafting.CraftingManager;
|
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
import net.minecraft.item.crafting.IRecipe;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Utility for crafting/recipe things
|
|
*/
|
|
public class RecipeUtil {
|
|
|
|
@SuppressWarnings("unchecked")
|
|
public static boolean isCraftable(ItemStack stack){
|
|
for (IRecipe recipe : (List<IRecipe>)CraftingManager.getInstance().getRecipeList()){
|
|
if (recipe.getRecipeOutput()==null){
|
|
continue;
|
|
}
|
|
if (stack.isItemEqual(recipe.getRecipeOutput())){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static boolean isSmeltable(ItemStack stack){
|
|
return FurnaceRecipes.smelting().getSmeltingList().containsKey(stack);
|
|
}
|
|
|
|
public static boolean isCreatable(ItemStack stack){
|
|
return isCraftable(stack) || isSmeltable(stack);
|
|
}
|
|
|
|
}
|