Further modularized transmitter networks
This commit is contained in:
parent
20728eff4f
commit
b2f20185e4
11 changed files with 109 additions and 226 deletions
|
@ -1,9 +1,66 @@
|
|||
package mekanism.api;
|
||||
|
||||
public class DynamicNetwork
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import mekanism.common.EnergyNetwork;
|
||||
import mekanism.common.IMechanicalPipe;
|
||||
import mekanism.common.IUniversalCable;
|
||||
|
||||
public abstract class DynamicNetwork<T, A> implements ITransmitterNetwork
|
||||
{
|
||||
public HashSet<T> transmitters = new HashSet<T>();
|
||||
|
||||
public Set<A> possibleAcceptors = new HashSet<A>();
|
||||
public Map<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>();
|
||||
|
||||
protected int ticksSinceCreate = 0;
|
||||
protected int ticksSinceSecond = 0;
|
||||
|
||||
protected boolean fixed = false;
|
||||
|
||||
public void addAllTransmitters(Set<T> newTransmitters)
|
||||
{
|
||||
transmitters.addAll(newTransmitters);
|
||||
}
|
||||
|
||||
public void removeTransmitter(T transmitter)
|
||||
{
|
||||
transmitters.remove(transmitter);
|
||||
|
||||
if(transmitters.size() == 0)
|
||||
{
|
||||
deregister();
|
||||
}
|
||||
}
|
||||
|
||||
public void register()
|
||||
{
|
||||
try {
|
||||
T aTransmitter = transmitters.iterator().next();
|
||||
|
||||
if(aTransmitter instanceof TileEntity && !((TileEntity)aTransmitter).worldObj.isRemote)
|
||||
{
|
||||
TransmitterNetworkRegistry.getInstance().registerNetwork(this);
|
||||
}
|
||||
} catch(NoSuchElementException e) {}
|
||||
}
|
||||
|
||||
public void deregister()
|
||||
{
|
||||
transmitters.clear();
|
||||
TransmitterNetworkRegistry.getInstance().removeNetwork(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return transmitters.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,16 +20,11 @@ import net.minecraftforge.event.ForgeSubscribe;
|
|||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
||||
public class GasNetwork extends DynamicNetwork<IPressurizedTube, IGasAcceptor>
|
||||
{
|
||||
public HashSet<IPressurizedTube> tubes = new HashSet<IPressurizedTube>();
|
||||
|
||||
public Set<IGasAcceptor> possibleAcceptors = new HashSet<IGasAcceptor>();
|
||||
public Map<IGasAcceptor, ForgeDirection> acceptorDirections = new HashMap<IGasAcceptor, ForgeDirection>();
|
||||
|
||||
public GasNetwork(IPressurizedTube... varPipes)
|
||||
{
|
||||
tubes.addAll(Arrays.asList(varPipes));
|
||||
transmitters.addAll(Arrays.asList(varPipes));
|
||||
register();
|
||||
}
|
||||
|
||||
|
@ -39,7 +34,7 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
{
|
||||
if(net != null)
|
||||
{
|
||||
addAllTubes(net.tubes);
|
||||
addAllTransmitters(net.transmitters);
|
||||
net.deregister();
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +104,7 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
|
||||
public void refresh()
|
||||
{
|
||||
Set<IPressurizedTube> iterTubes = (Set<IPressurizedTube>) tubes.clone();
|
||||
Set<IPressurizedTube> iterTubes = (Set<IPressurizedTube>) transmitters.clone();
|
||||
Iterator<IPressurizedTube> it = iterTubes.iterator();
|
||||
|
||||
possibleAcceptors.clear();
|
||||
|
@ -122,14 +117,14 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||
{
|
||||
it.remove();
|
||||
tubes.remove(conductor);
|
||||
transmitters.remove(conductor);
|
||||
}
|
||||
else {
|
||||
conductor.setNetwork(this);
|
||||
}
|
||||
}
|
||||
|
||||
for(IPressurizedTube pipe : tubes)
|
||||
for(IPressurizedTube pipe : transmitters)
|
||||
{
|
||||
IGasAcceptor[] acceptors = GasTransmission.getConnectedAcceptors((TileEntity)pipe);
|
||||
|
||||
|
@ -156,16 +151,11 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
}
|
||||
}
|
||||
|
||||
public void addAllTubes(Set<IPressurizedTube> newTubes)
|
||||
{
|
||||
tubes.addAll(newTubes);
|
||||
}
|
||||
|
||||
public void split(IPressurizedTube splitPoint)
|
||||
{
|
||||
if(splitPoint instanceof TileEntity)
|
||||
{
|
||||
removeTube(splitPoint);
|
||||
removeTransmitter(splitPoint);
|
||||
|
||||
TileEntity[] connectedBlocks = new TileEntity[6];
|
||||
boolean[] dealtWith = {false, false, false, false, false, false};
|
||||
|
@ -212,7 +202,7 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
{
|
||||
if(nodeTile != splitPoint)
|
||||
{
|
||||
newNetwork.tubes.add((IPressurizedTube)nodeTile);
|
||||
newNetwork.transmitters.add((IPressurizedTube)nodeTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,33 +241,6 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
}
|
||||
}
|
||||
|
||||
public void removeTube(IPressurizedTube tube)
|
||||
{
|
||||
tubes.remove(tube);
|
||||
if(tubes.size() == 0)
|
||||
{
|
||||
deregister();
|
||||
}
|
||||
}
|
||||
|
||||
public void register()
|
||||
{
|
||||
try {
|
||||
IPressurizedTube aTube = tubes.iterator().next();
|
||||
|
||||
if(aTube instanceof TileEntity && !((TileEntity)aTube).worldObj.isRemote)
|
||||
{
|
||||
TransmitterNetworkRegistry.getInstance().registerNetwork(this);
|
||||
}
|
||||
} catch(NoSuchElementException e) {}
|
||||
}
|
||||
|
||||
public void deregister()
|
||||
{
|
||||
tubes.clear();
|
||||
TransmitterNetworkRegistry.getInstance().removeNetwork(this);
|
||||
}
|
||||
|
||||
public static class NetworkFinder
|
||||
{
|
||||
public World worldObj;
|
||||
|
@ -367,7 +330,7 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[GasNetwork] " + tubes.size() + " tubes, " + possibleAcceptors.size() + " acceptors.";
|
||||
return "[GasNetwork] " + transmitters.size() + " transmitters, " + possibleAcceptors.size() + " acceptors.";
|
||||
}
|
||||
|
||||
public void tick()
|
||||
|
@ -379,14 +342,8 @@ public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
if(ticksSinceCreate > 1200)
|
||||
{
|
||||
ticksSinceCreate = 0;
|
||||
fixMessedUpNetwork(tubes.iterator().next());
|
||||
fixMessedUpNetwork(transmitters.iterator().next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return tubes.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,20 +32,15 @@ import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
||||
{
|
||||
public HashSet<IUniversalCable> cables = new HashSet<IUniversalCable>();
|
||||
|
||||
public Set<TileEntity> possibleAcceptors = new HashSet<TileEntity>();
|
||||
public Map<TileEntity, ForgeDirection> acceptorDirections = new HashMap<TileEntity, ForgeDirection>();
|
||||
|
||||
public class EnergyNetwork extends DynamicNetwork<IUniversalCable, TileEntity>
|
||||
{
|
||||
private double lastPowerScale = 0;
|
||||
private double joulesTransmitted = 0;
|
||||
private double joulesLastTick = 0;
|
||||
|
||||
public EnergyNetwork(IUniversalCable... varCables)
|
||||
{
|
||||
cables.addAll(Arrays.asList(varCables));
|
||||
transmitters.addAll(Arrays.asList(varCables));
|
||||
register();
|
||||
}
|
||||
|
||||
|
@ -55,7 +50,7 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
{
|
||||
if(net != null)
|
||||
{
|
||||
addAllCables(net.cables);
|
||||
addAllTransmitters(net.transmitters);
|
||||
net.deregister();
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +199,7 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
|
||||
public void refresh()
|
||||
{
|
||||
Set<IUniversalCable> iterCables = (Set<IUniversalCable>) cables.clone();
|
||||
Set<IUniversalCable> iterCables = (Set<IUniversalCable>) transmitters.clone();
|
||||
Iterator<IUniversalCable> it = iterCables.iterator();
|
||||
|
||||
possibleAcceptors.clear();
|
||||
|
@ -217,7 +212,7 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||
{
|
||||
it.remove();
|
||||
cables.remove(conductor);
|
||||
transmitters.remove(conductor);
|
||||
}
|
||||
else {
|
||||
conductor.setNetwork(this);
|
||||
|
@ -258,17 +253,12 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
newNetwork.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllCables(Set<IUniversalCable> newCables)
|
||||
{
|
||||
cables.addAll(newCables);
|
||||
}
|
||||
|
||||
public void split(IUniversalCable splitPoint)
|
||||
{
|
||||
if(splitPoint instanceof TileEntity)
|
||||
{
|
||||
removeCable(splitPoint);
|
||||
removeTransmitter(splitPoint);
|
||||
|
||||
TileEntity[] connectedBlocks = new TileEntity[6];
|
||||
boolean[] dealtWith = {false, false, false, false, false, false};
|
||||
|
@ -354,34 +344,6 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
}
|
||||
}
|
||||
|
||||
public void removeCable(IUniversalCable cable)
|
||||
{
|
||||
cables.remove(cable);
|
||||
|
||||
if(cables.size() == 0)
|
||||
{
|
||||
deregister();
|
||||
}
|
||||
}
|
||||
|
||||
public void register()
|
||||
{
|
||||
try {
|
||||
IUniversalCable aCable = cables.iterator().next();
|
||||
|
||||
if(aCable instanceof TileEntity && !((TileEntity)aCable).worldObj.isRemote)
|
||||
{
|
||||
TransmitterNetworkRegistry.getInstance().registerNetwork(this);
|
||||
}
|
||||
} catch(NoSuchElementException e) {}
|
||||
}
|
||||
|
||||
public void deregister()
|
||||
{
|
||||
cables.clear();
|
||||
TransmitterNetworkRegistry.getInstance().removeNetwork(this);
|
||||
}
|
||||
|
||||
public static class NetworkFinder
|
||||
{
|
||||
public World worldObj;
|
||||
|
@ -471,7 +433,7 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[EnergyNetwork] " + cables.size() + " cables, " + possibleAcceptors.size() + " acceptors.";
|
||||
return "[EnergyNetwork] " + transmitters.size() + " transmitters, " + possibleAcceptors.size() + " acceptors.";
|
||||
}
|
||||
|
||||
public void tick()
|
||||
|
@ -485,7 +447,7 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
if(ticksSinceCreate > 1200)
|
||||
{
|
||||
ticksSinceCreate = 0;
|
||||
fixMessedUpNetwork(cables.iterator().next());
|
||||
fixMessedUpNetwork(transmitters.iterator().next());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,10 +475,4 @@ public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
{
|
||||
return joulesLastTick * 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return cables.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,16 +26,11 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
||||
public class FluidNetwork extends DynamicNetwork<IMechanicalPipe, IFluidHandler>
|
||||
{
|
||||
public HashSet<IMechanicalPipe> pipes = new HashSet<IMechanicalPipe>();
|
||||
|
||||
public Set<IFluidHandler> possibleAcceptors = new HashSet<IFluidHandler>();
|
||||
public Map<IFluidHandler, ForgeDirection> acceptorDirections = new HashMap<IFluidHandler, ForgeDirection>();
|
||||
|
||||
public FluidNetwork(IMechanicalPipe... varPipes)
|
||||
{
|
||||
pipes.addAll(Arrays.asList(varPipes));
|
||||
transmitters.addAll(Arrays.asList(varPipes));
|
||||
register();
|
||||
}
|
||||
|
||||
|
@ -45,7 +40,7 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
{
|
||||
if(net != null)
|
||||
{
|
||||
addAllPipes(net.pipes);
|
||||
addAllTransmitters(net.transmitters);
|
||||
net.deregister();
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +108,7 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
|
||||
public void refresh()
|
||||
{
|
||||
Set<IMechanicalPipe> iterPipes = (Set<IMechanicalPipe>) pipes.clone();
|
||||
Set<IMechanicalPipe> iterPipes = (Set<IMechanicalPipe>) transmitters.clone();
|
||||
Iterator it = iterPipes.iterator();
|
||||
|
||||
possibleAcceptors.clear();
|
||||
|
@ -126,7 +121,7 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||
{
|
||||
it.remove();
|
||||
pipes.remove(conductor);
|
||||
transmitters.remove(conductor);
|
||||
}
|
||||
else {
|
||||
conductor.setNetwork(this);
|
||||
|
@ -159,17 +154,12 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
newNetwork.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllPipes(Set<IMechanicalPipe> newPipes)
|
||||
{
|
||||
pipes.addAll(newPipes);
|
||||
}
|
||||
|
||||
public void split(IMechanicalPipe splitPoint)
|
||||
{
|
||||
if(splitPoint instanceof TileEntity)
|
||||
{
|
||||
removePipe(splitPoint);
|
||||
removeTransmitter(splitPoint);
|
||||
|
||||
TileEntity[] connectedBlocks = new TileEntity[6];
|
||||
boolean[] dealtWith = {false, false, false, false, false, false};
|
||||
|
@ -255,33 +245,6 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
}
|
||||
}
|
||||
|
||||
public void removePipe(IMechanicalPipe pipe)
|
||||
{
|
||||
pipes.remove(pipe);
|
||||
if(pipes.size() == 0)
|
||||
{
|
||||
deregister();
|
||||
}
|
||||
}
|
||||
|
||||
public void register()
|
||||
{
|
||||
try {
|
||||
IMechanicalPipe aPipe = pipes.iterator().next();
|
||||
|
||||
if(aPipe instanceof TileEntity && !((TileEntity)aPipe).worldObj.isRemote)
|
||||
{
|
||||
TransmitterNetworkRegistry.getInstance().registerNetwork(this);
|
||||
}
|
||||
} catch(NoSuchElementException e) {}
|
||||
}
|
||||
|
||||
public void deregister()
|
||||
{
|
||||
pipes.clear();
|
||||
TransmitterNetworkRegistry.getInstance().removeNetwork(this);
|
||||
}
|
||||
|
||||
public static class NetworkFinder
|
||||
{
|
||||
public World worldObj;
|
||||
|
@ -377,7 +340,7 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
if(ticksSinceCreate > 1200)
|
||||
{
|
||||
ticksSinceCreate = 0;
|
||||
fixMessedUpNetwork(pipes.iterator().next());
|
||||
fixMessedUpNetwork(transmitters.iterator().next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,12 +348,6 @@ public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[FluidNetwork] " + pipes.size() + " pipes, " + possibleAcceptors.size() + " acceptors.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return pipes.size();
|
||||
return "[FluidNetwork] " + transmitters.size() + " transmitters, " + possibleAcceptors.size() + " acceptors.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,16 +21,11 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
|
||||
public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetwork
|
||||
public class InventoryNetwork extends DynamicNetwork<ILogisticalTransporter, IInventory>
|
||||
{
|
||||
public HashSet<ILogisticalTransporter> transporters = new HashSet<ILogisticalTransporter>();
|
||||
|
||||
public Set<IInventory> possibleAcceptors = new HashSet<IInventory>();
|
||||
public Map<IInventory, ForgeDirection> acceptorDirections = new HashMap<IInventory, ForgeDirection>();
|
||||
|
||||
public InventoryNetwork(ILogisticalTransporter... varTransporters)
|
||||
{
|
||||
transporters.addAll(Arrays.asList(varTransporters));
|
||||
transmitters.addAll(Arrays.asList(varTransporters));
|
||||
register();
|
||||
}
|
||||
|
||||
|
@ -40,7 +35,7 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
{
|
||||
if(net != null)
|
||||
{
|
||||
addAllTransporters(net.transporters);
|
||||
addAllTransmitters(net.transmitters);
|
||||
net.deregister();
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +46,7 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
|
||||
public void refresh()
|
||||
{
|
||||
Set<ILogisticalTransporter> iterPipes = (Set<ILogisticalTransporter>)transporters.clone();
|
||||
Set<ILogisticalTransporter> iterPipes = (Set<ILogisticalTransporter>)transmitters.clone();
|
||||
Iterator it = iterPipes.iterator();
|
||||
|
||||
possibleAcceptors.clear();
|
||||
|
@ -64,7 +59,7 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||
{
|
||||
it.remove();
|
||||
transporters.remove(conductor);
|
||||
transmitters.remove(conductor);
|
||||
}
|
||||
else {
|
||||
conductor.setNetwork(this);
|
||||
|
@ -97,17 +92,12 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
newNetwork.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllTransporters(Set<ILogisticalTransporter> newPipes)
|
||||
{
|
||||
transporters.addAll(newPipes);
|
||||
}
|
||||
|
||||
public void split(ILogisticalTransporter splitPoint)
|
||||
{
|
||||
if(splitPoint instanceof TileEntity)
|
||||
{
|
||||
removeTransporter(splitPoint);
|
||||
removeTransmitter(splitPoint);
|
||||
|
||||
TileEntity[] connectedBlocks = new TileEntity[6];
|
||||
boolean[] dealtWith = {false, false, false, false, false, false};
|
||||
|
@ -194,34 +184,6 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
}
|
||||
}
|
||||
|
||||
public void removeTransporter(ILogisticalTransporter pipe)
|
||||
{
|
||||
transporters.remove(pipe);
|
||||
if(transporters.size() == 0)
|
||||
{
|
||||
deregister();
|
||||
}
|
||||
}
|
||||
|
||||
public void register()
|
||||
{
|
||||
try {
|
||||
ILogisticalTransporter aTransporter = transporters.iterator().next();
|
||||
|
||||
if(aTransporter instanceof TileEntity && !((TileEntity)aTransporter).worldObj.isRemote)
|
||||
{
|
||||
TransmitterNetworkRegistry.getInstance().registerNetwork(this);
|
||||
}
|
||||
} catch(NoSuchElementException e) {}
|
||||
}
|
||||
|
||||
public void deregister()
|
||||
{
|
||||
transporters.clear();
|
||||
|
||||
TransmitterNetworkRegistry.getInstance().removeNetwork(this);
|
||||
}
|
||||
|
||||
public static class NetworkFinder
|
||||
{
|
||||
public World worldObj;
|
||||
|
@ -304,7 +266,7 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
if(ticksSinceCreate > 1200)
|
||||
{
|
||||
ticksSinceCreate = 0;
|
||||
fixMessedUpNetwork(transporters.iterator().next());
|
||||
fixMessedUpNetwork(transmitters.iterator().next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,12 +274,6 @@ public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetw
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[InventoryNetwork] " + transporters.size() + " transporters, " + possibleAcceptors.size() + " acceptors.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return transporters.size();
|
||||
return "[InventoryNetwork] " + transmitters.size() + " transmitters, " + possibleAcceptors.size() + " acceptors.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ItemEnergyMeter extends ItemEnergized
|
|||
IUniversalCable cable = (IUniversalCable)tileEntity;
|
||||
|
||||
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
|
||||
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Cables: " + EnumColor.DARK_GREY + cable.getNetwork().cables.size()));
|
||||
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Cables: " + EnumColor.DARK_GREY + cable.getNetwork().transmitters.size()));
|
||||
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + cable.getNetwork().possibleAcceptors.size()));
|
||||
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Needed energy: " + EnumColor.DARK_GREY + ElectricityDisplay.getDisplay((float)(cable.getNetwork().getEnergyNeeded(new ArrayList())*Mekanism.TO_UE), ElectricUnit.JOULES)));
|
||||
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + ElectricityDisplay.getDisplay((float)(cable.getNetwork().getPower()*Mekanism.TO_UE), ElectricUnit.WATT)));
|
||||
|
|
|
@ -1220,7 +1220,7 @@ public class Mekanism
|
|||
public void onEnergyTransferred(EnergyTransferEvent event)
|
||||
{
|
||||
try {
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.ENERGY, event.energyNetwork.cables.iterator().next(), event.power));
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.ENERGY, event.energyNetwork.transmitters.iterator().next(), event.power));
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
|
@ -1228,7 +1228,7 @@ public class Mekanism
|
|||
public void onGasTransferred(GasTransferEvent event)
|
||||
{
|
||||
try {
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.GAS, event.gasNetwork.tubes.iterator().next(), event.transferType));
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.GAS, event.gasNetwork.transmitters.iterator().next(), event.transferType));
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
|
@ -1236,7 +1236,7 @@ public class Mekanism
|
|||
public void onLiquidTransferred(FluidTransferEvent event)
|
||||
{
|
||||
try {
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.FLUID, event.fluidNetwork.pipes.iterator().next(), event.fluidSent));
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.FLUID, event.fluidNetwork.transmitters.iterator().next(), event.fluidSent));
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
}
|
|
@ -58,11 +58,11 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ILogi
|
|||
else if(connectedNets.size() == 1)
|
||||
{
|
||||
inventoryNetwork = connectedNets.iterator().next();
|
||||
inventoryNetwork.transporters.add(this);
|
||||
inventoryNetwork.transmitters.add(this);
|
||||
}
|
||||
else {
|
||||
inventoryNetwork = new InventoryNetwork(connectedNets);
|
||||
inventoryNetwork.transporters.add(this);
|
||||
inventoryNetwork.transmitters.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ILogi
|
|||
{
|
||||
if(inventoryNetwork != null)
|
||||
{
|
||||
inventoryNetwork.removeTransporter(this);
|
||||
inventoryNetwork.removeTransmitter(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,11 +89,11 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
else if(connectedNets.size() == 1)
|
||||
{
|
||||
fluidNetwork = connectedNets.iterator().next();
|
||||
fluidNetwork.pipes.add(this);
|
||||
fluidNetwork.transmitters.add(this);
|
||||
}
|
||||
else {
|
||||
fluidNetwork = new FluidNetwork(connectedNets);
|
||||
fluidNetwork.pipes.add(this);
|
||||
fluidNetwork.transmitters.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
{
|
||||
if(fluidNetwork != null)
|
||||
{
|
||||
fluidNetwork.removePipe(this);
|
||||
fluidNetwork.removeTransmitter(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ public class TileEntityPressurizedTube extends TileEntity implements IPressurize
|
|||
else if(connectedNets.size() == 1)
|
||||
{
|
||||
gasNetwork = (GasNetwork)connectedNets.iterator().next();
|
||||
gasNetwork.tubes.add(this);
|
||||
gasNetwork.transmitters.add(this);
|
||||
}
|
||||
else {
|
||||
gasNetwork = new GasNetwork(connectedNets);
|
||||
gasNetwork.tubes.add(this);
|
||||
gasNetwork.transmitters.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class TileEntityPressurizedTube extends TileEntity implements IPressurize
|
|||
{
|
||||
if(gasNetwork != null)
|
||||
{
|
||||
gasNetwork.removeTube(this);
|
||||
gasNetwork.removeTransmitter(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa
|
|||
else if(connectedNets.size() == 1)
|
||||
{
|
||||
energyNetwork = connectedNets.iterator().next();
|
||||
energyNetwork.cables.add(this);
|
||||
energyNetwork.transmitters.add(this);
|
||||
}
|
||||
else {
|
||||
energyNetwork = new EnergyNetwork(connectedNets);
|
||||
energyNetwork.cables.add(this);
|
||||
energyNetwork.transmitters.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa
|
|||
{
|
||||
if(energyNetwork != null)
|
||||
{
|
||||
energyNetwork.removeCable(this);
|
||||
energyNetwork.removeTransmitter(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue