How to overridr default item's recipe?

User avatar
linushsao
Member
 
Posts: 331
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus

How to overridr default item's recipe?

by linushsao » Wed Mar 23, 2016 00:17

i had read minetest wiki & rubenwardy's modding book,one line said" To override, you prefix the item string with a colon, :. Declaring an item as :default:dirt will override the default:dirt in the default mod."

i try to change default:chest's recipe,so i create my new mod and init.lua inside. following code for test:

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 = ':default:chest',
   recipe = {
      {'default:paper', 'default:paper'},
      {'default:paper', 'default:paper'},
      {'default:paper', 'default:paper'},
   }
})


i check by command " /mods " to make sure my mod has been loaded and seems no error msg,but i check recipe by craftguide mod, default:chest still not change.do i miss understand something?(do i have to edit minetest's default mod's crafting.lua and recomplie minetest?...@@a)
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: How to overridr default item's recipe?

by sofar » Wed Mar 23, 2016 06:57

you want to use minetest.override instead, so that most of the properties and methods of the chest are maintained.

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1815
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: How to overridr default item's recipe?

by rubenwardy » Wed Mar 23, 2016 16:24

Sofar misread the question. There is currently no good way of overriding or deleting a recipe. Prefixing with a colon only works when registering an item, not when registering a craft recipe.

The best way is do copy the old recipe, then set the output to zero, ie

output="default:chest 0"

Then register a new recipe to make the item.
 

User avatar
linushsao
Member
 
Posts: 331
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus

Re: How to overridr default item's recipe?

by linushsao » Fri Mar 25, 2016 03:11

sofar & rubenwardy,tks for ur reply.

i think maybe it's the solution to download minetest's(&minetest_games) source ,edit the game mods, and recompile minetestserver? i'll try.
 

User avatar
oleastre
Member
 
Posts: 81
Joined: Wed Aug 13, 2014 21:39
GitHub: oleastre
In-game: oleastre

Re: How to overridr default item's recipe?

by oleastre » Fri Mar 25, 2016 09:00

You only need to edit the minetest_game mods.
Nothing to change in the server source code; and so, you don't have to recompile minetestserver.

Just launch your world after you've done your changes.

And a simple advice: if you change minetest_game, prefer creating your own game (you just have to rename the folder and update game.conf). This will allow you to compare it to new versions of the original minetest_game
.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron