Jump to content

Recommended Posts

I'm trying to make a custom recipe that uses a custom ingredient. The ingredient shows up fine in the inventory but when I attempt to use the same image for it to show up in the crafting recipe it doesn't. The recipe just shows a blank box.

Here's my code

local rainbowfeather = GLOBAL.Ingredient( "rainbowfeather", 1)
rainbowfeather.atlas = "images/inventoryimages/inventoryfeatherrainbow.xml"

local silverfeather = GLOBAL.Ingredient( "silverfeather", 1)
silverfeather.atlas = "images/inventoryimages/inventoryfeathersilver.xml"

local clbl = AddRecipe("clbl", { rainbowfeather, silverfeather, Ingredient("goldnugget", 2) }, RecipeTabs.MAGIC, Tech.NONE)
clbl.atlas = "images/inventoryimages/clbl.xml"


 

 

 

Edited by Eusong

Does it works if you do this this way ?

 


		local myprefab = AddRecipe("myprefab", {Ingredient("yellowgem", 1), Ingredient("twigs", 5), Ingredient("customingredient", 2, "images/inventoryimages/customingredient.xml", "customingredient")  }, RECIPETABS.MAGIC, TECH.MAGIC_THREE, nil, nil, nil, nil, nil,  "images/inventoryimages/myprefab.xml", "myprefab.tex" )

 

Do

local rainbowfeather = GLOBAL.Ingredient("rainbowfeather", 1)
rainbowfeather.atlas = GLOBAL.resolvefilepath("images/inventoryimages/inventoryfeatherrainbow.xml")

or

local rainbowfeather = GLOBAL.Ingredient("rainbowfeather", 1, "images/inventoryimages/inventoryfeatherrainbow.xml")

or

local rf_atlas = "images/inventoryimages/inventoryfeatherrainbow.xml"
local rainbowfeather = GLOBAL.Ingredient("rainbowfeather", 1, rf_atlas)

 

Whatever is most visually pleasing. But the resolvefilepath function has to go somewhere.

The Ingredient class constructor applies it to its atlas argument.

Same for the recipe.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...