Fixed fluid power value importing

This commit is contained in:
Modmuss50 2015-09-14 21:34:56 +01:00
parent 62f68bb5b7
commit bd1540b27b
2 changed files with 10 additions and 12 deletions

View file

@ -83,7 +83,7 @@ public class RecipesBuildcraft implements ICompatModule {
removeRecipes(); removeRecipes();
addRecipies(); addRecipies();
for(IFuel fuel : buildcraft.energy.fuels.FuelManager.INSTANCE.getFuels()){ for(IFuel fuel : buildcraft.energy.fuels.FuelManager.INSTANCE.getFuels()){
FluidPowerManager.fluidPowerValues.put(fuel.getFluid(), (double) (fuel.getPowerPerCycle() / fuel.getTotalBurningTime()) * ConfigTechReborn.euPerRF); FluidPowerManager.fluidPowerValues.put(fuel.getFluid(), (double) fuel.getPowerPerCycle() / ConfigTechReborn.euPerRF);
} }
} }

View file

@ -10,6 +10,7 @@ import forestry.core.config.ForestryBlock;
import ic2.api.item.IC2Items; import ic2.api.item.IC2Items;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@ -20,6 +21,8 @@ import techreborn.compat.ICompatModule;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import java.rmi.UnexpectedException; import java.rmi.UnexpectedException;
import java.util.Iterator;
import java.util.Map;
public class RecipesForestry implements ICompatModule { public class RecipesForestry implements ICompatModule {
@Override @Override
@ -271,17 +274,12 @@ public class RecipesForestry implements ICompatModule {
@Override @Override
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) {
for(Object fuel : FuelManager.generatorFuel.entrySet().toArray()){ Iterator entries = FuelManager.generatorFuel.entrySet().iterator();
if(fuel instanceof GeneratorFuel){ while (entries.hasNext()) {
GeneratorFuel generatorFuel = (GeneratorFuel) fuel; Map.Entry thisEntry = (Map.Entry) entries.next();
FluidPowerManager.fluidPowerValues.put(generatorFuel.fuelConsumed.getFluid(), (double) (generatorFuel.eu / generatorFuel.rate)); Fluid fluid = (Fluid) thisEntry.getKey();
} else { GeneratorFuel generatorFuel = (GeneratorFuel) thisEntry.getValue();
try { FluidPowerManager.fluidPowerValues.put(fluid, (double) (generatorFuel.eu / generatorFuel.rate));
throw new UnexpectedException(fuel + " should be an instace of GeneratorFuel");
} catch (UnexpectedException e) {
e.printStackTrace();
}
}
} }
} }