#Recipes
1 messages · Page 1 of 1 (latest)
Soo
when you have a Recipe
check if it's a ShapedRecipe or ShapelessRecipe
then cast it to whateer it is
Okay
then you can get the ChoiceMap
that one contains different Entry<Character,RecipeChoice>
for each of those, get the RecipeChoice and cast it to either MaterialChoice or ExactChoice (whatever it is)
then check how often every character appears in the recipe's shape and then you can determine how many items of which materials you need
If you want support for other things than crafting you need to check for the other types
Here are all the types: BlastingRecipe, CampfireRecipe, CookingRecipe, FurnaceRecipe, MerchantRecipe, ShapedRecipe, ShapelessRecipe, SmithingRecipe, SmokingRecipe, StonecuttingRecipe
@frail lava thx
np
I cant get ChoiceMap :/
for(Recipe recipe : Bukkit.getRecipesFor(new ItemStack(Material.getMaterial(args[0])))) {
if(recipe instanceof ShapedRecipe) {
ShapedRecipe shaped = (ShapedRecipe) recipe;
}
else if(recipe instanceof ShapelessRecipe) {
ShapelessRecipe shapeless = (ShapelessRecipe)recipe;
}
}
This is what i have
what to do now?
you can use spaed.getChoiceMap() or shapeless.getChoiceList()
both contain RecipeChoices
(well the map obviously contains Entry<Character,RecipeChoice> instead)
declaration: package: org.bukkit.inventory, class: ShapedRecipe
are you on 1.8 or something outdated?
yup :/
oh no idea then
can i skip this step?
you have to simply use the ingredientmap
Okay.
instead of RecipeChoices, it directly contains ItemStacks
sooo it's actually easier to use
the RecipeChoices were added because of all the different wood types could be used to craft the same items
OHH okay
sry.. what now? https://ibb.co/CpcK3kS
what are you trying to do?
i want to get all items needed to craft the item
getIngredientMap().entrySet() returns a Set<ItemStack>
sooo "basically" a list of itemstacks
It worked. Thank you so much!