Universal cable support for accepting from UE machines. change *Network* to *TransmitterNetwork* in ITransmitter to avoid method name conflicts.

Not all IConductor methods are properly implemented, doesn't seem to cause problems in my testing. Could probably implement IElectricityNetwork in EnergyNetwork but this seems to work.
This commit is contained in:
Ben Spiers 2013-08-27 00:04:00 +01:00
parent 86b8499bb5
commit 9755b47833
17 changed files with 216 additions and 110 deletions

View file

@ -126,7 +126,7 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
transmitters.remove(conductor); transmitters.remove(conductor);
} }
else { else {
conductor.setNetwork(this); conductor.setTransmitterNetwork(this);
} }
} }

View file

@ -96,7 +96,7 @@ public final class GasTransmission
if(TransmissionType.checkTransmissionType(pointer, TransmissionType.GAS, sender)) if(TransmissionType.checkTransmissionType(pointer, TransmissionType.GAS, sender))
{ {
return ((ITransmitter<GasNetwork>)pointer).getNetwork().emit(amount, type, sender); return ((ITransmitter<GasNetwork>)pointer).getTransmitterNetwork().emit(amount, type, sender);
} }
return amount; return amount;
@ -122,7 +122,7 @@ public final class GasTransmission
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.GAS, pointer)) if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.GAS, pointer))
{ {
networks.add(((ITransmitter<GasNetwork>)sideTile).getNetwork()); networks.add(((ITransmitter<GasNetwork>)sideTile).getTransmitterNetwork());
} }
} }

View file

@ -111,7 +111,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity) transmitter)) if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity) transmitter))
{ {
((ITransmitter<N>)nodeTile).removeFromNetwork(); ((ITransmitter<N>)nodeTile).removeFromTransmitterNetwork();
newTransporters.add((ITransmitter<N>)nodeTile); newTransporters.add((ITransmitter<N>)nodeTile);
} }
} }

View file

@ -15,7 +15,7 @@ public interface ITransmitter<N>
* Gets the network currently in use by this transmitter segment. * Gets the network currently in use by this transmitter segment.
* @return network this transmitter is using * @return network this transmitter is using
*/ */
public N getNetwork(); public N getTransmitterNetwork();
/** /**
* Gets the network currently in use by this transmitter segment. * Gets the network currently in use by this transmitter segment.
@ -24,37 +24,37 @@ public interface ITransmitter<N>
* if none is available * if none is available
* @return network this transmitter is using * @return network this transmitter is using
*/ */
public N getNetwork(boolean createIfNull); public N getTransmitterNetwork(boolean createIfNull);
/** /**
* Sets this transmitter segment's network to a new value. * Sets this transmitter segment's network to a new value.
* @param network - network to set to * @param network - network to set to
*/ */
public void setNetwork(N network); public void setTransmitterNetwork(N network);
/** /**
* Refreshes the transmitter's network. * Refreshes the transmitter's network.
*/ */
public void refreshNetwork(); public void refreshTransmitterNetwork();
/** /**
* Remove this transmitter from its network. * Remove this transmitter from its network.
*/ */
public void removeFromNetwork(); public void removeFromTransmitterNetwork();
/** /**
* Call this if you're worried a transmitter's network is messed up and you want * Call this if you're worried a transmitter's network is messed up and you want
* it to try and fix itself. * it to try and fix itself.
*/ */
public void fixNetwork(); public void fixTransmitterNetwork();
public boolean areNetworksEqual(TileEntity tileEntity); public boolean areTransmitterNetworksEqual(TileEntity tileEntity);
public int getNetworkSize(); public int getTransmitterNetworkSize();
public int getNetworkAcceptorSize(); public int getTransmitterNetworkAcceptorSize();
public String getNetworkNeeded(); public String getTransmitterNetworkNeeded();
public String getNetworkFlow(); public String getTransmitterNetworkFlow();
} }

View file

@ -140,7 +140,7 @@ public class TransmitterNetworkRegistry implements ITickHandler
if(tileEntity instanceof ITransmitter) if(tileEntity instanceof ITransmitter)
{ {
((ITransmitter)tileEntity).refreshNetwork(); ((ITransmitter)tileEntity).refreshTransmitterNetwork();
} }
} }
} }

View file

@ -220,7 +220,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
transmitters.remove(conductor); transmitters.remove(conductor);
} }
else { else {
conductor.setNetwork(this); conductor.setTransmitterNetwork(this);
} }
} }

View file

@ -150,7 +150,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
transmitters.remove(conductor); transmitters.remove(conductor);
} }
else { else {
conductor.setNetwork(this); conductor.setTransmitterNetwork(this);
} }
} }

View file

@ -70,7 +70,7 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
transmitters.remove(conductor); transmitters.remove(conductor);
} }
else { else {
conductor.setNetwork(this); conductor.setTransmitterNetwork(this);
} }
} }

View file

@ -271,7 +271,7 @@ public class BlockTransmitter extends Block
if(!world.isRemote) if(!world.isRemote)
{ {
((ITransmitter)tileEntity).refreshNetwork(); ((ITransmitter)tileEntity).refreshTransmitterNetwork();
} }
} }
@ -282,7 +282,7 @@ public class BlockTransmitter extends Block
if(!world.isRemote) if(!world.isRemote)
{ {
((ITransmitter)tileEntity).refreshNetwork(); ((ITransmitter)tileEntity).refreshTransmitterNetwork();
} }
} }

View file

@ -77,7 +77,7 @@ public class ItemConfigurator extends ItemEnergized
} }
else if(world.getBlockTileEntity(x, y, z) instanceof ITransmitter) else if(world.getBlockTileEntity(x, y, z) instanceof ITransmitter)
{ {
((ITransmitter)world.getBlockTileEntity(x, y, z)).fixNetwork(); ((ITransmitter)world.getBlockTileEntity(x, y, z)).fixTransmitterNetwork();
} }
if(getState(stack) == 0) if(getState(stack) == 0)

View file

@ -35,10 +35,10 @@ public class ItemNetworkReader extends ItemEnergized
ITransmitter transmitter = (ITransmitter)tileEntity; ITransmitter transmitter = (ITransmitter)tileEntity;
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getNetworkSize())); player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkSize()));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getNetworkAcceptorSize())); player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkAcceptorSize()));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getNetworkNeeded())); player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkNeeded()));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + transmitter.getNetworkFlow() )); player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkFlow() ));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
} }
} }

View file

@ -34,7 +34,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
} }
@Override @Override
public InventoryNetwork getNetwork(boolean createIfNull) public InventoryNetwork getTransmitterNetwork(boolean createIfNull)
{ {
if(theNetwork == null && createIfNull) if(theNetwork == null && createIfNull)
{ {
@ -44,9 +44,9 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
for(TileEntity transporter : adjacentTransporters) for(TileEntity transporter : adjacentTransporters)
{ {
if(TransmissionType.checkTransmissionType(transporter, getTransmissionType()) && ((ITransmitter<InventoryNetwork>)transporter).getNetwork(false) != null) if(TransmissionType.checkTransmissionType(transporter, getTransmissionType()) && ((ITransmitter<InventoryNetwork>)transporter).getTransmitterNetwork(false) != null)
{ {
connectedNets.add(((ITransmitter<InventoryNetwork>)transporter).getNetwork()); connectedNets.add(((ITransmitter<InventoryNetwork>)transporter).getTransmitterNetwork());
} }
} }
@ -69,9 +69,9 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
} }
@Override @Override
public void fixNetwork() public void fixTransmitterNetwork()
{ {
getNetwork().fixMessedUpNetwork(this); getTransmitterNetwork().fixMessedUpNetwork(this);
} }
@Override @Override
@ -79,14 +79,14 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
getNetwork().split(this); getTransmitterNetwork().split(this);
} }
super.invalidate(); super.invalidate();
} }
@Override @Override
public void removeFromNetwork() public void removeFromTransmitterNetwork()
{ {
if(theNetwork != null) if(theNetwork != null)
{ {
@ -95,7 +95,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
} }
@Override @Override
public void refreshNetwork() public void refreshTransmitterNetwork()
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
@ -105,11 +105,11 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType())) if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
{ {
getNetwork().merge(((ITransmitter<InventoryNetwork>)tileEntity).getNetwork()); getTransmitterNetwork().merge(((ITransmitter<InventoryNetwork>)tileEntity).getTransmitterNetwork());
} }
} }
getNetwork().refresh(); getTransmitterNetwork().refresh();
} }
} }
@ -167,26 +167,26 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
} }
@Override @Override
public int getNetworkSize() public int getTransmitterNetworkSize()
{ {
return getNetwork().getSize(); return getTransmitterNetwork().getSize();
} }
@Override @Override
public int getNetworkAcceptorSize() public int getTransmitterNetworkAcceptorSize()
{ {
return getNetwork().getAcceptorSize(); return getTransmitterNetwork().getAcceptorSize();
} }
@Override @Override
public String getNetworkNeeded() public String getTransmitterNetworkNeeded()
{ {
return getNetwork().getNeeded(); return getTransmitterNetwork().getNeeded();
} }
@Override @Override
public String getNetworkFlow() public String getTransmitterNetworkFlow()
{ {
return getNetwork().getFlow(); return getTransmitterNetwork().getFlow();
} }
} }

View file

@ -63,7 +63,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
} }
@Override @Override
public FluidNetwork getNetwork(boolean createIfNull) public FluidNetwork getTransmitterNetwork(boolean createIfNull)
{ {
if(theNetwork == null && createIfNull) if(theNetwork == null && createIfNull)
{ {
@ -72,9 +72,9 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
for(TileEntity pipe : adjacentPipes) for(TileEntity pipe : adjacentPipes)
{ {
if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter<FluidNetwork>)pipe).getNetwork(false) != null) if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter<FluidNetwork>)pipe).getTransmitterNetwork(false) != null)
{ {
connectedNets.add(((ITransmitter<FluidNetwork>)pipe).getNetwork()); connectedNets.add(((ITransmitter<FluidNetwork>)pipe).getTransmitterNetwork());
} }
} }
@ -97,9 +97,9 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
} }
@Override @Override
public void fixNetwork() public void fixTransmitterNetwork()
{ {
getNetwork().fixMessedUpNetwork(this); getTransmitterNetwork().fixMessedUpNetwork(this);
} }
@Override @Override
@ -107,14 +107,14 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
getNetwork().split(this); getTransmitterNetwork().split(this);
} }
super.invalidate(); super.invalidate();
} }
@Override @Override
public void removeFromNetwork() public void removeFromTransmitterNetwork()
{ {
if(theNetwork != null) if(theNetwork != null)
{ {
@ -123,7 +123,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
} }
@Override @Override
public void refreshNetwork() public void refreshTransmitterNetwork()
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
@ -133,11 +133,11 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType())) if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
{ {
getNetwork().merge(((ITransmitter<FluidNetwork>)tileEntity).getNetwork()); getTransmitterNetwork().merge(((ITransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork());
} }
} }
getNetwork().refresh(); getTransmitterNetwork().refresh();
} }
} }
@ -169,7 +169,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
if(received != null && received.amount != 0) if(received != null && received.amount != 0)
{ {
container.drain(side, getNetwork().emit(received, true, Object3D.get(this).getFromSide(side).getTileEntity(worldObj)), true); container.drain(side, getTransmitterNetwork().emit(received, true, Object3D.get(this).getFromSide(side).getTileEntity(worldObj)), true);
} }
} }
} }
@ -235,7 +235,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
{ {
if(!isActive) if(!isActive)
{ {
return getNetwork().emit(resource, doFill, Object3D.get(this).getFromSide(from).getTileEntity(worldObj)); return getTransmitterNetwork().emit(resource, doFill, Object3D.get(this).getFromSide(from).getTileEntity(worldObj));
} }
return 0; return 0;
@ -272,26 +272,26 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
} }
@Override @Override
public int getNetworkSize() public int getTransmitterNetworkSize()
{ {
return getNetwork().getSize(); return getTransmitterNetwork().getSize();
} }
@Override @Override
public int getNetworkAcceptorSize() public int getTransmitterNetworkAcceptorSize()
{ {
return getNetwork().getAcceptorSize(); return getTransmitterNetwork().getAcceptorSize();
} }
@Override @Override
public String getNetworkNeeded() public String getTransmitterNetworkNeeded()
{ {
return getNetwork().getNeeded(); return getTransmitterNetwork().getNeeded();
} }
@Override @Override
public String getNetworkFlow() public String getTransmitterNetworkFlow()
{ {
return getNetwork().getFlow(); return getTransmitterNetwork().getFlow();
} }
} }

View file

@ -28,7 +28,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
} }
@Override @Override
public GasNetwork getNetwork(boolean createIfNull) public GasNetwork getTransmitterNetwork(boolean createIfNull)
{ {
if(theNetwork == null && createIfNull) if(theNetwork == null && createIfNull)
{ {
@ -37,9 +37,9 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
for(TileEntity tube : adjacentTubes) for(TileEntity tube : adjacentTubes)
{ {
if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter<GasNetwork>)tube).getNetwork(false) != null) if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter<GasNetwork>)tube).getTransmitterNetwork(false) != null)
{ {
connectedNets.add(((ITransmitter<GasNetwork>)tube).getNetwork()); connectedNets.add(((ITransmitter<GasNetwork>)tube).getTransmitterNetwork());
} }
} }
@ -62,9 +62,9 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
} }
@Override @Override
public void fixNetwork() public void fixTransmitterNetwork()
{ {
getNetwork().fixMessedUpNetwork(this); getTransmitterNetwork().fixMessedUpNetwork(this);
} }
@Override @Override
@ -72,14 +72,14 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
getNetwork().split(this); getTransmitterNetwork().split(this);
} }
super.invalidate(); super.invalidate();
} }
@Override @Override
public void removeFromNetwork() public void removeFromTransmitterNetwork()
{ {
if(theNetwork != null) if(theNetwork != null)
{ {
@ -88,7 +88,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
} }
@Override @Override
public void refreshNetwork() public void refreshTransmitterNetwork()
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
@ -98,11 +98,11 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, this)) if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, this))
{ {
getNetwork().merge(((ITransmitter<GasNetwork>)tileEntity).getNetwork()); getTransmitterNetwork().merge(((ITransmitter<GasNetwork>)tileEntity).getTransmitterNetwork());
} }
} }
getNetwork().refresh(); getTransmitterNetwork().refresh();
} }
} }
@ -132,27 +132,27 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
} }
@Override @Override
public int getNetworkSize() public int getTransmitterNetworkSize()
{ {
return getNetwork().getSize(); return getTransmitterNetwork().getSize();
} }
@Override @Override
public int getNetworkAcceptorSize() public int getTransmitterNetworkAcceptorSize()
{ {
return getNetwork().getAcceptorSize(); return getTransmitterNetwork().getAcceptorSize();
} }
@Override @Override
public String getNetworkNeeded() public String getTransmitterNetworkNeeded()
{ {
return getNetwork().getNeeded(); return getTransmitterNetwork().getNeeded();
} }
@Override @Override
public String getNetworkFlow() public String getTransmitterNetworkFlow()
{ {
return getNetwork().getFlow(); return getTransmitterNetwork().getFlow();
} }
@Override @Override

View file

@ -26,24 +26,24 @@ public abstract class TileEntityTransmitter<N> extends TileEntity implements ITr
} }
@Override @Override
public void setNetwork(N network) public void setTransmitterNetwork(N network)
{ {
if(network != theNetwork) if(network != theNetwork)
{ {
removeFromNetwork(); removeFromTransmitterNetwork();
theNetwork = network; theNetwork = network;
} }
} }
@Override @Override
public boolean areNetworksEqual(TileEntity tileEntity) public boolean areTransmitterNetworksEqual(TileEntity tileEntity)
{ {
return tileEntity instanceof ITransmitter && getTransmissionType() == ((ITransmitter)tileEntity).getTransmissionType(); return tileEntity instanceof ITransmitter && getTransmissionType() == ((ITransmitter)tileEntity).getTransmissionType();
} }
@Override @Override
public N getNetwork() public N getTransmitterNetwork()
{ {
return getNetwork(true); return getTransmitterNetwork(true);
} }
} }

View file

@ -4,8 +4,13 @@ import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergyTile; import ic2.api.energy.tile.IEnergyTile;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import universalelectricity.core.block.IConductor;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.grid.IElectricityNetwork;
import mekanism.api.Object3D; import mekanism.api.Object3D;
import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.ITransmitter;
import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmissionType;
@ -19,15 +24,19 @@ import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler; import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver; import buildcraft.api.power.PowerHandler.PowerReceiver;
public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwork> implements IPowerReceptor, IEnergyTile, IEnergySink public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwork> implements IPowerReceptor, IEnergyTile, IEnergySink, IConductor
{ {
/** A fake power handler used to initiate energy transfer calculations. */ /** A fake power handler used to initiate energy transfer calculations. */
public PowerHandler powerHandler; public PowerHandler powerHandler;
/** A fake UE ElectricityNetwork used to accept power from EU machines */
public IElectricityNetwork ueNetwork;
public double energyScale; public double energyScale;
public TileEntityUniversalCable() public TileEntityUniversalCable()
{ {
ueNetwork = new FakeUENetwork();
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE); powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
powerHandler.configure(0, 100, 0, 100); powerHandler.configure(0, 100, 0, 100);
} }
@ -45,7 +54,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
} }
@Override @Override
public EnergyNetwork getNetwork(boolean createIfNull) public EnergyNetwork getTransmitterNetwork(boolean createIfNull)
{ {
if(theNetwork == null && createIfNull) if(theNetwork == null && createIfNull)
{ {
@ -54,9 +63,9 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
for(TileEntity cable : adjacentCables) for(TileEntity cable : adjacentCables)
{ {
if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<EnergyNetwork>)cable).getNetwork(false) != null) if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<EnergyNetwork>)cable).getTransmitterNetwork(false) != null)
{ {
connectedNets.add(((ITransmitter<EnergyNetwork>)cable).getNetwork()); connectedNets.add(((ITransmitter<EnergyNetwork>)cable).getTransmitterNetwork());
} }
} }
@ -79,9 +88,9 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
} }
@Override @Override
public void fixNetwork() public void fixTransmitterNetwork()
{ {
getNetwork().fixMessedUpNetwork(this); getTransmitterNetwork().fixMessedUpNetwork(this);
} }
@Override @Override
@ -89,14 +98,14 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
getNetwork().split(this); getTransmitterNetwork().split(this);
} }
super.invalidate(); super.invalidate();
} }
@Override @Override
public void removeFromNetwork() public void removeFromTransmitterNetwork()
{ {
if(theNetwork != null) if(theNetwork != null)
{ {
@ -105,7 +114,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
} }
@Override @Override
public void refreshNetwork() public void refreshTransmitterNetwork()
{ {
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
@ -115,11 +124,11 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.ENERGY)) if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
{ {
getNetwork().merge(((ITransmitter<EnergyNetwork>)tileEntity).getNetwork()); getTransmitterNetwork().merge(((ITransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork());
} }
} }
getNetwork().refresh(); getTransmitterNetwork().refresh();
} }
} }
@ -157,7 +166,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
@Override @Override
public double demandedEnergyUnits() public double demandedEnergyUnits()
{ {
return getNetwork().getEnergyNeeded(new ArrayList())*Mekanism.TO_IC2; return getTransmitterNetwork().getEnergyNeeded(new ArrayList())*Mekanism.TO_IC2;
} }
@Override @Override
@ -165,7 +174,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
{ {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(Object3D.get(this).getFromSide(direction).getTileEntity(worldObj)); list.add(Object3D.get(this).getFromSide(direction).getTileEntity(worldObj));
return getNetwork().emit(i, list); return getTransmitterNetwork().emit(i, list);
} }
@Override @Override
@ -175,26 +184,123 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
} }
@Override @Override
public int getNetworkSize() public int getTransmitterNetworkSize()
{ {
return getNetwork().getSize(); return getTransmitterNetwork().getSize();
} }
@Override @Override
public int getNetworkAcceptorSize() public int getTransmitterNetworkAcceptorSize()
{ {
return getNetwork().getAcceptorSize(); return getTransmitterNetwork().getAcceptorSize();
} }
@Override @Override
public String getNetworkNeeded() public String getTransmitterNetworkNeeded()
{ {
return getNetwork().getNeeded(); return getTransmitterNetwork().getNeeded();
} }
@Override @Override
public String getNetworkFlow() public String getTransmitterNetworkFlow()
{ {
return getNetwork().getFlow(); return getTransmitterNetwork().getFlow();
}
@Override
public IElectricityNetwork getNetwork()
{
return ueNetwork;
}
@Override
public void setNetwork(IElectricityNetwork network) {}
@Override
public TileEntity[] getAdjacentConnections()
{
return new TileEntity[6];
}
@Override
public void refresh()
{
refreshTransmitterNetwork();
}
@Override
public boolean canConnect(ForgeDirection direction)
{
return true;
}
@Override
public float getResistance()
{
return 0;
}
@Override
public float getCurrentCapacity()
{
return Integer.MAX_VALUE;
}
public class FakeUENetwork implements IElectricityNetwork
{
@Override
public void split(IConductor connection) {}
@Override
public void refresh() {}
@Override
public void merge(IElectricityNetwork network) {}
@Override
public ArrayList<ForgeDirection> getPossibleDirections(TileEntity tile)
{
return new ArrayList<ForgeDirection>();
}
@Override
public Set<IConductor> getConductors()
{
return new HashSet<IConductor>();
}
@Override
public Set<TileEntity> getAcceptors()
{
return getTransmitterNetwork().getAcceptors();
}
@Override
public float produce(ElectricityPack electricityPack, TileEntity... ignoreTiles)
{
ArrayList<TileEntity> ignore = new ArrayList<TileEntity>();
ignore.addAll(Arrays.asList(ignoreTiles));
double energy = electricityPack.getWatts() * Mekanism.FROM_UE;
return (float)getTransmitterNetwork().emit(energy, ignore);
}
@Override
public float getTotalResistance()
{
return 0;
}
@Override
public ElectricityPack getRequest(TileEntity... ignoreTiles)
{
return ElectricityPack.getFromWatts((float)getTransmitterNetwork().getEnergyNeeded(new ArrayList<TileEntity>()), 0.12F);
}
@Override
public float getLowestCurrentCapacity()
{
return Integer.MAX_VALUE;
}
} }
} }

View file

@ -202,7 +202,7 @@ public final class CableUtils
ArrayList<TileEntity> ignored = new ArrayList<TileEntity>(); ArrayList<TileEntity> ignored = new ArrayList<TileEntity>();
ignored.add(sender); ignored.add(sender);
return cable.getNetwork().emit(amount, ignored); return cable.getTransmitterNetwork().emit(amount, ignored);
} }
return amount; return amount;
@ -230,7 +230,7 @@ public final class CableUtils
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.ENERGY) && !ignored.contains(sideTile)) if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.ENERGY) && !ignored.contains(sideTile))
{ {
networks.add(((ITransmitter<EnergyNetwork>)sideTile).getNetwork()); networks.add(((ITransmitter<EnergyNetwork>)sideTile).getTransmitterNetwork());
} }
} }