This commit is contained in:
parent
2d9cdfbdc9
commit
0ddf6688c9
1 changed files with 9 additions and 6 deletions
|
@ -49,21 +49,24 @@ public record RebornRecipeType<R extends RebornRecipe>(
|
||||||
throw new RuntimeException("RebornRecipe type not supported!");
|
throw new RuntimeException("RebornRecipe type not supported!");
|
||||||
}
|
}
|
||||||
|
|
||||||
R recipe = newRecipe(recipeId);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
R recipe = newRecipe(recipeId);
|
||||||
|
|
||||||
if (!ConditionManager.shouldLoadRecipe(json)) {
|
if (!ConditionManager.shouldLoadRecipe(json)) {
|
||||||
recipe.makeDummy();
|
recipe.makeDummy();
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
recipe.deserialize(json);
|
recipe.deserialize(json);
|
||||||
|
return recipe;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
RebornCore.LOGGER.error("Failed to read recipe: " + recipeId, t);
|
||||||
RebornCore.LOGGER.error("Failed to read recipe: " + recipeId);
|
// Make a new recipe - don't reuse the existing recipe object because it might be in an invalid state if an
|
||||||
|
// exception was thrown in the middle of its deserialization.
|
||||||
|
R recipe = newRecipe(recipeId);
|
||||||
|
recipe.makeDummy();
|
||||||
|
return recipe;
|
||||||
}
|
}
|
||||||
return recipe;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonObject toJson(R recipe) {
|
public JsonObject toJson(R recipe) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue