Merge pull request #125 from ZeldoKavira/master

PipeLoss Config, NPE fix on iron engine and quarry
This commit is contained in:
SirSengir 2012-07-25 09:39:21 -07:00
commit 140a86e8aa
5 changed files with 724 additions and 708 deletions

View file

@ -85,6 +85,7 @@ public class BuildCraftTransport {
public static int[] diamondTextures = new int[6];
public static boolean alwaysConnectPipes;
public static boolean usePipeLoss;
public static int maxItemsInPipes;
public static Item pipeWaterproof;
@ -180,6 +181,10 @@ public class BuildCraftTransport {
Property alwaysConnect = BuildCraftCore.mainConfiguration.getOrCreateBooleanProperty("pipes.alwaysConnect",
Configuration.CATEGORY_GENERAL, DefaultProps.PIPES_ALWAYS_CONNECT);
alwaysConnect.comment = "set to false to deactivate pipe connection rules, true by default";
Property PipeLoss = BuildCraftCore.mainConfiguration.getOrCreateBooleanProperty("power.usePipeLoss",
Configuration.CATEGORY_GENERAL, DefaultProps.USE_PIPELOSS);
PipeLoss.comment = "Set to false to turn off energy loss over distance on all power pipes";
Property exclusionList = BuildCraftCore.mainConfiguration.getOrCreateProperty("woodenPipe.exclusion",
Configuration.CATEGORY_BLOCK, "");
@ -325,6 +330,7 @@ public class BuildCraftTransport {
ItemFacade.initialize();
alwaysConnectPipes = Boolean.parseBoolean(alwaysConnect.value);
usePipeLoss = Boolean.parseBoolean(PipeLoss.value);
BuildCraftCore.mainConfiguration.save();

View file

@ -114,6 +114,7 @@ public class DefaultProps {
public static boolean CURRENT_CONTINUOUS = false;
public static boolean PIPES_ALWAYS_CONNECT = false;
public static boolean FILLER_DESTROY = false;
public static boolean USE_PIPELOSS = true;
public static int TRIGGER_REDSTONE_ACTIVE = 1;
public static int TRIGGER_REDSTONE_INACTIVE = 2;

View file

@ -141,12 +141,15 @@ public class EngineIron extends Engine {
int extraHeat = heat - COOLANT_THRESHOLD;
IronEngineCoolant currentCoolant = IronEngineCoolant.getCoolantForLiquid(new LiquidStack(coolantId, coolantQty, 0));
if(coolantQty * currentCoolant.coolingPerUnit > extraHeat) {
coolantQty -= Math.round(extraHeat / currentCoolant.coolingPerUnit);
heat = COOLANT_THRESHOLD;
} else {
heat -= coolantQty * currentCoolant.coolingPerUnit;
coolantQty = 0;
if (currentCoolant != null)
{
if(coolantQty * currentCoolant.coolingPerUnit > extraHeat) {
coolantQty -= Math.round(extraHeat / currentCoolant.coolingPerUnit);
heat = COOLANT_THRESHOLD;
} else {
heat -= coolantQty * currentCoolant.coolingPerUnit;
coolantQty = 0;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -22,6 +22,7 @@ import buildcraft.core.IMachine;
import buildcraft.core.Utils;
import buildcraft.core.network.TileNetworkData;
import buildcraft.transport.network.PacketPowerUpdate;
import net.minecraft.src.BuildCraftTransport;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
@ -179,7 +180,10 @@ public class PipeTransportPower extends PipeTransport {
if (this.container.pipe instanceof IPipeTransportPowerHook)
((IPipeTransportPowerHook) this.container.pipe).receiveEnergy(from, val);
else {
internalNextPower[from.ordinal()] += val * (1 - powerResitance);
if (BuildCraftTransport.usePipeLoss)
internalNextPower[from.ordinal()] += val * (1 - powerResitance);
else
internalNextPower[from.ordinal()] += val;
if (internalNextPower[from.ordinal()] >= 1000)
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 2);