Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development
This commit is contained in:
commit
79f77dbdeb
13 changed files with 70 additions and 14 deletions
|
@ -69,11 +69,6 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
|
|||
register();
|
||||
}
|
||||
|
||||
public int getCapacity()
|
||||
{
|
||||
return TUBE_GAS*transmitters.size();
|
||||
}
|
||||
|
||||
public synchronized int getGasNeeded()
|
||||
{
|
||||
return getCapacity()-(gasStored != null ? gasStored.amount : 0);
|
||||
|
|
|
@ -101,6 +101,20 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
|
|||
{
|
||||
return possibleAcceptors.size();
|
||||
}
|
||||
|
||||
public int getCapacity()
|
||||
{
|
||||
return (int)getMeanCapacity() * transmitters.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this if things can have variable capacity along the network.
|
||||
* @return An 'average' value of capacity. Calculate it how you will.
|
||||
*/
|
||||
public double getMeanCapacity()
|
||||
{
|
||||
return transmitters.iterator().next().getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
|
|
|
@ -74,4 +74,6 @@ public interface ITransmitter<N extends DynamicNetwork<?, N>>
|
|||
public String getTransmitterNetworkNeeded();
|
||||
|
||||
public String getTransmitterNetworkFlow();
|
||||
|
||||
public int getCapacity();
|
||||
}
|
||||
|
|
|
@ -74,10 +74,18 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
refresh();
|
||||
register();
|
||||
}
|
||||
|
||||
public double getCapacity()
|
||||
|
||||
@Override
|
||||
public double getMeanCapacity()
|
||||
{
|
||||
return CABLE_ENERGY*transmitters.size();
|
||||
//Use the harmonic mean. Because we're mean.
|
||||
int numCables = transmitters.size();
|
||||
double reciprocalSum = 0;
|
||||
for(ITransmitter<EnergyNetwork> cable : transmitters)
|
||||
{
|
||||
reciprocalSum += 1.0/(double)cable.getCapacity();
|
||||
}
|
||||
return (double)numCables / reciprocalSum;
|
||||
}
|
||||
|
||||
public synchronized double getEnergyNeeded()
|
||||
|
@ -464,6 +472,6 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
@Override
|
||||
public String getFlow()
|
||||
{
|
||||
return MekanismUtils.getEnergyDisplay(electricityStored);
|
||||
return MekanismUtils.getPowerDisplay(20*electricityStored);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,11 +75,6 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
|||
register();
|
||||
}
|
||||
|
||||
public int getCapacity()
|
||||
{
|
||||
return PIPE_FLUID*transmitters.size();
|
||||
}
|
||||
|
||||
public synchronized int getFluidNeeded()
|
||||
{
|
||||
return getCapacity()-(fluidStored != null ? fluidStored.amount : 0);
|
||||
|
|
|
@ -39,6 +39,7 @@ public class ItemNetworkReader extends ItemEnergized
|
|||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getAcceptorSize()));
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getNeeded()));
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getFlow() ));
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Capacity: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getCapacity() + "/tick" ));
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,4 +190,10 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,4 +99,10 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork>
|
|||
{
|
||||
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,4 +275,10 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
{
|
||||
return (int)Math.round(getTransmitterNetwork().getEnergyNeeded()*Mekanism.TO_TE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,4 +285,10 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,4 +142,10 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
|||
{
|
||||
return tile instanceof IGasTransmitter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,4 +339,10 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
{
|
||||
return 120;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 10000;
|
||||
}
|
||||
}
|
|
@ -1118,6 +1118,11 @@ public final class MekanismUtils
|
|||
return ElectricityDisplay.getDisplayShort((float)(energy*Mekanism.TO_UE), ElectricUnit.JOULES);
|
||||
}
|
||||
|
||||
public static String getPowerDisplay(double energy)
|
||||
{
|
||||
return ElectricityDisplay.getDisplayShort((float)(energy*Mekanism.TO_UE), ElectricUnit.WATT);
|
||||
}
|
||||
|
||||
public static boolean useBuildcraft()
|
||||
{
|
||||
return Mekanism.hooks.BuildCraftLoaded || Mekanism.forceBuildcraft;
|
||||
|
|
Loading…
Reference in a new issue