How to overridr default item's recipe?

Post Reply
User avatar
linushsao
Member
Posts: 418
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus
Location: Taipei,Taiwan(R.O.C)
Contact:

How to overridr default item's recipe?

by linushsao » Post

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:

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
Developer
Posts: 2132
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: How to overridr default item's recipe?

by sofar » Post

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/bl ... .txt#L1815

User avatar
rubenwardy
Moderator
Posts: 6364
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: How to overridr default item's recipe?

by rubenwardy » Post

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: 418
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus
Location: Taipei,Taiwan(R.O.C)
Contact:

Re: How to overridr default item's recipe?

by linushsao » Post

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 » Post

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
.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest