1818import  mezz .jei .gui .recipes .RecipeTransferButton ;
1919import  mezz .jei .gui .recipes .RecipesGui ;
2020import  mezz .jei .gui .recipes .lookups .IFocusedRecipes ;
21+ import  net .minecraft .client .Minecraft ;
2122import  net .minecraft .world .entity .player .Player ;
2223import  net .minecraft .world .inventory .AbstractContainerMenu ;
2324import  org .jetbrains .annotations .Nullable ;
3031
3132public  class  LazyRecipeLayoutList <T > implements  IRecipeLayoutList  {
3233	private  final  @ Nullable  AbstractContainerMenu  container ;
33- 	private  final  @ Nullable  Player  player ;
3434	private  final  IRecipeManager  recipeManager ;
3535	private  final  IRecipeCategory <T > recipeCategory ;
3636	private  final  RecipesGui  recipesGui ;
@@ -46,7 +46,6 @@ public class LazyRecipeLayoutList<T> implements IRecipeLayoutList {
4646	public  LazyRecipeLayoutList (
4747		Set <RecipeSorterStage > recipeSorterStages ,
4848		@ Nullable  AbstractContainerMenu  container ,
49- 		@ Nullable  Player  player ,
5049		IFocusedRecipes <T > selectedRecipes ,
5150		BookmarkList  bookmarkList ,
5251		IRecipeManager  recipeManager ,
@@ -57,7 +56,6 @@ public LazyRecipeLayoutList(
5756		boolean  matchingBookmarks  = recipeSorterStages .contains (RecipeSorterStage .BOOKMARKED );
5857		boolean  matchingCraftable  = recipeSorterStages .contains (RecipeSorterStage .CRAFTABLE );
5958		this .container  = container ;
60- 		this .player  = player ;
6159		this .recipeManager  = recipeManager ;
6260		this .recipesGui  = recipesGui ;
6361		this .focusGroup  = focusGroup ;
@@ -86,7 +84,7 @@ public LazyRecipeLayoutList(
8684				RecipeBookmark <T , ?> recipeBookmark  = bookmarkList .getMatchingBookmark (recipeType , recipe );
8785				if  (recipeBookmark  != null ) {
8886					IRecipeLayoutDrawable <T > recipeLayout  = recipeManager .createRecipeLayoutDrawableOrShowError (recipeCategory , recipe , focusGroup );
89- 					RecipeLayoutWithButtons <T > recipeLayoutWithButtons  = createRecipeLayoutWithButtons (recipeLayout , recipeBookmark , bookmarkList , recipesGui , container ,  player );
87+ 					RecipeLayoutWithButtons <T > recipeLayoutWithButtons  = createRecipeLayoutWithButtons (recipeLayout , recipeBookmark , bookmarkList , recipesGui , container );
9088					results .add (recipeLayoutWithButtons );
9189					iterator .remove ();
9290				}
@@ -98,20 +96,15 @@ public LazyRecipeLayoutList(
9896
9997	private  static  <T > RecipeLayoutWithButtons <T > createRecipeLayoutWithButtons (
10098		IRecipeLayoutDrawable <T > recipeLayoutDrawable ,
101- 		RecipeBookmark <?, ?> recipeBookmark ,
99+ 		@ Nullable   RecipeBookmark <?, ?> recipeBookmark ,
102100		BookmarkList  bookmarks ,
103101		RecipesGui  recipesGui ,
104- 		@ Nullable  AbstractContainerMenu  container ,
105- 		@ Nullable  Player  player 
102+ 		@ Nullable  AbstractContainerMenu  container 
106103	) {
104+ 		Minecraft  minecraft  = Minecraft .getInstance ();
105+ 		Player  player  = minecraft .player ;
107106		RecipeTransferButton  transferButton  = RecipeTransferButton .create (recipeLayoutDrawable , recipesGui ::onClose , container , player );
108- 
109- 		RecipeBookmarkButton  bookmarkButton  = RecipeBookmarkButton .create (
110- 			recipeLayoutDrawable ,
111- 			bookmarks ,
112- 			recipeBookmark 
113- 		);
114- 
107+ 		RecipeBookmarkButton  bookmarkButton  = RecipeBookmarkButton .create (recipeLayoutDrawable , bookmarks , recipeBookmark );
115108		return  new  RecipeLayoutWithButtons <>(recipeLayoutDrawable , transferButton , bookmarkButton );
116109	}
117110
@@ -120,9 +113,8 @@ private IRecipeLayoutDrawable<T> createRecipeLayout(T recipe) {
120113	}
121114
122115	private  RecipeLayoutWithButtons <T > createRecipeLayoutWithButtons (IRecipeLayoutDrawable <T > recipeLayoutDrawable , IIngredientManager  ingredientManager ) {
123- 		RecipeTransferButton  transferButton  = RecipeTransferButton .create (recipeLayoutDrawable , recipesGui ::onClose , container , player );
124- 		RecipeBookmarkButton  bookmarkButton  = RecipeBookmarkButton .create (recipeLayoutDrawable , ingredientManager , bookmarkList );
125- 		return  new  RecipeLayoutWithButtons <>(recipeLayoutDrawable , transferButton , bookmarkButton );
116+ 		RecipeBookmark <T , ?> recipeBookmark  = RecipeBookmark .create (recipeLayoutDrawable , ingredientManager );
117+ 		return  createRecipeLayoutWithButtons (recipeLayoutDrawable , recipeBookmark , bookmarkList , recipesGui , container );
126118	}
127119
128120	@ Override 
0 commit comments