
[Bug] NeoForge DataComponentIngredient is no longer compatible with REI in 1.21.4
AEAEAEAE4343 opened this issue ยท 1 comments
What happened?
I am developing a mod for Minecraft 1.21.4. I implemented some recipes which use the NeoForge built-in DataComponentIngredient. After two days of scratching my head about why this didn't work, I discovered an issue with REI in 1.21.4, which did not exist in earlier versions.
I have made a simple test case with vanilla items and data components. A simple datapack can be used to test it, no mod is required except REI. The test recipe converts a sharpness IV book into a dirt block.
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"B": {
"type": "neoforge:components",
"components": {
"minecraft:stored_enchantments": {
"levels": {
"minecraft:sharpness": 4
}
}
},
"items": "minecraft:enchanted_book",
"strict": false
}
},
"pattern": [
" ",
" ",
" B"
],
"result": {
"count": 1,
"id": "minecraft:dirt"
}
}
(Note: for 1.21.4, "type" is now "neoforge:ingredient_type")
I loaded this recipe into both of these environments:
- 1.21.1 + NeoForge 21.1.93 + 16.0.788
- 1.21.4 + NeoForge 21.4.50 + 18.0.796
The result is the following:
Screenshot of 1.21.1 vs 1.21.4:
As you can see in the screenshot, the recipe no longer works in 1.21.4. The DataComponentingredient (enchanted book) is not displayed and the + button does nothing. The recipe does work in the vanilla recipe book, both for 1.21.1 and 1.21.4.
What mod loaders are you seeing the problem on?
Forge
What do you think this bug is of?
- Visual
- Recipe Lookup
- Cheat Mode
- Plugin Integration / JEI Plugin Compatibility
- Others
Relevant log output
https://gist.github.com/AEAEAEAE4343/ba5a6b800f2e6445ea86e1e3282e910f
Anything else?
I have done some debugging myself and I have found that this is probably caused by EntryIngredient.ofIngredient(Ingredient ingredient)
. Minecraft's Ingredient class no longer has a getItems function, so REI uses Ingredient.values
. This is a Holder<Item>, which for custom NeoForge ingredients have no entries. A potential solution could be implementing explicit support for the NeoForge ICustomIngredient interface. But I do not know how that could be ported to other modloaders.
By submitting this issue, I have included the necessary logs by pasting the contents into the correct location or attaching the file as an upload.
- Yes, and I did not use any paste services other than GitHub Gists.
By submitting this issue, I have confirmed my REI and REI's dependencies are up to date.
- Yes