Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] NeoForge DataComponentIngredient is no longer compatible with REI in 1.21.4 #1798

Open
4 of 7 tasks
AEAEAEAE4343 opened this issue Jan 19, 2025 · 0 comments
Open
4 of 7 tasks
Labels
bug Something isn't working

Comments

@AEAEAEAE4343
Copy link

AEAEAEAE4343 commented Jan 19, 2025

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:
Image
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
@AEAEAEAE4343 AEAEAEAE4343 added the bug Something isn't working label Jan 19, 2025
AEAEAEAE4343 pushed a commit to AEAEAEAE4343/LeetTechMod that referenced this issue Jan 19, 2025
Removed redundant ITextureGenerator.java
Removed redundant MachineUpgradeRecipe.java
Reworked ModRecipeProvider to support various predicate types
Created new recipe for tier 2 speed upgrade
REI item comparator for machine upgrade now takes into account fuzzy matching
TextureProvider.Entry is now static
Added a temporary testing recipe (see shedaniel/RoughlyEnoughItems#1798 for more info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant