Guest User

Untitled

a guest
Jul 4th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. package ed.enderdeath.mod.AnvilDragon;
  2.  
  3. import java.util.List;
  4. import java.util.Map;
  5.  
  6. import com.google.common.collect.Lists;
  7. import com.google.common.collect.Maps;
  8. import com.sun.istack.internal.Nullable;
  9.  
  10. import net.minecraft.block.Block;
  11. import net.minecraft.inventory.InventoryCrafting;
  12. import net.minecraft.item.Item;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.item.crafting.IRecipe;
  15. import net.minecraft.world.World;
  16.  
  17. public class TutorielCraftingManager {
  18. private static final TutorielCraftingManager INSTANCE = new TutorielCraftingManager();
  19. public static TutorielCraftingManager getInstance()
  20. {
  21. return INSTANCE;
  22. }
  23.  
  24. /** La liste des recettes */
  25. private final List<IRecipe> recipes = Lists.<IRecipe>newArrayList();
  26.  
  27. private TutorielCraftingManager()
  28. {
  29. //Vous pouvez ajouter des recettes ici
  30. }
  31.  
  32. /**
  33. * Adds a shaped recipe to the games recipe list.
  34. */
  35.  
  36. /**
  37. * Adds an IRecipe to the list of crafting recipes.
  38. */
  39. public void addRecipe(IRecipe recipe)
  40. {
  41. this.recipes.add(recipe);
  42. }
  43.  
  44. /**
  45. * Retourne le résultat de la recette ou null si il n'y en a aucun
  46. */
  47. @Nullable
  48. public ItemStack findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn)
  49. {
  50. for (IRecipe irecipe : this.recipes) //Pour chaque recette
  51. {
  52. if (irecipe.matches(craftMatrix, worldIn)) //Si elle correspond à la matrice actuelle
  53. {
  54. return irecipe.getCraftingResult(craftMatrix); //On donne son résultat
  55. }
  56. }
  57. return null;
  58. }
  59.  
  60. /**
  61. * Retourne les items retants après un craft
  62. */
  63.  
  64. public List<IRecipe> getRecipeList()
  65. {
  66. return this.recipes;
  67. }
  68. }
Add Comment
Please, Sign In to add comment