This commit is contained in:
Adrian Siekierka 2014-11-09 16:06:19 +01:00
parent 68512ed479
commit 8535f295d9
11 changed files with 39 additions and 16 deletions

View file

@ -27,6 +27,10 @@ public final class PipeToolTipManager {
for (Map.Entry<Class<? extends Pipe<?>>, Integer> pipe : PipeTransportPower.powerCapacities.entrySet()) {
PipeToolTipManager.addToolTip(pipe.getKey(), String.format("%d RF/t", pipe.getValue()));
}
for (Map.Entry<Class<? extends Pipe<?>>, Integer> pipe : PipeTransportFluids.fluidCapacities.entrySet()) {
PipeToolTipManager.addToolTip(pipe.getKey(), String.format("%d mB/t", pipe.getValue()));
}
}
/**
@ -47,8 +51,8 @@ public final class PipeToolTipManager {
if (localized != null) {
List<String> lines = StringUtils.newLineSplitter.splitToList(localized);
tips.addAll(lines);
}
}
}
}
String tip = toolTips.get(pipe);
if (tip != null) {
tips.add(tip);

View file

@ -9,7 +9,10 @@
package buildcraft.transport;
import java.util.BitSet;
import java.util.HashMap;
import java.util.Map;
import buildcraft.transport.pipes.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -27,6 +30,7 @@ import buildcraft.core.DefaultProps;
import buildcraft.transport.network.PacketFluidUpdate;
public class PipeTransportFluids extends PipeTransport implements IFluidHandler {
public static final Map<Class<? extends Pipe<?>>, Integer> fluidCapacities = new HashMap<Class<? extends Pipe<?>>, Integer>();
public class PipeSection extends FluidTank {
@ -153,7 +157,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
private final SafeTimeTracker tracker = new SafeTimeTracker(BuildCraftCore.updateFactor);
private int clientSyncCounter = 0;
public PipeTransportFluids() {
public PipeTransportFluids() {
for (ForgeDirection direction : orientations) {
internalTanks[direction.ordinal()] = new PipeSection(getCapacity());
if (direction != ForgeDirection.UNKNOWN) {
@ -162,6 +166,10 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
}
}
public void initFromPipe(Class<? extends Pipe> pipeClass) {
flowRate = fluidCapacities.get(pipeClass);
}
@Override
public PipeType getPipeType() {
return PipeType.FLUID;
@ -580,4 +588,16 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
return new FluidTankInfo[]{new FluidTankInfo(internalTanks[from.ordinal()])};
}
static {
fluidCapacities.put(PipeFluidsCobblestone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsEmerald.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsGold.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsIron.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsQuartz.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsSandstone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsStone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsVoid.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsWood.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
}
}

View file

@ -24,9 +24,8 @@ import buildcraft.transport.PipeTransportFluids;
public class PipeFluidsCobblestone extends Pipe<PipeTransportFluids> {
public PipeFluidsCobblestone(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = BuildCraftTransport.pipeFluidsBaseFlowRate;
super(new PipeTransportFluids(), item);
transport.initFromPipe(getClass());
transport.travelDelay = 12;
}

View file

@ -21,7 +21,7 @@ public class PipeFluidsEmerald extends PipeFluidsWood {
standardIconIndex = PipeIconProvider.TYPE.PipeFluidsEmerald_Standard.ordinal();
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
transport.flowRate = 4 * BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 4;
}
}

View file

@ -24,9 +24,9 @@ import buildcraft.transport.PipeTransportFluids;
public class PipeFluidsGold extends Pipe<PipeTransportFluids> {
public PipeFluidsGold(Item item) {
super(new PipeTransportFluids(), item);
super(new PipeTransportFluids(), item);
transport.flowRate = 4 * BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 4;
}

View file

@ -51,8 +51,8 @@ public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
public PipeFluidsIron(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.travelDelay = 12;
transport.initFromPipe(getClass());
transport.travelDelay = 8;
}
@Override

View file

@ -26,7 +26,7 @@ public class PipeFluidsQuartz extends Pipe<PipeTransportFluids> {
public PipeFluidsQuartz(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = 2 * BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 8;
}

View file

@ -31,7 +31,7 @@ public class PipeFluidsSandstone extends Pipe<PipeTransportFluids> implements IP
public PipeFluidsSandstone(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 12;
}

View file

@ -26,7 +26,7 @@ public class PipeFluidsStone extends Pipe<PipeTransportFluids> {
public PipeFluidsStone(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 12;
}

View file

@ -28,7 +28,7 @@ public class PipeFluidsVoid extends Pipe<PipeTransportFluids> implements IPipeTr
public PipeFluidsVoid(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 12;
}

View file

@ -62,7 +62,7 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> implements IEnergy
public PipeFluidsWood(Item item) {
super(new PipeTransportFluids(), item);
transport.flowRate = BuildCraftTransport.pipeFluidsBaseFlowRate;
transport.initFromPipe(getClass());
transport.travelDelay = 12;
}