mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-21 04:22:26 +00:00
Fixed an API issue, fixed Robit nametag not updating, fixed Sorter Mod ID filter bugginess
This commit is contained in:
1 parent
269343f9f0
commit
b2e676aabb
7 files changed
+11
-17
No files matched your search
@@ -0,0 +1,60 @@
|
||||
package mekanism.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
import buildcraft.api.fuels.IronEngineFuel.Fuel;
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
|
||||
public class FuelHandler
|
||||
{
|
||||
public static HashMap<String, FuelGas> fuels = new HashMap<String, FuelGas>();
|
||||
|
||||
public static void addGas(Gas gas, int burnTicks, double energyPerMilliBucket)
|
||||
{
|
||||
fuels.put(gas.getName(), new FuelGas(burnTicks, energyPerMilliBucket));
|
||||
}
|
||||
|
||||
public static FuelGas getFuel(Gas gas)
|
||||
{
|
||||
if(fuels.containsKey(gas.getName()))
|
||||
{
|
||||
return fuels.get(gas.getName());
|
||||
}
|
||||
|
||||
if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuels") && gas.hasFluid())
|
||||
{
|
||||
Fuel bcFuel = IronEngineFuel.getFuelForFluid(gas.getFluid());
|
||||
|
||||
if(bcFuel != null)
|
||||
{
|
||||
FuelGas fuel = new FuelGas(bcFuel);
|
||||
fuels.put(gas.getName(), fuel);
|
||||
|
||||
return fuel;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class FuelGas
|
||||
{
|
||||
public int burnTicks;
|
||||
public double energyPerTick;
|
||||
|
||||
public FuelGas(int duration, double energyDensity)
|
||||
{
|
||||
burnTicks = duration;
|
||||
energyPerTick = energyDensity / duration;
|
||||
}
|
||||
|
||||
public FuelGas(Fuel bcFuel)
|
||||
{
|
||||
burnTicks = bcFuel.totalBurningTime / FluidContainerRegistry.BUCKET_VOLUME;
|
||||
energyPerTick = bcFuel.powerPerCycle * Mekanism.FROM_BC;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user