mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-28 07:55:59 +00:00
1 parent
3ce702343d
commit
1e36822fa4
19 files changed
+490
-9
No files matched your search
@@ -550,6 +550,35 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* First look up {@link RecipeCatalysts} whether target ingredient is registered for it.
|
||||
* If so, load all recipes for this handler.
|
||||
* Fallback to {@link TemplateRecipeHandler#getUsageHandler}.
|
||||
*/
|
||||
public IUsageHandler getUsageAndCatalystHandler(String inputId, Object... ingredients) {
|
||||
TemplateRecipeHandler handler = newInstance();
|
||||
if (inputId.equals("item")) {
|
||||
ItemStack candidate = (ItemStack) ingredients[0];
|
||||
if (RecipeCatalysts.containsCatalyst(handler.getClass(), candidate)) {
|
||||
for (RecipeTransferRect rect : transferRects) {
|
||||
if (specifyTransferRect() == null || Objects.equals(rect.outputId, specifyTransferRect())) {
|
||||
handler.loadCraftingRecipes(rect.outputId, rect.results);
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.getUsageHandler(inputId, ingredients);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this if you have multiple {@link RecipeTransferRect}s.
|
||||
* Used for {@link TemplateRecipeHandler#getUsageAndCatalystHandler}.
|
||||
*/
|
||||
public String specifyTransferRect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int numRecipes() {
|
||||
return arecipes.size();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user