Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Replacements do not work in quick crafting #92

Open
GreenDirkfried opened this issue Feb 17, 2023 · 6 comments
Open

Replacements do not work in quick crafting #92

GreenDirkfried opened this issue Feb 17, 2023 · 6 comments
Labels
bug Something isn't working upstream issue

Comments

@GreenDirkfried
Copy link

When a recipe has a replacement defined, like for example the replacement of a bucket with water with an empty bucket (see for example the hemp fibre recipe in farming), then quick crafting does not give you this new item (e.g. the empty bucket) :-/

@GreenDirkfried GreenDirkfried changed the title Replacements does not work in quick crafting Replacements do not work in quick crafting Feb 17, 2023
@kilbith
Copy link
Collaborator

kilbith commented Feb 17, 2023

Please follow the issue template.

It was supposedly fixed in #87

@GreenDirkfried
Copy link
Author

GreenDirkfried commented Feb 17, 2023

Ok, I understand now that the bug is maybe another mods fault.

To reproduce:
Use the latest MT release 5.6.1 and the currently latest versions of all of the following the mods from the minetest database.
Use Minetest Game with the mods: i3,
Farming Redo,
HUD bars,
Hunger with HUD bar,
Armor HUD bar.

Then craft a "Hemp Fibre" per quick crafting, where the crafting recipe is given in https://notabug.org/TenPlus1/farming/src/master/crops/hemp.lua#L77

minetest.register_craft( {
	output = "farming:hemp_fibre 8",
	recipe = {
		{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
		{"farming:hemp_leaf", "group:water_bucket", "farming:hemp_leaf"},
		{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
	},
	replacements = {{"group:water_bucket", "bucket:bucket_empty"}}
})

The problem is now that there is no empty bucket left.

@kilbith
Copy link
Collaborator

kilbith commented Mar 5, 2023

Can you try this? c9e02df

@kilbith kilbith added the bug Something isn't working label Mar 5, 2023
@kilbith
Copy link
Collaborator

kilbith commented Mar 5, 2023

To get the replacements from Quick Crafting safely, you have to declare your recipes after i3 has loaded in the mod initialization order. If your mod is named after "i" or have a dependency with i3, the replacements will work.

The problem is that craft recipe getters do not return replacements and I'm forced to override core.register_craft from i3 to create an index of replacements per recipe.

@GreenDirkfried
Copy link
Author

I updated i3 from the database (your new commit is included there) and tried the quick crafting again as described before and it still does not work.

@GreenDirkfried
Copy link
Author

Adding "i3" to the optional dependencies of farming solves the issue :-)
But, sure, this replacement problem should not be solved by adding dependencies :-D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working upstream issue
Projects
None yet
Development

No branches or pull requests

2 participants