Just Enough Resources (JER)

Just Enough Resources (JER)

163M Downloads

[REQUEST] Detection of more modded crops via JER

Sunconure11 opened this issue ยท 2 comments

commented

A recent pull brought this to light.

IMO, Rustic, Harvestcraft and Growthcraft should all have support via JER for their crops.

commented

I can't immediately think of a way to "detect" plants/crops. The mods could add support themselves via the API.

I am open to add a "detection/discover" method, if not too hacky ofc.

commented

@way2muchnoise I figured out 4 ways to do it so far:

  • Rip ThermalExpansion's code that registers crop output using RegEx to transform whatever you can to your own code's crop registering format.
    • Pros
      • Follows your code's existing crop registering format.
      • Your mod will support a lot of popular mod crops.
    • Cons
      • A lot of tedious, mind-numbing work.
      • Must monitor mod code repositories for crop additions and changes and add entries for new crops that pop up yourself.
  • Use ThermalExpansion's InsolatorManager.getRecipe directly to figure out what's the final Item of each mod crop.
    • Pros
      • Less work than the method above.
      • Your code will automatically work with new crops as ThermalExpansion adds them so no need to monitor code repositories of other mods.
    • Cons
      • Your mod now depends on ThermalExpansion.
      • You still need to manually add crop entries for mods that ThermalExpansion doesn't support.
      • You still need to write code to add entries for crops that ThermalExpansion doesn't support if you want to support them.
  • Get all items that extend net.minecraft.block.BlockCrops and call their getCrop() method.
    • Pros
      • Automatically works with all existing and new mods that add crops extending Minecraft's BlockCrops class.
      • No maintenance needed for new crops.
      • Don't need to manually register Minecraft crops anymore.
    • Cons
      • Doesn't work with any crop that doesn't extend from BlockCrops so manual compatibility with those mods must be added.
  • Add an interface that other mods must implement to for crop support.
    • Pros
      • You literally need to do 0 work except for adding Minecraft's crops and creating the API. Other mod devs are responsible for maintaining compatibility with your mod.
      • You can make a pull request on other mod repos to implement your interface on other mods' crops. It's mostly their problem to maintain support after your pull request is accepted (if it's accepted).
    • Cons
      • Good luck convincing other mod developers to accept your pull request or implement your interface.

I would personally go with a mixture of 3 & 4. Make an interface (and tell other mod devs it exists) so other mod devs that are proactive can add support for your mod themselves, and do number 3 for mod devs that are unwilling to work with you or are unresponsive.