Railcraft

Railcraft

34M Downloads

[1.12.2] Rolling Machine recipes with certain layouts are displayed wrongly in JEI

3TUSK opened this issue ยท 1 comments

commented

Description of the Bug

Rolling Machine recipes with certain layouts are displayed wrongly in JEI.

To Reproduce

Add a rolling recipe like this

Crafters.rollingMachine().newRecipe(new ItemStack(Items.DIAMOND)).shaped(
                "D",
                "D",
                "D",
                'D', "stick");

Expected behavior

You see this or something similar in JEI

Screen Shot 2024-04-27 at 11 38 58 AM

Screenshots & Video

Right now you can only see this in JEI

Screen Shot 2024-04-27 at 11 44 45 AM

Logs & Environment

  • Minecraft 1.12.2
  • Railcraft 12.0.0
  • JEI 1.12.2-4.15.0.278

Additional context

Discovered while investigating Team-AbCiv/RailcraftTweaker#5 .

When you call ICraftingGridHelper.setInputs without providing recipe width and height, JEI will try guessing the correct dimension on its own. In particular, if a recipe has >=1 and <= 4 inputs, JEI will assume that this can fit in 2 * 2 grid, and arrange the slots based on this assumption.

Thus, when you have a 1 * 3 recipe, but don't tell JEI it is a 1 * 3 recipe, JEI will wrongly think that it is a 2 * 2 recipe and display wrong slot arrangements.

A proper fix requires one to pass the recipe width and height to JEI, but right now this information is hidden in multiple layers of wrappers, and many of those wrappers are private inner classes. Not sure what's the deal.