/
ItemDescriptionRecipeHandler.java
41 lines (34 loc) · 1.13 KB
/
ItemDescriptionRecipeHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package mezz.jei.plugins.jei.description;
import java.util.List;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.util.ErrorUtil;
import mezz.jei.util.Log;
public class ItemDescriptionRecipeHandler implements IRecipeHandler<ItemDescriptionRecipe> {
@Override
public Class<ItemDescriptionRecipe> getRecipeClass() {
return ItemDescriptionRecipe.class;
}
@Override
public String getRecipeCategoryUid() {
return VanillaRecipeCategoryUid.DESCRIPTION;
}
@Override
public String getRecipeCategoryUid(ItemDescriptionRecipe recipe) {
return VanillaRecipeCategoryUid.DESCRIPTION;
}
@Override
public IRecipeWrapper getRecipeWrapper(ItemDescriptionRecipe recipe) {
return recipe;
}
@Override
public boolean isRecipeValid(ItemDescriptionRecipe recipe) {
List<String> description = recipe.getDescription();
if (description.isEmpty()) {
String recipeInfo = ErrorUtil.getInfoFromRecipe(recipe, this);
Log.error("Recipe has no description text. {}", recipeInfo);
}
return true;
}
}