File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import java .util .function .Function ;
1010
1111public class RecipeIndex implements IRecipeIndex {
12- private final TMBRuntime runtime ;
1312 protected final List <IRecipeCategory <?>> categories = new ArrayList <>();
1413 protected final List <String > hiddenCategories = new ArrayList <>();
1514 protected final Map <IRecipeCategory <?>, List <ITypedIngredient <?>>> catalysts = new HashMap <>();
1615 protected final Map <IRecipeCategory <?>, List <IRecipeTranslator <?>>> recipeLists = new HashMap <>();
1716 protected final Map <ILookupContext , List <Pair <IRecipeCategory <?>, IRecipeTranslator <?>>>> recipeLookupCache = new HashMap <>();
1817
1918 public RecipeIndex (TMBRuntime runtime ) {
20- this . runtime = runtime ;
19+
2120 }
2221
2322 protected void clear () {
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public static void onClientStart() {
7272 category1 .withComponent (new BooleanOptionComponent (TMBOptions .isRecipeViewEnabled ));
7373 OptionsPages .GENERAL .withComponent (category1 );
7474 loadTMB ();
75- runtime .index . gatherIngredients ();
75+ runtime .gatherIngredients ();
7676 }
7777
7878 @ Override
@@ -90,7 +90,7 @@ private static void loadTMB() {
9090 plugin .registerIngredientTypes (runtime );
9191 plugin .registerRecipeCategories (runtime );
9292 }
93- runtime .getRecipeIndex (). loadLists ();
93+ runtime .loadLists ();
9494 for (ITMBPlugin plugin : plugins ) {
9595 plugin .registerIngredients (runtime );
9696 plugin .registerRecipeCatalysts (runtime );
@@ -220,15 +220,15 @@ public static void reloadTMB() {
220220 clear ();
221221 gatherPlugins (true );
222222 loadTMB ();
223- runtime .index . gatherIngredients ();
223+ runtime .gatherIngredients ();
224224 }
225225
226226 public static void registerPlugin (ITMBPlugin plugin ) {
227227 plugins .add (plugin );
228228 }
229229
230230 public static ITMBRuntime getRuntime () {
231- if (!runtime .isReady ) {
231+ if (!runtime .isReady () ) {
232232 throw new IllegalStateException ("Attempt to get runtime before it is ready!" );
233233 }
234234 return runtime ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public class TMBRuntime implements ITMBRuntime {
3434 protected final GuiHelper guiHelper = new GuiHelper (this );
3535 public final List <ITypedIngredient <?>> favourites = new ArrayList <>();
3636 protected final Map <RecipeIngredient , IRecipeTranslator <?>> defaultRecipes = new HashMap <>();
37- protected final Map <Class <? extends Screen >, RecipeFiller > recipeFillers = new HashMap <>();
37+ protected final Map <Class <? extends Screen >, RecipeFiller <?, ?> > recipeFillers = new HashMap <>();
3838 protected boolean isReady ;
3939
4040 protected TMBRuntime () {
@@ -50,6 +50,19 @@ protected void clear() {
5050 recipeFillers .clear ();
5151 }
5252
53+ protected void gatherIngredients () {
54+ index .gatherIngredients ();
55+ }
56+
57+ protected void loadLists () {
58+ recipeIndex .loadLists ();
59+ }
60+
61+ @ Override
62+ public boolean isReady () {
63+ return isReady ;
64+ }
65+
5366 @ Override
5467 public void showRecipe (ILookupContext lookup ) {
5568 List <Pair <IRecipeCategory <?>, IRecipeTranslator <?>>> results = recipeIndex .searchRecipes (lookup );
@@ -117,7 +130,7 @@ public RecipeIndex getRecipeIndex() {
117130 }
118131
119132 @ Override
120- public Map <Class <? extends Screen >, RecipeFiller > getRecipeFillers () {
133+ public Map <Class <? extends Screen >, RecipeFiller <?, ?> > getRecipeFillers () {
121134 return recipeFillers ;
122135 }
123136
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public interface ITMBRuntime {
2727
2828 IRecipeIndex getRecipeIndex ();
2929
30- Map <Class <? extends Screen >, RecipeFiller > getRecipeFillers ();
30+ Map <Class <? extends Screen >, RecipeFiller <?, ?> > getRecipeFillers ();
3131
3232 void showRecipe (ILookupContext lookup );
3333
@@ -38,4 +38,6 @@ public interface ITMBRuntime {
3838 Map <RecipeIngredient , IRecipeTranslator <?>> getDefaultRecipes ();
3939
4040 List <ITypedIngredient <?>> getFavourites ();
41+
42+ boolean isReady ();
4143}
You can’t perform that action at this time.
0 commit comments