Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

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.

  • Author

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

  • Author

Okay so I did some digging and finally found this forum post here:

I have fixed the issue and now my recipes are compiling. Thanks for the help none the less!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.