Darkhax-Minecraft / BotanyPots

Adds some flower pots that can be used to grow various crops.
GNU Lesser General Public License v2.1
92 stars 71 forks source link

[BUG] [1.20.1] Inconsistent soil / crop behavior across similar .json recipes #394

Closed PaddedShaman closed 1 month ago

PaddedShaman commented 2 months ago

Minecraft Version

1.20.1

Mod Version

13.0.29

Mod Loader

Forge

What environment are you running the mod in?

All

Issue Description

I have defined 1 crop recipe along with 33 soil recipes, mirroring the way the vanilla recipes are defined. I've observed somewhat random inconsistencies in whether the soil/crop combination is recognized as a valid recipe in the in-game tooltips, whether the crop is rendered in the pot, and whether it produces any drops. Specifically, the following cases:

  1. Tooltips show valid recipe; crop is rendered in the pot; crop produces drops
  2. Tooltips show valid recipe; crop is rendered in the pot; crop does not produce drops and freezes at max growth
  3. Tooltips show valid recipe; crop is not rendered in the pot; crop produces drops
  4. Tooltips show invalid recipe; crop is rendered in the pot; crop produces drops
  5. Tooltips show invalid recipe; crop is not rendered in the pot; crop produces drops
  6. Tooltips show invalid recipe; crop is not rendered in the pot; crop does not produce drops

In all cases which render the crop and/or produce drops, the growth modifier works as defined in my .json files.

Originally, all of my soil recipes belonged to 1 custom category. Splitting the soil among 3 custom categories did not improve the inconsistency, only re-randomized which soils had which behavior. Launching a new instance or installing other mods sometimes also re-randomizes which soils have which behavior.

Attached is a screenshot attempting to visually demonstrate one instance of this behavior. Each soil with the crop was placed in a hopper botany pot which pushes into a barrel beneath, and the setup was allowed to grow for a sufficient duration. The comparators therefore indicate which pots are producing drops, and hopefully it is also visible which pots are rendering the crop.

This screenshot uses a modded bamboo crop (with no other mods installed), but I can confirm that the behavior is just as inconsistent when assigning a vanilla crop to the same soils with the same categories.

2024-05-09_00 07 23

The crop is defined as such:

blazing_bamboo.json

And here are three of the soil recipes as examples:

stone.json netherrack.json crimson_nylium.json

PaddedShaman commented 2 months ago

I reduced the number of defined soils to just 9, using only vanilla blocks and items, and I'm still getting this issue. Some recipes don't render the crop but still drop items, and other recipes render the crop but freeze at max growth. This time, only 3 out of 9 are fully working as expected, as opposed to 16 out of 33 in my original test.

Here's a screenshot that shows it doing this with vanilla bamboo:

2024-05-14_00 02 17

And here's the full datapack containing 1 crop (vanilla bamboo) and the 9 soils (vanilla blocks only):

bbbotanypotscompats.zip

Darkhax commented 1 month ago

Hello, this issue is caused by you creating conflicting recipes. An item should only ever map to one crop and/or one soil. All 9 of the soils in your example already exist. If you change them to wool blocks which are not used by any built-in soil all of the inconsistencies go away. I've included an example you can try. all_wool_ingredients.zip

If you want to add a new category to an existing soil you need to replace the existing soil. This can be done by creating a file with the same name and location inside your datapack, the same way you would modify any vanilla recipe or loot table.