Custom Crafting Data Pack/JSON recipe integration?

Started by Cyndi4U on

Topic category: Help with modding (Data Packs)

Last seen on 04:12, 20. Sep 2023
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Crafting Data Pack/JSON recipe integration?
Thu, 02/03/2022 - 19:19 (edited)

Hi! I'm working on a mod that adds in a Spinning Wheel, which has a unique but ultimately simple crafting system: Right-click it with blocks/items, when it has enough to craft you keep right-clicking and it spins them. After right-clicking enough (or just has enough energy put into it by something that transfers/generates energy), it outputs an item stack of the result. Using procedures I've made it quite easy to make new recipes for myself, but I want you to be able to add in your own recipes with data packs or another mod like Crafttweaker. How would I go about this?

I'd imagine the JSON for the recipes would look something like this, based off of the JSON recipes of other mod's crafting systems:

{
  "type": "modname:spinning_wheel",
  "input": {
    "item": input,
    "amount": in_amount,
    "energy": energy_in
  },
  "output": {
    "item": {
      "item": output,
      "amount": out_amount
    },
  }
}

 

Edited by Cyndi4U on Thu, 02/03/2022 - 19:19
Last seen on 04:12, 20. Sep 2023
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, currently, my setup…
Sun, 05/30/2021 - 18:10

Also, currently, my setup for adding recipes using procedures is:

  1. Add in a new procedure and import the base recipe procedure and change the variables to match what I want the recipe to be
  2. Call the new recipe's procedure inside of the "SpinningWheelRightClicked" procedure.

This setup might make it hard to add JSON recipe support (if I can at all), but it might not, I'm not sure, ehehe.

Last seen on 23:21, 17. Jun 2022
Joined Apr 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can make your recipes…
Sun, 05/30/2021 - 19:49

You can make your recipes data-driven, but with the current way of doing recipes(procedures)

This is not possible without coding.

To make recipes data-driven, you need to create IRecipe<>, IRecipeType, and its serializer, then register them and have your crafting block detect it.

Last seen on 04:12, 20. Sep 2023
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm. Ok. Thank you!
Mon, 05/31/2021 - 05:03

Hmm. Ok. Thank you!

Last seen on 04:12, 20. Sep 2023
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, so admittedly... I'm a…
Tue, 06/01/2021 - 22:42

Ok, so admittedly... I'm a bit of a newbie when it comes to Java, and I have no idea how to approach doing this. I've looked through the code of some other non-mcreator mods that add in crafting systems on github to try to get a feel of what I need to be doing, but I honestly didn't get much out of it. Do you know how I would go about this, or maybe of a tutorial, whether in these forums or outside for general modding, that I might be able to follow for some direction?

Sorry to ask so much of you, ehehe.