mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Compatibility with old configs
Add compatibility with old configs. If the newly added option is not read, it will be automatically written to the default value.
This commit is contained in:
parent
7473278dab
commit
3638ad475b
@ -159,12 +159,21 @@ public class CustomMachineConfigJSON {
|
||||
configuration.fluidOutCap = machineObject.get("fluidOutCap").getAsInt();
|
||||
configuration.itemOutCount = machineObject.get("itemOutCount").getAsInt();
|
||||
configuration.generatorMode = machineObject.get("generatorMode").getAsBoolean();
|
||||
configuration.maxPollutionCap = machineObject.get("maxPollutionCap").getAsInt();
|
||||
configuration.fluxMode = machineObject.get("fluxMode").getAsBoolean();
|
||||
if(machineObject.get("maxPollutionCap")!=null) {
|
||||
configuration.maxPollutionCap = machineObject.get("maxPollutionCap").getAsInt();
|
||||
}
|
||||
else configuration.maxPollutionCap = 0;
|
||||
if(machineObject.get("fluxMode")!=null) {
|
||||
configuration.fluxMode = machineObject.get("fluxMode").getAsBoolean();
|
||||
}
|
||||
else configuration.fluxMode = false;
|
||||
configuration.recipeSpeedMult = machineObject.get("recipeSpeedMult").getAsDouble();
|
||||
configuration.recipeConsumptionMult = machineObject.get("recipeConsumptionMult").getAsDouble();
|
||||
configuration.maxPower = machineObject.get("maxPower").getAsLong();
|
||||
configuration.maxHeat = machineObject.get("maxHeat").getAsInt();
|
||||
if(machineObject.get("maxHeat")!=null) {
|
||||
configuration.maxHeat = machineObject.get("maxHeat").getAsInt();
|
||||
}
|
||||
else configuration.maxHeat = 0;
|
||||
|
||||
if(machineObject.has("recipeShape") && machineObject.has("recipeParts")) {
|
||||
JsonArray recipeShape = machineObject.get("recipeShape").getAsJsonArray();
|
||||
|
||||
@ -79,14 +79,33 @@ public class CustomMachineRecipes extends SerializableRecipe {
|
||||
recipeInstance.outputItems = this.readItemStackArrayChance(rec.get("outputItems").getAsJsonArray());
|
||||
recipeInstance.duration = rec.get("duration").getAsInt();
|
||||
recipeInstance.consumptionPerTick = rec.get("consumptionPerTick").getAsInt();
|
||||
recipeInstance.pollutionMode = rec.get("pollutionMode").getAsBoolean();
|
||||
recipeInstance.pollutionType = rec.get("pollutionType").getAsString();
|
||||
recipeInstance.pollutionAmount = rec.get("pollutionAmount").getAsFloat();
|
||||
recipeInstance.radiationMode = rec.get("radiationMode").getAsBoolean();
|
||||
recipeInstance.radiationAmount = rec.get("radiationAmount").getAsFloat();
|
||||
recipeInstance.flux = rec.get("flux").getAsInt();
|
||||
recipeInstance.heat = rec.get("heat").getAsInt();
|
||||
|
||||
if(rec.get("pollutionMode")!=null) {
|
||||
recipeInstance.pollutionMode = rec.get("pollutionMode").getAsBoolean();
|
||||
recipeInstance.pollutionType = rec.get("pollutionType").getAsString();
|
||||
recipeInstance.pollutionAmount = rec.get("pollutionAmount").getAsFloat();
|
||||
}
|
||||
else {
|
||||
recipeInstance.pollutionMode = false;
|
||||
recipeInstance.pollutionType = "";
|
||||
recipeInstance.pollutionAmount = 0;
|
||||
}
|
||||
if(rec.get("radiationMode")!=null) {
|
||||
recipeInstance.radiationMode = rec.get("radiationMode").getAsBoolean();
|
||||
recipeInstance.radiationAmount = rec.get("radiationAmount").getAsFloat();
|
||||
}
|
||||
else {
|
||||
recipeInstance.radiationMode = false;
|
||||
recipeInstance.radiationAmount = 0;
|
||||
}
|
||||
if(rec.get("flux")!=null) {
|
||||
recipeInstance.flux = rec.get("flux").getAsInt();
|
||||
}
|
||||
else recipeInstance.flux = 0;
|
||||
if(rec.get("heat")!=null) {
|
||||
recipeInstance.heat = rec.get("heat").getAsInt();
|
||||
}
|
||||
else recipeInstance.heat = 0;
|
||||
list.add(recipeInstance);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user