[SOLVED] "Invalid crafting recipe" (noob error)

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

[SOLVED] "Invalid crafting recipe" (noob error)

by taikedz » Thu Jul 28, 2016 11:47

Hello

I'm trying to add some useful things to do with some craft items that have no recipes, so trying to define my own separate mod to do so.

I have created a myrecipes/ dir in which I have this depends.txt

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
mobs
mobs_zombie
mobs_slimes


and this init.lua:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cslime = "mobs_slimes:green_slimeball"
zflesh = "mobs_zombie:rotten_flesh"

minetest.register_craft({
        output = "mobs:meat_raw",
        type = "shapeless",
        recipe = {
                {cslime,cslime,cslime},
                {zflesh,zflesh,zflesh},
        }
})


On trying to load the game with the associated dependencies, I get

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Invalid crafting recipe (out="mobs:meat_raw")


I've gone over this a few times now and cannot spot the mistake I am making.... I tried speciying output = ":mobs:meat_raw" but that still errors. I tried also using default:wood, which errors.

I have done some crafting recipes elsewhere which work and I see no obvious differences - so why is it not working here?
Last edited by taikedz on Fri Jul 29, 2016 11:26, edited 1 time in total.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: "Invalid crafting recipe" (noob error?)

by Krock » Thu Jul 28, 2016 13:52

For the shapeless type you don't need to specify each row of the crafting grid. It also crashes Minetest instantly here.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_craft({
        output = "mobs:meat_raw",
        type = "shapeless",
        recipe = {
                cslime,cslime,cslime,
                zflesh,zflesh,zflesh
        }
})
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: "Invalid crafting recipe" (noob error?)

by KCoombes » Thu Jul 28, 2016 13:55

taikedz wrote:-snip-

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cslime = "mobs_slimes:green_slimeball"
zflesh = "mobs_zombie:rotten_flesh"

minetest.register_craft({
        output = "mobs:meat_raw",
        type = "shapeless",
        recipe = {
                {cslime,cslime,cslime},
                {zflesh,zflesh,zflesh},
        }
})


Any particular reason you're using {cslime,cslime,cslime}, rather than {"mobs_slimes:green_slimeball","mobs_slimes:green_slimeball","mobs_slimes:green_slimeball"}, ?
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: "Invalid crafting recipe" (noob error?)

by taikedz » Thu Jul 28, 2016 17:08

Krock wrote:For the shapeless type you don't need to specify each row of the crafting grid.


That was the problem exactly. Though that's a very misleading error message! Never would have figured that one out. Thanks Krock

KCoombes wrote:Any particular reason you're using {cslime,cslime,cslime}, rather than {"mobs_slimes:green_slimeball","mobs_slimes:green_slimeball","mobs_slimes:green_slimeball"}, ?


DRY principle? Conciseness? Clarity? Ocular parsing facilitation?

Why would you not?
 

User avatar
everamzah
Member
 
Posts: 490
Joined: Thu Jan 29, 2015 00:47
GitHub: everamzah
IRC: everamzah
In-game: everamzah

Re: "Invalid crafting recipe" (noob error?)

by everamzah » Thu Jul 28, 2016 17:16

You're creating local variables for strings that are accessed only once during load-time, though I believe this is trivial.

Edit: On second look, they're actually global variables.

Ps. What's the DRY principle?
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: "Invalid crafting recipe" (noob error?)

by Byakuren » Thu Jul 28, 2016 22:42

everamzah wrote:You're creating local variables for strings that are accessed only once during load-time, though I believe this is trivial.

Edit: On second look, they're actually global variables.

Ps. What's the DRY principle?

"Don't Repeat Yourself"

I do this too when strings are long and used several times in the same recipe.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: "Invalid crafting recipe" (noob error?)

by taikedz » Fri Jul 29, 2016 11:27

everamzah wrote:Edit: On second look, they're actually global variables.


I keep forgetting that they're global by default. Thanks
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron