mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 12:19:55 +00:00
Updated Build Craft API to v6.1.5. NB: EIO will no longer work with pre 6.1 BC versions
This commit is contained in:
1 parent
1dd0add667
commit
770e2ed823
12 files changed
+284
-131
No files matched your search
@@ -17,8 +17,6 @@ import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import buildcraft.api.fuels.IronEngineCoolant;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@@ -62,6 +60,7 @@ import crazypants.enderio.enderface.ItemEnderface;
|
||||
import crazypants.enderio.fluid.BlockFluidEio;
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.fluid.ItemBucketEio;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.item.ItemConduitProbe;
|
||||
import crazypants.enderio.item.ItemMagnet;
|
||||
import crazypants.enderio.item.ItemRecipes;
|
||||
@@ -424,29 +423,25 @@ public class EnderIO {
|
||||
f = new Fluid(Fluids.HOOTCH_NAME).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidHootch = FluidRegistry.getFluid(f.getName());
|
||||
blockHootch = BlockFluidEio.create(fluidHootch, Material.water);
|
||||
IronEngineFuel.addFuel(Fluids.HOOTCH_NAME, Config.hootchPowerPerCycle, Config.hootchPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.HOOTCH_NAME + "@" + (Config.hootchPowerPerCycle * Config.hootchPowerTotalBurnTime));
|
||||
blockHootch = BlockFluidEio.create(fluidHootch, Material.water);
|
||||
FluidFuelRegister.instance.addFuel(f, Config.hootchPowerPerCycleRF, Config.hootchPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.HOOTCH_NAME + "@" + (Config.hootchPowerPerCycleRF/10 * Config.hootchPowerTotalBurnTime));
|
||||
|
||||
f = new Fluid(Fluids.ROCKET_FUEL_NAME).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidRocketFuel = FluidRegistry.getFluid(f.getName());
|
||||
blockRocketFuel = BlockFluidEio.create(fluidRocketFuel, Material.water);
|
||||
IronEngineFuel.addFuel(Fluids.ROCKET_FUEL_NAME, Config.rocketFuelPowerPerCycle, Config.rocketFuelPowerTotalBurnTime);
|
||||
FluidFuelRegister.instance.addFuel(f, Config.rocketFuelPowerPerCycleRF, Config.rocketFuelPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.ROCKET_FUEL_NAME + "@"
|
||||
+ (Config.rocketFuelPowerPerCycle * Config.rocketFuelPowerTotalBurnTime));
|
||||
+ (Config.rocketFuelPowerPerCycleRF/10 * Config.rocketFuelPowerTotalBurnTime));
|
||||
|
||||
f = new Fluid(Fluids.FIRE_WATER_NAME).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidFireWater = FluidRegistry.getFluid(f.getName());
|
||||
blockFireWater = BlockFluidEio.create(fluidFireWater, Material.lava);
|
||||
IronEngineFuel.addFuel(Fluids.FIRE_WATER_NAME, Config.fireWaterPowerPerCycle, Config.fireWaterPowerTotalBurnTime);
|
||||
FluidFuelRegister.instance.addFuel(f, Config.fireWaterPowerPerCycleRF, Config.fireWaterPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.FIRE_WATER_NAME + "@"
|
||||
+ (Config.fireWaterPowerPerCycle * Config.fireWaterPowerTotalBurnTime));
|
||||
|
||||
if(!IronEngineCoolant.isCoolant(FluidRegistry.getFluid("water"))) {
|
||||
IronEngineCoolant.addCoolant(FluidRegistry.getFluid("water"), 0.0023F);
|
||||
}
|
||||
+ (Config.fireWaterPowerPerCycleRF/10 * Config.fireWaterPowerTotalBurnTime));
|
||||
|
||||
fluidXpJuice = FluidRegistry.getFluid("xpjuice");
|
||||
if(!Loader.isModLoaded("OpenBlocks")) {
|
||||
|
||||
@@ -209,11 +209,11 @@ public final class Config {
|
||||
|
||||
public static float darkSteelAnvilDamageChance = 0.024f;
|
||||
|
||||
public static int hootchPowerPerCycle = 6;
|
||||
public static int hootchPowerPerCycleRF = 60;
|
||||
public static int hootchPowerTotalBurnTime = 6000;
|
||||
public static int rocketFuelPowerPerCycle = 16;
|
||||
public static int rocketFuelPowerPerCycleRF = 160;
|
||||
public static int rocketFuelPowerTotalBurnTime = 7000;
|
||||
public static int fireWaterPowerPerCycle = 8;
|
||||
public static int fireWaterPowerPerCycleRF = 80;
|
||||
public static int fireWaterPowerTotalBurnTime = 15000;
|
||||
public static int vatPowerUserPerTickRF = 20;
|
||||
|
||||
@@ -757,18 +757,18 @@ public final class Config {
|
||||
|
||||
darkSteelAnvilDamageChance = (float) config.get(sectionDarkSteel.name, "darkSteelAnvilDamageChance", darkSteelAnvilDamageChance, "Chance that the dark steel anvil will take damage after repairing something.").getDouble();
|
||||
|
||||
hootchPowerPerCycle = config.get(sectionPower.name, "hootchPowerPerCycle", hootchPowerPerCycle,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(hootchPowerPerCycle);
|
||||
hootchPowerPerCycleRF = config.get(sectionPower.name, "hootchPowerPerCycleRF", hootchPowerPerCycleRF,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 30, BC Fuel = 60").getInt(hootchPowerPerCycleRF);
|
||||
hootchPowerTotalBurnTime = config.get(sectionPower.name, "hootchPowerTotalBurnTime", hootchPowerTotalBurnTime,
|
||||
"The total burn time. Examples: BC Oil = 5000, BC Fuel = 25000").getInt(hootchPowerTotalBurnTime);
|
||||
|
||||
rocketFuelPowerPerCycle = config.get(sectionPower.name, "rocketFuelPowerPerCycle", rocketFuelPowerPerCycle,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(rocketFuelPowerPerCycle);
|
||||
rocketFuelPowerPerCycleRF = config.get(sectionPower.name, "rocketFuelPowerPerCycleRF", rocketFuelPowerPerCycleRF,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(rocketFuelPowerPerCycleRF);
|
||||
rocketFuelPowerTotalBurnTime = config.get(sectionPower.name, "rocketFuelPowerTotalBurnTime", rocketFuelPowerTotalBurnTime,
|
||||
"The total burn time. Examples: BC Oil = 5000, BC Fuel = 25000").getInt(rocketFuelPowerTotalBurnTime);
|
||||
|
||||
fireWaterPowerPerCycle = config.get(sectionPower.name, "fireWaterPowerPerCycle", fireWaterPowerPerCycle,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(fireWaterPowerPerCycle);
|
||||
fireWaterPowerPerCycleRF = config.get(sectionPower.name, "fireWaterPowerPerCycleRF", fireWaterPowerPerCycleRF,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 30, BC Fuel = 60").getInt(fireWaterPowerPerCycleRF);
|
||||
fireWaterPowerTotalBurnTime = config.get(sectionPower.name, "fireWaterPowerTotalBurnTime", fireWaterPowerTotalBurnTime,
|
||||
"The total burn time. Examples: BC Oil = 5000, BC Fuel = 25000").getInt(fireWaterPowerTotalBurnTime);
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package crazypants.enderio.fluid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.api.fuels.IFuel;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
|
||||
public class FluidFuelRegister {
|
||||
|
||||
public static final FluidFuelRegister instance = new FluidFuelRegister();
|
||||
|
||||
private final Map<String, IFluidCoolant> coolants = new HashMap<String, IFluidCoolant>();
|
||||
private final Map<String, IFluidFuel> fuels = new HashMap<String, IFluidFuel>();
|
||||
|
||||
private FluidFuelRegister() {
|
||||
addCoolant(FluidRegistry.WATER, 0.0023f);
|
||||
}
|
||||
|
||||
private void addCoolant(Fluid fluid, float degreesCoolingPerMB) {
|
||||
if(fluid == null || coolants.get(fluid.getName()) != null) {
|
||||
return;
|
||||
}
|
||||
coolants.put(fluid.getName(), new Coolant(fluid, degreesCoolingPerMB));
|
||||
if(BuildcraftFuelRegistry.coolant != null && BuildcraftFuelRegistry.coolant.getCoolant(fluid) == null) {
|
||||
BuildcraftFuelRegistry.coolant.addCoolant(fluid, degreesCoolingPerMB);
|
||||
}
|
||||
}
|
||||
|
||||
public IFluidCoolant getCoolant(Fluid fluid) {
|
||||
if(fluid == null) {
|
||||
return null;
|
||||
}
|
||||
IFluidCoolant res = coolants.get(fluid.getName());
|
||||
if(res == null && !coolants.containsKey(fluid.getName()) && BuildcraftFuelRegistry.coolant != null) {
|
||||
ICoolant bcCool = BuildcraftFuelRegistry.coolant.getCoolant(fluid);
|
||||
if(bcCool != null) {
|
||||
res = new CoolantBC(bcCool);
|
||||
}
|
||||
coolants.put(fluid.getName(), res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public IFluidCoolant getCoolant(FluidStack fluid) {
|
||||
if(fluid == null || fluid.getFluid() == null) {
|
||||
return null;
|
||||
}
|
||||
return getCoolant(fluid.getFluid());
|
||||
}
|
||||
|
||||
|
||||
public void addFuel(Fluid fluid, int powerPerCycleRF, int totalBurnTime) {
|
||||
if(fluid == null || fuels.get(fluid.getName()) != null) {
|
||||
return;
|
||||
}
|
||||
fuels.put(fluid.getName(), new Fuel(fluid, powerPerCycleRF, totalBurnTime));
|
||||
if(BuildcraftFuelRegistry.fuel != null && BuildcraftFuelRegistry.fuel.getFuel(fluid) == null) {
|
||||
BuildcraftFuelRegistry.fuel.addFuel(fluid, powerPerCycleRF, totalBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
public IFluidFuel getFuel(Fluid fluid) {
|
||||
if(fluid == null) {
|
||||
return null;
|
||||
}
|
||||
IFluidFuel res = fuels.get(fluid.getName());
|
||||
if(res == null && !fuels.containsKey(fluid.getName()) && BuildcraftFuelRegistry.fuel != null) {
|
||||
IFuel bcFuel = BuildcraftFuelRegistry.fuel.getFuel(fluid);
|
||||
if(bcFuel != null) {
|
||||
res = new FuelBC(bcFuel);
|
||||
}
|
||||
fuels.put(fluid.getName(), res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public IFluidFuel getFuel(FluidStack fluid) {
|
||||
if(fluid == null || fluid.getFluid() == null) {
|
||||
return null;
|
||||
}
|
||||
return getFuel(fluid.getFluid());
|
||||
}
|
||||
|
||||
private static class Fuel implements IFluidFuel {
|
||||
|
||||
private final Fluid fluid;
|
||||
private final int powerPerCycle;
|
||||
private final int totalBurningTime;
|
||||
|
||||
Fuel(Fluid fluid, int powerPerCycle, int totalBurningTime) {
|
||||
this.fluid = fluid;
|
||||
this.powerPerCycle = powerPerCycle;
|
||||
this.totalBurningTime = totalBurningTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getFluid() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalBurningTime() {
|
||||
return totalBurningTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPowerPerCycle() {
|
||||
return powerPerCycle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class FuelBC extends Fuel {
|
||||
|
||||
FuelBC(IFuel fuel) {
|
||||
super(fuel.getFluid(), fuel.getPowerPerCycle(), fuel.getTotalBurningTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Coolant implements IFluidCoolant {
|
||||
|
||||
private final Fluid fluid;
|
||||
private final float degreesCoolingPerMB;
|
||||
|
||||
Coolant(Fluid fluid, float degreesCoolingPerMB) {
|
||||
this.fluid = fluid;
|
||||
this.degreesCoolingPerMB = degreesCoolingPerMB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getFluid() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDegreesCoolingPerMB(float heat) {
|
||||
return degreesCoolingPerMB;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CoolantBC extends Coolant {
|
||||
|
||||
CoolantBC(ICoolant coolant) {
|
||||
//NB: in the current BC impl the temperature to getDegreesCoolingPerMB is ignored
|
||||
super(coolant.getFluid(), coolant.getDegreesCoolingPerMB(100));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package crazypants.enderio.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public interface IFluidCoolant {
|
||||
|
||||
Fluid getFluid();
|
||||
|
||||
float getDegreesCoolingPerMB(float heat);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package crazypants.enderio.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public interface IFluidFuel {
|
||||
|
||||
Fluid getFluid();
|
||||
|
||||
int getTotalBurningTime();
|
||||
|
||||
int getPowerPerCycle();
|
||||
}
|
||||
@@ -21,12 +21,13 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
import buildcraft.api.fuels.IronEngineFuel.Fuel;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.fluid.IFluidCoolant;
|
||||
import crazypants.enderio.fluid.IFluidFuel;
|
||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
||||
import crazypants.enderio.machine.crusher.IGrindingMultiplier;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
@@ -35,7 +36,6 @@ import crazypants.util.Lang;
|
||||
|
||||
public class TooltipAddera {
|
||||
|
||||
|
||||
public static TooltipAddera instance = new TooltipAddera();
|
||||
|
||||
//TODO: Need to decouple this stuff with a callback
|
||||
@@ -56,28 +56,28 @@ public class TooltipAddera {
|
||||
evt.toolTip.add("Burn time " + time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(Config.addDurabilityTootip) {
|
||||
addDurabilityTooltip(evt.toolTip, evt.itemStack);
|
||||
}
|
||||
|
||||
if(evt.itemStack.getItem() instanceof IAdvancedTooltipProvider) {
|
||||
IAdvancedTooltipProvider ttp = (IAdvancedTooltipProvider)evt.itemStack.getItem();
|
||||
IAdvancedTooltipProvider ttp = (IAdvancedTooltipProvider) evt.itemStack.getItem();
|
||||
addInformation(ttp, evt.itemStack, evt.entityPlayer, evt.toolTip, false);
|
||||
return;
|
||||
} else if(evt.itemStack.getItem() instanceof IResourceTooltipProvider) {
|
||||
addInformation((IResourceTooltipProvider)evt.itemStack.getItem(), evt);
|
||||
addInformation((IResourceTooltipProvider) evt.itemStack.getItem(), evt);
|
||||
return;
|
||||
}
|
||||
|
||||
Block blk = Block.getBlockFromItem(evt.itemStack.getItem());
|
||||
if(blk instanceof IAdvancedTooltipProvider) {
|
||||
addInformation((IAdvancedTooltipProvider)blk, evt.itemStack, evt.entityPlayer, evt.toolTip, false);
|
||||
addInformation((IAdvancedTooltipProvider) blk, evt.itemStack, evt.entityPlayer, evt.toolTip, false);
|
||||
return;
|
||||
} else if(blk instanceof IResourceTooltipProvider) {
|
||||
addInformation((IResourceTooltipProvider)blk, evt);
|
||||
addInformation((IResourceTooltipProvider) blk, evt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.addFuelTooltipsToAllFluidContainers) {
|
||||
addTooltipForFluid(evt.toolTip, evt.itemStack);
|
||||
@@ -95,10 +95,10 @@ public class TooltipAddera {
|
||||
return;
|
||||
}
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof ItemTool || item instanceof ItemArmor ||
|
||||
if(item instanceof ItemTool || item instanceof ItemArmor ||
|
||||
item instanceof ItemSword || item instanceof ItemHoe || item instanceof ItemBow) {
|
||||
toolTip.add(ItemUtil.getDurabilityString(itemStack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addTooltipForFluid(List list, ItemStack stk) {
|
||||
@@ -111,29 +111,42 @@ public class TooltipAddera {
|
||||
|
||||
public static void addTooltipForFluid(List list, Fluid fluid) {
|
||||
if(fluid != null) {
|
||||
Fuel fuel = IronEngineFuel.getFuelForFluid(fluid);
|
||||
IFluidFuel fuel = FluidFuelRegister.instance.getFuel(fluid);
|
||||
if(fuel != null) {
|
||||
if(showAdvancedTooltips()) {
|
||||
list.add(Lang.localize("fuel.tooltip.heading"));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + PowerDisplayUtil.formatPowerPerTick( (int)(fuel.powerPerCycle * 10) ));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + fuel.totalBurningTime + " " + Lang.localize("fuel.tooltip.burnTime"));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + PowerDisplayUtil.formatPowerPerTick(fuel.getPowerPerCycle()));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + fuel.getTotalBurningTime() + " " + Lang.localize("fuel.tooltip.burnTime"));
|
||||
} else {
|
||||
addShowDetailsTooltip(list);
|
||||
}
|
||||
} else {
|
||||
IFluidCoolant coolant = FluidFuelRegister.instance.getCoolant(fluid);
|
||||
if(coolant != null) {
|
||||
if(showAdvancedTooltips()) {
|
||||
list.add(Lang.localize("coolant.tooltip.heading"));
|
||||
list.add(EnumChatFormatting.ITALIC + " "
|
||||
+ list.add(Lang.localize("fuel.tooltip.degreesPerBucket") + " "
|
||||
+ PowerDisplayUtil.formatPowerFloat(coolant.getDegreesCoolingPerMB(100) * 1000)));
|
||||
} else {
|
||||
addShowDetailsTooltip(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void addInformation(IResourceTooltipProvider item, ItemTooltipEvent evt) {
|
||||
addInformation(item, evt.itemStack, evt.entityPlayer, evt.toolTip);
|
||||
}
|
||||
|
||||
|
||||
public static void addInformation(IResourceTooltipProvider tt, ItemStack itemstack, EntityPlayer entityplayer, List list) {
|
||||
String name = tt.getUnlocalizedNameForTooltip(itemstack);
|
||||
if(showAdvancedTooltips()) {
|
||||
addCommonTooltipFromResources(list, name);
|
||||
addDetailedTooltipFromResources(list, name);
|
||||
} else {
|
||||
} else {
|
||||
addBasicTooltipFromResources(list, name);
|
||||
addCommonTooltipFromResources(list, name);
|
||||
addShowDetailsTooltip(list);
|
||||
@@ -174,7 +187,7 @@ public class TooltipAddera {
|
||||
String keyBase = unlocalizedName + tooltipTag;
|
||||
boolean done = false;
|
||||
int line = 1;
|
||||
while(!done) {
|
||||
while (!done) {
|
||||
String key = keyBase + line;
|
||||
String val = Lang.localize(key, false);
|
||||
if(val == null || val.trim().length() < 0 || val.equals(key) || line > 12) {
|
||||
@@ -186,15 +199,15 @@ public class TooltipAddera {
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDetailedTooltipFromResources(List list,ItemStack itemstack) {
|
||||
public static void addDetailedTooltipFromResources(List list, ItemStack itemstack) {
|
||||
if(itemstack.getItem() == null) {
|
||||
return;
|
||||
}
|
||||
String unlock = null;
|
||||
// Block blk = Block.getBlockFromItem(itemstack.getItem());
|
||||
// if(blk != null && blk != Blocks.air) {
|
||||
// unlock = blk.getUnlocalizedName();
|
||||
// }
|
||||
// Block blk = Block.getBlockFromItem(itemstack.getItem());
|
||||
// if(blk != null && blk != Blocks.air) {
|
||||
// unlock = blk.getUnlocalizedName();
|
||||
// }
|
||||
if(unlock == null) {
|
||||
unlock = itemstack.getItem().getUnlocalizedName();
|
||||
}
|
||||
@@ -235,5 +248,4 @@ public class TooltipAddera {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+37
-28
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine.generator.combustion;
|
||||
|
||||
import scala.xml.persistent.SetStorage;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -11,11 +10,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import buildcraft.api.fuels.IronEngineCoolant;
|
||||
import buildcraft.api.fuels.IronEngineCoolant.Coolant;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
import buildcraft.api.fuels.IronEngineFuel.Fuel;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.fluid.IFluidCoolant;
|
||||
import crazypants.enderio.fluid.IFluidFuel;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
@@ -46,8 +44,8 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
|
||||
private static int IO_MB_TICK = 250;
|
||||
|
||||
private Fuel curFuel;
|
||||
private Coolant curCoolant;
|
||||
private IFluidFuel curFuel;
|
||||
private IFluidCoolant curCoolant;
|
||||
|
||||
public TileCombustionGenerator() {
|
||||
super(new SlotDefinition(-1, -1, -1, -1, -1, -1));
|
||||
@@ -115,11 +113,16 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return 0;
|
||||
}
|
||||
int res = 0;
|
||||
if(IronEngineCoolant.isCoolant(resource.getFluid())) {
|
||||
|
||||
IFluidCoolant cool = FluidFuelRegister.instance.getCoolant(resource.getFluid());
|
||||
if(cool != null) {
|
||||
res = getCoolantTank().fill(resource, doFill);
|
||||
} else if(IronEngineFuel.getFuelForFluid(resource.getFluid()) != null) {
|
||||
res = getFuelTank().fill(resource, doFill);
|
||||
}
|
||||
} else {
|
||||
IFluidFuel f = FluidFuelRegister.instance.getFuel(resource.getFluid());
|
||||
if(f != null) {
|
||||
res = getFuelTank().fill(resource, doFill);
|
||||
}
|
||||
}
|
||||
if(res > 0) {
|
||||
tanksDirty = true;
|
||||
}
|
||||
@@ -227,7 +230,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
boolean res = false;
|
||||
ticksRemaingFuel--;
|
||||
if(ticksRemaingFuel <= 0) {
|
||||
curFuel = getFuelTank().getFluid() == null ? null : IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
curFuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
if(curFuel == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -240,7 +243,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
res = true;
|
||||
tanksDirty = true;
|
||||
} else if(curFuel == null) {
|
||||
curFuel = getFuelTank().getFluid() == null ? null : IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
curFuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
if(curFuel == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -248,7 +251,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
|
||||
ticksRemaingCoolant--;
|
||||
if(ticksRemaingCoolant <= 0) {
|
||||
curCoolant = IronEngineCoolant.getCoolant(getCoolantTank().getFluid());
|
||||
updateCoolantFromTank();
|
||||
if(curCoolant == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -259,7 +262,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
ticksRemaingCoolant = getNumTicksPerMbCoolant(curCoolant, curFuel) * drained.amount;
|
||||
res = true;
|
||||
} else if(curCoolant == null) {
|
||||
curCoolant = IronEngineCoolant.getCoolant(getCoolantTank().getFluid());
|
||||
updateCoolantFromTank();
|
||||
if(curCoolant == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -272,15 +275,19 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return getFuelTank().getFluidAmount() > 0 && getCoolantTank().getFluidAmount() > 0;
|
||||
}
|
||||
|
||||
protected void updateCoolantFromTank() {
|
||||
curCoolant = FluidFuelRegister.instance.getCoolant(getCoolantTank().getFluid());
|
||||
}
|
||||
|
||||
private int getPowerPerCycle() {
|
||||
return curFuel == null ? 0 : (int)(curFuel.powerPerCycle * 10);
|
||||
return curFuel == null ? 0 : curFuel.getPowerPerCycle();
|
||||
}
|
||||
|
||||
public int getNumTicksPerMbFuel() {
|
||||
if(getFuelTank().getFluidAmount() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return getNumTicksPerMbFuel(IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid()));
|
||||
return getNumTicksPerMbFuel(FluidFuelRegister.instance.getFuel(getFuelTank().getFluid().getFluid()));
|
||||
}
|
||||
|
||||
public int getNumTicksPerMbCoolant() {
|
||||
@@ -288,36 +295,38 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return 0;
|
||||
}
|
||||
if(worldObj.isRemote) {
|
||||
curFuel = IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
curCoolant = IronEngineCoolant.getCoolant(getCoolantTank().getFluid());
|
||||
curFuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
updateCoolantFromTank();
|
||||
}
|
||||
return getNumTicksPerMbCoolant(curCoolant, curFuel);
|
||||
}
|
||||
|
||||
static int getNumTicksPerMbFuel(Fuel fuel) {
|
||||
static int getNumTicksPerMbFuel(IFluidFuel fuel) {
|
||||
if(fuel == null) {
|
||||
return 0;
|
||||
}
|
||||
return fuel.totalBurningTime / 1000;
|
||||
return fuel.getTotalBurningTime() / 1000;
|
||||
}
|
||||
|
||||
static int getNumTicksPerMbCoolant(Coolant coolant, Fuel fuel) {
|
||||
public static float HEAT_PER_RF = 0.00023F;
|
||||
|
||||
static int getNumTicksPerMbCoolant(IFluidCoolant coolant, IFluidFuel fuel) {
|
||||
if(coolant == null || fuel == null) {
|
||||
return 0;
|
||||
}
|
||||
float power = fuel.powerPerCycle;
|
||||
float power = fuel.getPowerPerCycle();
|
||||
float cooling = coolant.getDegreesCoolingPerMB(100);
|
||||
double toCool = 1d / (0.027 * power);
|
||||
double toCool = 1d / (HEAT_PER_RF * power);
|
||||
int numTicks = (int) Math.round(toCool / (cooling * 1000));
|
||||
return numTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
if(isSideDisabled(from.ordinal())) {
|
||||
if(isSideDisabled(from.ordinal()) || fluid == null) {
|
||||
return false;
|
||||
}
|
||||
return IronEngineCoolant.isCoolant(fluid) || IronEngineFuel.getFuelForFluid(fluid) != null;
|
||||
return FluidFuelRegister.instance.getCoolant(fluid) != null || FluidFuelRegister.instance.getFuel(fluid) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -405,11 +414,11 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
if(getFuelTank().getFluidAmount() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
Fuel fuel = IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
IFluidFuel fuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
if(fuel == null) {
|
||||
return 0;
|
||||
}
|
||||
return (int)fuel.powerPerCycle;
|
||||
return fuel.getPowerPerCycle();
|
||||
}
|
||||
|
||||
public FluidTank getCoolantTank() {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
@@ -16,11 +14,7 @@ public class PowerHandlerUtil {
|
||||
return new PowerInterfaceRF((IEnergyHandler) o);
|
||||
}
|
||||
|
||||
if(Config.powerConduitOutputMJ) {
|
||||
IBatteryObject battery = MjAPI.getMjBattery(o);
|
||||
if(battery != null) {
|
||||
return new PowerInterfaceBC2(battery);
|
||||
}
|
||||
if(Config.powerConduitOutputMJ) {
|
||||
if(o instanceof IPowerReceptor) {
|
||||
return new PowerInterfaceBC((IPowerReceptor) o);
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
|
||||
public class PowerInterfaceBC2 implements IPowerInterface {
|
||||
|
||||
private final IBatteryObject battery;
|
||||
|
||||
public PowerInterfaceBC2(IBatteryObject battery) {
|
||||
this.battery = battery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate() {
|
||||
return battery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConduitConnect(ForgeDirection direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection dir) {
|
||||
return (int) (battery.getEnergyStored() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection dir) {
|
||||
return (int) (battery.maxCapacity() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPowerRequest(ForgeDirection dir) {
|
||||
return (int)( battery.getEnergyRequested() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinEnergyReceived(ForgeDirection dir) {
|
||||
return (int) (battery.minimumConsumption() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recieveEnergy(ForgeDirection opposite, int canOffer) {
|
||||
double offer = Math.min(battery.getEnergyRequested(), canOffer/10f);
|
||||
return (int) (battery.addEnergy(offer) * 10);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user