Jump to content

Recommended Posts

Posted (edited)

I'm trying to switch my code over from using GameRegistry.addShaped/ShapelessRecipe() to the new 1.12 JSON files, but things aren't going well. I'm transitioning with just one of my items first, and once that works, I'll transition the rest.

For that one item, I've stopped calling addShapedRecipe(), and I've added a recipe file in assets/redplusplus/recipes based on one of the vanilla recipe files. Then, in the game, I've given myself all recipes with /recipe give @a * to ensure I've unlocked it. The strange thing is that the recipe does work--I can craft it perfectly--but it's not showing up in the recipe book itself. Is there an extra step I need to add it to the recipe book? I've seen a few topics lately about 1.12 recipes, but none have actually said anything more is needed beyond the .json file, so I'm lost now.

Here's the contents of the JSON file, called assets/redplusplus/recipes/diamond_pressure_plate.json:

{
  "type": "minecraft:crafting_shaped",
  "group": "redplusplus:diamond_pressure_plate",
  "pattern": [
    "DD"
  ],
  "key": {
    "D": {
      "item": "minecraft:diamond"
    }
  },
  "result": {
    "item": "redplusplus:diamond_pressure_plate",
	"data":0
  }
}


If the recipe works, why wouldn't it be added to the recipe book?

 

EDIT If it helps, here's the repo containing my project, with all its code and resources: https://github.com/IceMetalPunk/RedPlusPlus

Edited by IceMetalPunk
Added Github link

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

I'm fairly certain that the game adds recipes to the recipe book when a certain event happens, for instance, when you go into water.  I don't know for sure how you create and/or trigger such events in the code, but I'll look into it. 

[move]Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here Insert generic signature here[/move]

Posted
On 7/5/2017 at 5:20 PM, RandomMcSomethin said:

I'm fairly certain that the game adds recipes to the recipe book when a certain event happens, for instance, when you go into water.  I don't know for sure how you create and/or trigger such events in the code, but I'll look into it. 

Ohhhh, wait, that's right. They're only added through advancements, not by default, aren't they? That's a bit annoying, as it means I need to now figure out what states should unlock each of my recipes...or I could just leave it unlocked by default (I'm fairly sure I remember seeing an EntityPlayer method for that), though that then seems weird to have some advanced blocks/item recipes unlocked before the most basic recipes...

 

Hm, this recipe book is cool, but it's adding more logistics for modders to worry about xD I'll see what I can do about it, and either I'll figure it all out and mark this topic solved, or I'll come back asking for more help.

 

Thanks.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

Wait, no... it still doesn't work even if I unlock the recipe in the PlayerLoggedIn event. And when I think about it, that can't be the problem: even if I unlock all recipes with the /recipe give @a * command, and it says all recipes are successfully unlocked, it still doesn't show up in the recipe book, even though it can be crafted manually just fine. The advancements only control when the recipes are unlocked, so that can't be the issue.

So am I missing some step here?

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

I've been searching and pulling my hair out over this with no luck :(. Can anyone help figure this out? It's the only thing standing in the way of releasing my mod at this point.

 

Let's say I end up going back to using the GameRegistry#addShapedRecipe variants instead of json files; other than having the recipes always unlocked, are there any other drawbacks to it? Because I might just end up doing that unless there's a problem with it I'm missing.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

If you aren't on the latest Forge version already, I'd recommend updating. The json system had a lot of issues when the first beta of Forge 1.12 released and still has a few. You might find that updating will fix your issue.

  • Like 1
Posted
33 minutes ago, Leviathan143 said:

If you aren't on the latest Forge version already, I'd recommend updating. The json system had a lot of issues when the first beta of Forge 1.12 released and still has a few. You might find that updating will fix your issue.

Ah. I'll update and see if that helps (I'm currently using version 1.12-14.21.0.2349). Thanks for letting me know.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

Well, yay! Updating solved the issue; looks like it was an early Forge bug after all! :D Time to switch everything over to JSON files and then I can release my mod :)

Thank you, Leviathan, for your help!

Whatever Minecraft needs, it is most likely not yet another tool tier.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.