Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ed.enderdeath.mod.AnvilDragon;
- import java.util.List;
- import java.util.Map;
- import com.google.common.collect.Lists;
- import com.google.common.collect.Maps;
- import com.sun.istack.internal.Nullable;
- import net.minecraft.block.Block;
- import net.minecraft.inventory.InventoryCrafting;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.crafting.IRecipe;
- import net.minecraft.world.World;
- public class TutorielCraftingManager {
- private static final TutorielCraftingManager INSTANCE = new TutorielCraftingManager();
- public static TutorielCraftingManager getInstance()
- {
- return INSTANCE;
- }
- /** La liste des recettes */
- private final List<IRecipe> recipes = Lists.<IRecipe>newArrayList();
- private TutorielCraftingManager()
- {
- //Vous pouvez ajouter des recettes ici
- }
- /**
- * Adds a shaped recipe to the games recipe list.
- */
- /**
- * Adds an IRecipe to the list of crafting recipes.
- */
- public void addRecipe(IRecipe recipe)
- {
- this.recipes.add(recipe);
- }
- /**
- * Retourne le résultat de la recette ou null si il n'y en a aucun
- */
- @Nullable
- public ItemStack findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn)
- {
- for (IRecipe irecipe : this.recipes) //Pour chaque recette
- {
- if (irecipe.matches(craftMatrix, worldIn)) //Si elle correspond à la matrice actuelle
- {
- return irecipe.getCraftingResult(craftMatrix); //On donne son résultat
- }
- }
- return null;
- }
- /**
- * Retourne les items retants après un craft
- */
- public List<IRecipe> getRecipeList()
- {
- return this.recipes;
- }
- }
Add Comment
Please, Sign In to add comment