Fix recipe syncing, improve (add) error handling.

This commit is contained in:
modmuss50 2022-01-27 20:34:26 +00:00
parent bd6bcf55ab
commit fa657d46e8
24 changed files with 273 additions and 126 deletions

View file

@ -43,7 +43,7 @@ public class BlastFurnaceRecipeSerde extends RebornRecipeSerde<BlastFurnaceRecip
}
@Override
public void collectJsonData(BlastFurnaceRecipe recipe, JsonObject jsonObject) {
public void collectJsonData(BlastFurnaceRecipe recipe, JsonObject jsonObject, boolean networkSync) {
jsonObject.addProperty("heat", recipe.getHeat());
}
}

View file

@ -44,7 +44,7 @@ public class FusionReactorRecipeSerde extends RebornRecipeSerde<FusionReactorRec
}
@Override
protected void collectJsonData(FusionReactorRecipe recipe, JsonObject jsonObject) {
protected void collectJsonData(FusionReactorRecipe recipe, JsonObject jsonObject, boolean networkSync) {
jsonObject.addProperty("start-power", recipe.getStartEnergy());
jsonObject.addProperty("min-size", recipe.getMinSize());
}

View file

@ -7,12 +7,14 @@ import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ShapedRecipeHelper;
import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.crafting.serde.RebornRecipeSerde;
import techreborn.api.recipe.recipes.RollingMachineRecipe;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class RollingMachineRecipeSerde extends RebornRecipeSerde<RollingMachineRecipe> {
@Override
@ -23,8 +25,9 @@ public class RollingMachineRecipeSerde extends RebornRecipeSerde<RollingMachineR
}
@Override
public void collectJsonData(RollingMachineRecipe recipe, JsonObject jsonObject) {
jsonObject.add("shaped", recipe.getShapedRecipeJson());
public void collectJsonData(RollingMachineRecipe recipe, JsonObject jsonObject, boolean networkSync) {
final JsonObject shapedRecipeJson = networkSync ? ShapedRecipeHelper.rewriteForNetworkSync(recipe.getShapedRecipeJson()) : recipe.getShapedRecipeJson();
jsonObject.add("shaped", Objects.requireNonNull(shapedRecipeJson));
}
@Override
@ -40,7 +43,7 @@ public class RollingMachineRecipeSerde extends RebornRecipeSerde<RollingMachineR
}
@Override
protected void writeIngredients(RollingMachineRecipe recipe, JsonObject jsonObject) {
protected void writeIngredients(RollingMachineRecipe recipe, JsonObject jsonObject, boolean networkSync) {
}
@Override