Jump to content

Help with standardizing recipes


skip999

Recommended Posts

Hello,

I am attempting to standardize some recipe types for a mod that I am working on improving. To keep a long story short, I am attempting to unify it's recipe system and ultimately integrate it into the Forge system**. However, this has lead me to an interesting predicament. Currently, I have three separate recipe classes that I am attempting to set up. They all take the same shape in their JSON file, but are for 3 separate machines. As a result, I would like to use the same Serializer for all three since they all use the same read and write methods. I attempted to use wildcards to solve the Class type specification that RecipeSerializers have, but it results in the following error when I attempt to load a world:

 

java.util.concurrent.ExecutionException: java.lang.NullPointerException: null key in entry

 

The most I am able to find online about this issue is about general HashMaps, but nothing in relation to Forge. Currently I am just trying to get the Serializer to work so I can get the others ready as well.

 

I have attached a link to the recipe JSONs as well as the location of the Recipe Classes on Github. I have also attached the full log regarding the crash. Any and all help would be appreciated

 

Recipe JSONS: https://github.com/skiprocks999/ElectrodynamcisExperimental/tree/main/src/main/resources/data/electrodynamics/recipes/o2o

Recipe Classes*: https://github.com/skiprocks999/ElectrodynamcisExperimental/tree/main/src/main/java/electrodynamics/common/recipe

 

*Please ignore the "MachineRecipes" and "RecipeManager" classes. These are part of the existing recipe system for the mod and are having no effect on the problem.

**Don't ask me why it was written the way it is to start with; I don't know either.

 

latest.log

Link to comment
Share on other sites

As far as I can tell, your recipe serializer class isn't.

That is, it's called a "recipe serializer", but it doesn't actually perform the required functions. Namely having the Read and Write methods defined by IRecipeSerializer to actually serialize and deserialize to/from json.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Okay so I realized the issue there: I was trying to downcast in Java like a moron. I have solved this issue, and I am still getting the error in the log. I have confirmed that the recipes are being read properly by the serializer, and that the correct Recipe types are being created. However, the same error is still being thrown, and I don't know why. I have attached the latest log, and I have provided links to the relevant classes.

 

Recipe Serializer Init : https://github.com/skiprocks999/ElectrodynamcisExperimental/blob/main/src/main/java/electrodynamics/common/recipe/ElectrodynamicsRecipeSerializer.java

Recipe Serializer: https://github.com/skiprocks999/ElectrodynamcisExperimental/blob/main/src/main/java/electrodynamics/common/recipe/categories/o2o/O2ORecipeSerializer.java

Recipe Categories: https://github.com/skiprocks999/ElectrodynamcisExperimental/tree/main/src/main/java/electrodynamics/common/recipe/categories/o2o/specificmachines

Ignore the same two classes as before. The JSON files haven't moved, but for the sake of ease of access, can be found here:

https://github.com/skiprocks999/ElectrodynamcisExperimental/tree/main/src/main/resources/data/electrodynamics/recipes/o2o

 

latest.log

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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