Bugfix for autocrafters (#60)

* Update AutoCraftingStorage.java
This commit is contained in:
ceze88 2021-12-18 14:36:19 +01:00 committed by GitHub
parent f109d4cee0
commit e1532d4116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,10 @@ public class AutoCraftingStorage extends AbstractStorage implements Configuratio
@Override @Override
protected void deserialize(Map<String, Object> map) { protected void deserialize(Map<String, Object> map) {
recipeSerializable = (RecipeSerializable) map.get("recipe"); recipeSerializable = (RecipeSerializable) map.get("recipe");
recipeSerializable.updateRecipe(getOwner().getPlayer()); //If autocraft doesn't have a recipe in it it will be throw a NPE, this check seems to be working. Also the exception caused data loss in the data file
if (recipeSerializable != null) {
recipeSerializable.updateRecipe(getOwner().getPlayer());
}
identifier = (String) map.get("identifier"); identifier = (String) map.get("identifier");
initInventory(); initInventory();
} }