lsyanling Posted October 14, 2023 Share Posted October 14, 2023 There is a mod which is developed years ago, and old Recipe APIs were applied to the mod. Now, I am planning to migrate this mod to the new Recipe APIs, but during the migration process, I encountered some issues. As the follow figure: The first Tab is created as the follow code: GLOBAL.RECIPETABS['FHL'] = {str = "FHL", sort=10, icon = "fhltab.tex", icon_atlas = "images/inventoryimages/fhltab.xml", "fhl"} Yes, the mod adopts the old APIs for RecipeTab, and I tried to migrate with the code: local filter_def = { name = "FHLL", atlas = "images/inventoryimages/fhl_cake2.xml", image = "fhl_cake2.tex" } recipeFilter = AddRecipeFilter(filter_def) And then I invoke the AddRecipe2, it produce a cake with three logs: AddRecipe2("fhl_cake24", {Ingredient("log", 3)}, TECH.NONE, {product="fhl_cake2", image="fhl_cake2.tex"}, {"FHLL"}) Then the code create the last Tab: However, when I select the last Tab: The figures may be obscure, but try to understand. My question is, what caused this issue, image? filter? or others? Besides, I tried to default the filter, and when I select the Mod Item(the red arrow), the recipe can be found: As you seen in the figure, (the blue arrow) the recipe lose its image. But I really have set the image of the recipe. So what should I take into account? Link to comment Share on other sites More sharing options...
ClumsyPenny Posted October 14, 2023 Share Posted October 14, 2023 After a cursory look through the code, it looks like you need to set a string for your filter. Just adding this to modmain should do the trick: GLOBAL.STRINGS.UI.CRAFTING_FILTERS.FHLL = "FHLL" -- Change this to whatever you want! Link to comment Share on other sites More sharing options...
lsyanling Posted October 15, 2023 Author Share Posted October 15, 2023 15 hours ago, ariadnesGambit said: After a cursory look through the code, it looks like you need to set a string for your filter. Just adding this to modmain should do the trick: GLOBAL.STRINGS.UI.CRAFTING_FILTERS.FHLL = "FHLL" -- Change this to whatever you want! It is amazing, you are right. Thanks a lot. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now