From 2cf6fdc18ca006718087b0800884865e17bdcf91 Mon Sep 17 00:00:00 2001 From: Aidan Brady <aidancbrady@aol.com> Date: Fri, 20 Dec 2013 19:12:33 -0500 Subject: [PATCH] Lots more work --- common/mekanism/api/gas/GasNetwork.java | 20 +-- common/mekanism/api/gas/GasTransmission.java | 4 +- common/mekanism/api/gas/IGasTransmitter.java | 4 +- .../api/transmitters/DynamicNetwork.java | 26 ++-- .../api/transmitters/IGridTransmitter.java | 63 +++++++++ .../api/transmitters/ITransmitter.java | 61 +-------- .../api/transmitters/ITransmitterNetwork.java | 6 +- .../api/transmitters/TransmissionType.java | 2 +- .../TransmitterNetworkRegistry.java | 6 +- common/mekanism/common/EnergyNetwork.java | 22 +-- common/mekanism/common/FluidNetwork.java | 18 +-- .../common/block/BlockEnergyCube.java | 2 +- .../common/block/BlockTransmitter.java | 10 +- .../mekanism/common/item/ItemDictionary.java | 2 +- .../common/item/ItemNetworkReader.java | 6 +- .../common/multipart/ItemPartTransmitter.java | 6 +- .../common/multipart/MultipartMekanism.java | 1 + .../multipart/PartDiversionTransporter.java | 9 -- .../multipart/PartLogisticalTransporter.java | 79 ++++++++++- .../common/multipart/PartMechanicalPipe.java | 4 +- .../common/multipart/PartPressurizedTube.java | 4 +- .../common/multipart/PartSidedPipe.java | 101 +++++++++++++- .../common/multipart/PartTransmitter.java | 127 +++++------------- .../common/multipart/PartUniversalCable.java | 4 +- .../common/network/PacketDataRequest.java | 6 +- .../network/PacketTransmitterUpdate.java | 10 +- .../tileentity/TileEntityDynamicValve.java | 3 +- .../tileentity/TileEntityElectricPump.java | 5 +- .../tileentity/TileEntityMechanicalPipe.java | 8 +- .../tileentity/TileEntityPressurizedTube.java | 8 +- .../TileEntityRotaryCondensentrator.java | 3 +- .../tileentity/TileEntityTransmitter.java | 6 +- .../tileentity/TileEntityUniversalCable.java | 8 +- common/mekanism/common/util/CableUtils.java | 10 +- common/mekanism/common/util/PipeUtils.java | 10 +- .../common/util/TransporterUtils.java | 4 +- 36 files changed, 386 insertions(+), 282 deletions(-) create mode 100644 common/mekanism/api/transmitters/IGridTransmitter.java diff --git a/common/mekanism/api/gas/GasNetwork.java b/common/mekanism/api/gas/GasNetwork.java index a615b8e17..b0d8c9269 100644 --- a/common/mekanism/api/gas/GasNetwork.java +++ b/common/mekanism/api/gas/GasNetwork.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Set; import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.ITransmitterNetwork; import mekanism.api.transmitters.TransmissionType; import mekanism.common.FluidNetwork; @@ -36,13 +36,13 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork> public GasStack gasStored; public int prevStored; - public GasNetwork(ITransmitter<GasNetwork>... varPipes) + public GasNetwork(IGridTransmitter<GasNetwork>... varPipes) { transmitters.addAll(Arrays.asList(varPipes)); register(); } - public GasNetwork(Collection<ITransmitter<GasNetwork>> collection) + public GasNetwork(Collection<IGridTransmitter<GasNetwork>> collection) { transmitters.addAll(collection); register(); @@ -290,15 +290,15 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork> @Override public synchronized void refresh() { - Set<ITransmitter<GasNetwork>> iterTubes = (Set<ITransmitter<GasNetwork>>)transmitters.clone(); - Iterator<ITransmitter<GasNetwork>> it = iterTubes.iterator(); + Set<IGridTransmitter<GasNetwork>> iterTubes = (Set<IGridTransmitter<GasNetwork>>)transmitters.clone(); + Iterator<IGridTransmitter<GasNetwork>> it = iterTubes.iterator(); possibleAcceptors.clear(); acceptorDirections.clear(); while(it.hasNext()) { - ITransmitter<GasNetwork> conductor = (ITransmitter<GasNetwork>)it.next(); + IGridTransmitter<GasNetwork> conductor = (IGridTransmitter<GasNetwork>)it.next(); if(conductor == null || ((TileEntity)conductor).isInvalid()) { @@ -310,7 +310,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork> } } - for(ITransmitter<GasNetwork> transmitter : transmitters) + for(IGridTransmitter<GasNetwork> transmitter : transmitters) { IGasHandler[] acceptors = GasTransmission.getConnectedAcceptors((TileEntity)transmitter); @@ -318,7 +318,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork> { ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)); - if(side != null && acceptor != null && !(acceptor instanceof ITransmitter) && transmitter.canConnectToAcceptor(side)) + if(side != null && acceptor != null && !(acceptor instanceof IGridTransmitter) && transmitter.canConnectToAcceptor(side)) { possibleAcceptors.add(acceptor); acceptorDirections.put(acceptor, ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor))); @@ -393,7 +393,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork> } @Override - protected GasNetwork create(ITransmitter<GasNetwork>... varTransmitters) + protected GasNetwork create(IGridTransmitter<GasNetwork>... varTransmitters) { GasNetwork network = new GasNetwork(varTransmitters); network.refGas = refGas; @@ -418,7 +418,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork> } @Override - protected GasNetwork create(Collection<ITransmitter<GasNetwork>> collection) + protected GasNetwork create(Collection<IGridTransmitter<GasNetwork>> collection) { GasNetwork network = new GasNetwork(collection); network.refGas = refGas; diff --git a/common/mekanism/api/gas/GasTransmission.java b/common/mekanism/api/gas/GasTransmission.java index 4b052d85c..3a60e0987 100644 --- a/common/mekanism/api/gas/GasTransmission.java +++ b/common/mekanism/api/gas/GasTransmission.java @@ -1,7 +1,7 @@ package mekanism.api.gas; import mekanism.api.Coord4D; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -107,7 +107,7 @@ public final class GasTransmission if(TransmissionType.checkTransmissionType(pointer, TransmissionType.GAS, sender)) { - return ((ITransmitter<GasNetwork>)pointer).getTransmitterNetwork().emit(stack); + return ((IGridTransmitter<GasNetwork>)pointer).getTransmitterNetwork().emit(stack); } return 0; diff --git a/common/mekanism/api/gas/IGasTransmitter.java b/common/mekanism/api/gas/IGasTransmitter.java index 454f4e2c4..820dfb929 100644 --- a/common/mekanism/api/gas/IGasTransmitter.java +++ b/common/mekanism/api/gas/IGasTransmitter.java @@ -1,9 +1,9 @@ package mekanism.api.gas; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import net.minecraft.tileentity.TileEntity; -public interface IGasTransmitter extends ITransmitter<GasNetwork> +public interface IGasTransmitter extends IGridTransmitter<GasNetwork> { public boolean canTransferGasToTube(TileEntity tile); } diff --git a/common/mekanism/api/transmitters/DynamicNetwork.java b/common/mekanism/api/transmitters/DynamicNetwork.java index 21a3c4f74..a2f4e8795 100644 --- a/common/mekanism/api/transmitters/DynamicNetwork.java +++ b/common/mekanism/api/transmitters/DynamicNetwork.java @@ -21,7 +21,7 @@ import cpw.mods.fml.common.FMLCommonHandler; public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implements ITransmitterNetwork<A, N>, IClientTicker { - public HashSet<ITransmitter<N>> transmitters = new HashSet<ITransmitter<N>>(); + public HashSet<IGridTransmitter<N>> transmitters = new HashSet<IGridTransmitter<N>>(); public HashSet<A> possibleAcceptors = new HashSet<A>(); public HashMap<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>(); @@ -34,19 +34,19 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen protected boolean needsUpdate = false; - protected abstract ITransmitterNetwork<A, N> create(ITransmitter<N>... varTransmitters); + protected abstract ITransmitterNetwork<A, N> create(IGridTransmitter<N>... varTransmitters); - protected abstract ITransmitterNetwork<A, N> create(Collection<ITransmitter<N>> collection); + protected abstract ITransmitterNetwork<A, N> create(Collection<IGridTransmitter<N>> collection); protected abstract ITransmitterNetwork<A, N> create(Set<N> networks); - public void addAllTransmitters(Set<ITransmitter<N>> newTransmitters) + public void addAllTransmitters(Set<IGridTransmitter<N>> newTransmitters) { transmitters.addAll(newTransmitters); } @Override - public void removeTransmitter(ITransmitter<N> transmitter) + public void removeTransmitter(IGridTransmitter<N> transmitter) { transmitters.remove(transmitter); @@ -60,7 +60,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen public void register() { try { - ITransmitter<N> aTransmitter = transmitters.iterator().next(); + IGridTransmitter<N> aTransmitter = transmitters.iterator().next(); if(aTransmitter instanceof TileEntity) { @@ -152,13 +152,13 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen } @Override - public synchronized void fixMessedUpNetwork(ITransmitter<N> transmitter) + public synchronized void fixMessedUpNetwork(IGridTransmitter<N> transmitter) { if(transmitter instanceof TileEntity) { NetworkFinder finder = new NetworkFinder(((TileEntity)transmitter).getWorldObj(), getTransmissionType(), Coord4D.get((TileEntity)transmitter)); List<Coord4D> partNetwork = finder.exploreNetwork(); - Set<ITransmitter<N>> newTransporters = new HashSet<ITransmitter<N>>(); + Set<IGridTransmitter<N>> newTransporters = new HashSet<IGridTransmitter<N>>(); for(Coord4D node : partNetwork) { @@ -166,8 +166,8 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity)transmitter)) { - ((ITransmitter<N>)nodeTile).removeFromTransmitterNetwork(); - newTransporters.add((ITransmitter<N>)nodeTile); + ((IGridTransmitter<N>)nodeTile).removeFromTransmitterNetwork(); + newTransporters.add((IGridTransmitter<N>)nodeTile); } } @@ -179,7 +179,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen } @Override - public synchronized void split(ITransmitter<N> splitPoint) + public synchronized void split(IGridTransmitter<N> splitPoint) { if(splitPoint instanceof TileEntity) { @@ -226,7 +226,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen } } - Set<ITransmitter<N>> newNetCables = new HashSet<ITransmitter<N>>(); + Set<IGridTransmitter<N>> newNetCables = new HashSet<IGridTransmitter<N>>(); for(Coord4D node : finder.iterated) { @@ -236,7 +236,7 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen { if(nodeTile != splitPoint) { - newNetCables.add((ITransmitter<N>)nodeTile); + newNetCables.add((IGridTransmitter<N>)nodeTile); } } } diff --git a/common/mekanism/api/transmitters/IGridTransmitter.java b/common/mekanism/api/transmitters/IGridTransmitter.java new file mode 100644 index 000000000..198e33a66 --- /dev/null +++ b/common/mekanism/api/transmitters/IGridTransmitter.java @@ -0,0 +1,63 @@ +package mekanism.api.transmitters; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +public interface IGridTransmitter<N extends DynamicNetwork<?, N>> extends ITransmitter +{ + /** + * Gets the network currently in use by this transmitter segment. + * @return network this transmitter is using + */ + public N getTransmitterNetwork(); + + /** + * Gets the network currently in use by this transmitter segment. + * @param createIfNull - If true, the transmitter will try and connect to an + * adjacent network, merging several if necessary, or creating a new one + * if none is available + * @return network this transmitter is using + */ + public N getTransmitterNetwork(boolean createIfNull); + + /** + * Sets this transmitter segment's network to a new value. + * @param network - network to set to + */ + public void setTransmitterNetwork(N network); + + /** + * Refreshes the transmitter's network. + */ + public void refreshTransmitterNetwork(); + + /** + * Called when the chunk this transmitter is in is loaded. + */ + public void chunkLoad(); + + /** + * Remove this transmitter from its network. + */ + public void removeFromTransmitterNetwork(); + + public boolean canConnectToAcceptor(ForgeDirection side); + + /** + * Call this if you're worried a transmitter's network is messed up and you want + * it to try and fix itself. + */ + public void fixTransmitterNetwork(); + + public boolean areTransmitterNetworksEqual(TileEntity tileEntity); + + public int getTransmitterNetworkSize(); + + public int getTransmitterNetworkAcceptorSize(); + + public String getTransmitterNetworkNeeded(); + + public String getTransmitterNetworkFlow(); + + public int getCapacity(); +} diff --git a/common/mekanism/api/transmitters/ITransmitter.java b/common/mekanism/api/transmitters/ITransmitter.java index c2b56c2b3..477a0dff0 100644 --- a/common/mekanism/api/transmitters/ITransmitter.java +++ b/common/mekanism/api/transmitters/ITransmitter.java @@ -1,9 +1,6 @@ package mekanism.api.transmitters; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; - -public interface ITransmitter<N extends DynamicNetwork<?, N>> +public interface ITransmitter { /** * Get the transmitter's transmission type @@ -11,60 +8,4 @@ public interface ITransmitter<N extends DynamicNetwork<?, N>> * @return TransmissionType this transmitter uses */ public TransmissionType getTransmissionType(); - - /** - * Gets the network currently in use by this transmitter segment. - * @return network this transmitter is using - */ - public N getTransmitterNetwork(); - - /** - * Gets the network currently in use by this transmitter segment. - * @param createIfNull - If true, the transmitter will try and connect to an - * adjacent network, merging several if necessary, or creating a new one - * if none is available - * @return network this transmitter is using - */ - public N getTransmitterNetwork(boolean createIfNull); - - /** - * Sets this transmitter segment's network to a new value. - * @param network - network to set to - */ - public void setTransmitterNetwork(N network); - - /** - * Refreshes the transmitter's network. - */ - public void refreshTransmitterNetwork(); - - /** - * Called when the chunk this transmitter is in is loaded. - */ - public void chunkLoad(); - - /** - * Remove this transmitter from its network. - */ - public void removeFromTransmitterNetwork(); - - public boolean canConnectToAcceptor(ForgeDirection side); - - /** - * Call this if you're worried a transmitter's network is messed up and you want - * it to try and fix itself. - */ - public void fixTransmitterNetwork(); - - public boolean areTransmitterNetworksEqual(TileEntity tileEntity); - - public int getTransmitterNetworkSize(); - - public int getTransmitterNetworkAcceptorSize(); - - public String getTransmitterNetworkNeeded(); - - public String getTransmitterNetworkFlow(); - - public int getCapacity(); } diff --git a/common/mekanism/api/transmitters/ITransmitterNetwork.java b/common/mekanism/api/transmitters/ITransmitterNetwork.java index 137bde344..8c2b0426d 100644 --- a/common/mekanism/api/transmitters/ITransmitterNetwork.java +++ b/common/mekanism/api/transmitters/ITransmitterNetwork.java @@ -17,15 +17,15 @@ public interface ITransmitterNetwork<A, N extends DynamicNetwork<A, N>> public Set<A> getAcceptors(Object... data); - public void removeTransmitter(ITransmitter<N> transmitter); + public void removeTransmitter(IGridTransmitter<N> transmitter); public void refresh(); - public void split(ITransmitter<N> splitPoint); + public void split(IGridTransmitter<N> splitPoint); public void merge(N network); - public void fixMessedUpNetwork(ITransmitter<N> transmitter); + public void fixMessedUpNetwork(IGridTransmitter<N> transmitter); public void register(); diff --git a/common/mekanism/api/transmitters/TransmissionType.java b/common/mekanism/api/transmitters/TransmissionType.java index e8821f5e5..36d85677b 100644 --- a/common/mekanism/api/transmitters/TransmissionType.java +++ b/common/mekanism/api/transmitters/TransmissionType.java @@ -24,7 +24,7 @@ public enum TransmissionType { if(sideTile instanceof ITransmitter) { - if(((ITransmitter<?>)sideTile).getTransmissionType() == this) + if(((ITransmitter)sideTile).getTransmissionType() == this) { return true; } diff --git a/common/mekanism/api/transmitters/TransmitterNetworkRegistry.java b/common/mekanism/api/transmitters/TransmitterNetworkRegistry.java index 8c6b3a828..eaddd957f 100644 --- a/common/mekanism/api/transmitters/TransmitterNetworkRegistry.java +++ b/common/mekanism/api/transmitters/TransmitterNetworkRegistry.java @@ -159,10 +159,10 @@ public class TransmitterNetworkRegistry implements ITickHandler { Object obj = iter.next(); - if(obj instanceof ITransmitter) + if(obj instanceof IGridTransmitter) { - ((ITransmitter)obj).refreshTransmitterNetwork(); - ((ITransmitter)obj).chunkLoad(); + ((IGridTransmitter)obj).refreshTransmitterNetwork(); + ((IGridTransmitter)obj).chunkLoad(); } } } diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index 93315655b..6072a2da2 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -13,7 +13,7 @@ import java.util.Set; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.common.util.CableUtils; import mekanism.common.util.ListUtils; @@ -42,13 +42,13 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> public double electricityStored; - public EnergyNetwork(ITransmitter<EnergyNetwork>... varCables) + public EnergyNetwork(IGridTransmitter<EnergyNetwork>... varCables) { transmitters.addAll(Arrays.asList(varCables)); register(); } - public EnergyNetwork(Collection<ITransmitter<EnergyNetwork>> collection) + public EnergyNetwork(Collection<IGridTransmitter<EnergyNetwork>> collection) { transmitters.addAll(collection); register(); @@ -91,7 +91,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> int numCables = transmitters.size(); double reciprocalSum = 0; - for(ITransmitter<EnergyNetwork> cable : transmitters) + for(IGridTransmitter<EnergyNetwork> cable : transmitters) { reciprocalSum += 1.0/(double)cable.getCapacity(); } @@ -339,15 +339,15 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> @Override public synchronized void refresh() { - Set<ITransmitter<EnergyNetwork>> iterCables = (Set<ITransmitter<EnergyNetwork>>)transmitters.clone(); - Iterator<ITransmitter<EnergyNetwork>> it = iterCables.iterator(); + Set<IGridTransmitter<EnergyNetwork>> iterCables = (Set<IGridTransmitter<EnergyNetwork>>)transmitters.clone(); + Iterator<IGridTransmitter<EnergyNetwork>> it = iterCables.iterator(); possibleAcceptors.clear(); acceptorDirections.clear(); while(it.hasNext()) { - ITransmitter<EnergyNetwork> conductor = (ITransmitter<EnergyNetwork>)it.next(); + IGridTransmitter<EnergyNetwork> conductor = (IGridTransmitter<EnergyNetwork>)it.next(); if(conductor == null || ((TileEntity)conductor).isInvalid()) { @@ -359,7 +359,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> } } - for(ITransmitter<EnergyNetwork> transmitter : iterCables) + for(IGridTransmitter<EnergyNetwork> transmitter : iterCables) { TileEntity[] acceptors = CableUtils.getConnectedEnergyAcceptors((TileEntity)transmitter); @@ -367,7 +367,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> { ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)); - if(side != null && acceptor != null && !(acceptor instanceof ITransmitter) && transmitter.canConnectToAcceptor(side)) + if(side != null && acceptor != null && !(acceptor instanceof IGridTransmitter) && transmitter.canConnectToAcceptor(side)) { possibleAcceptors.add(acceptor); acceptorDirections.put(acceptor, ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor))); @@ -458,7 +458,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> } @Override - protected EnergyNetwork create(ITransmitter<EnergyNetwork>... varTransmitters) + protected EnergyNetwork create(IGridTransmitter<EnergyNetwork>... varTransmitters) { EnergyNetwork network = new EnergyNetwork(varTransmitters); network.clientEnergyScale = clientEnergyScale; @@ -470,7 +470,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> } @Override - protected EnergyNetwork create(Collection<ITransmitter<EnergyNetwork>> collection) + protected EnergyNetwork create(Collection<IGridTransmitter<EnergyNetwork>> collection) { EnergyNetwork network = new EnergyNetwork(collection); network.clientEnergyScale = clientEnergyScale; diff --git a/common/mekanism/common/FluidNetwork.java b/common/mekanism/common/FluidNetwork.java index 68157bab4..47b6fdeb5 100644 --- a/common/mekanism/common/FluidNetwork.java +++ b/common/mekanism/common/FluidNetwork.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Set; import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.ITransmitterNetwork; import mekanism.api.transmitters.TransmissionType; import mekanism.common.tileentity.TileEntityMechanicalPipe; @@ -38,13 +38,13 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> public FluidStack fluidStored; public int prevStored; - public FluidNetwork(ITransmitter<FluidNetwork>... varPipes) + public FluidNetwork(IGridTransmitter<FluidNetwork>... varPipes) { transmitters.addAll(Arrays.asList(varPipes)); register(); } - public FluidNetwork(Collection<ITransmitter<FluidNetwork>> collection) + public FluidNetwork(Collection<IGridTransmitter<FluidNetwork>> collection) { transmitters.addAll(collection); register(); @@ -292,7 +292,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> @Override public synchronized void refresh() { - Set<ITransmitter<FluidNetwork>> iterPipes = (Set<ITransmitter<FluidNetwork>>)transmitters.clone(); + Set<IGridTransmitter<FluidNetwork>> iterPipes = (Set<IGridTransmitter<FluidNetwork>>)transmitters.clone(); Iterator it = iterPipes.iterator(); possibleAcceptors.clear(); @@ -300,7 +300,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> while(it.hasNext()) { - ITransmitter<FluidNetwork> conductor = (ITransmitter<FluidNetwork>)it.next(); + IGridTransmitter<FluidNetwork> conductor = (IGridTransmitter<FluidNetwork>)it.next(); if(conductor == null || ((TileEntity)conductor).isInvalid()) { @@ -312,7 +312,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> } } - for(ITransmitter<FluidNetwork> transmitter : iterPipes) + for(IGridTransmitter<FluidNetwork> transmitter : iterPipes) { IFluidHandler[] acceptors = PipeUtils.getConnectedAcceptors((TileEntity)transmitter); @@ -320,7 +320,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> { ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)); - if(side != null && acceptor != null && !(acceptor instanceof ITransmitter) && transmitter.canConnectToAcceptor(side)) + if(side != null && acceptor != null && !(acceptor instanceof IGridTransmitter) && transmitter.canConnectToAcceptor(side)) { possibleAcceptors.add(acceptor); acceptorDirections.put(acceptor, ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor))); @@ -369,7 +369,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> } @Override - protected FluidNetwork create(ITransmitter<FluidNetwork>... varTransmitters) + protected FluidNetwork create(IGridTransmitter<FluidNetwork>... varTransmitters) { FluidNetwork network = new FluidNetwork(varTransmitters); network.refFluid = refFluid; @@ -395,7 +395,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork> } @Override - protected FluidNetwork create(Collection<ITransmitter<FluidNetwork>> collection) + protected FluidNetwork create(Collection<IGridTransmitter<FluidNetwork>> collection) { FluidNetwork network = new FluidNetwork(collection); network.refFluid = refFluid; diff --git a/common/mekanism/common/block/BlockEnergyCube.java b/common/mekanism/common/block/BlockEnergyCube.java index 99eba8ce1..a25d83e77 100644 --- a/common/mekanism/common/block/BlockEnergyCube.java +++ b/common/mekanism/common/block/BlockEnergyCube.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Random; import mekanism.api.energy.IEnergizedItem; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.client.ClientProxy; import mekanism.common.IEnergyCube; import mekanism.common.ISustainedInventory; diff --git a/common/mekanism/common/block/BlockTransmitter.java b/common/mekanism/common/block/BlockTransmitter.java index 5a3654762..4373cc115 100644 --- a/common/mekanism/common/block/BlockTransmitter.java +++ b/common/mekanism/common/block/BlockTransmitter.java @@ -5,7 +5,7 @@ import java.util.List; import mekanism.api.gas.GasTransmission; import mekanism.api.gas.ITubeConnection; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.client.ClientProxy; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; @@ -312,9 +312,9 @@ public class BlockTransmitter extends Block if(!world.isRemote) { - if(tileEntity instanceof ITransmitter) + if(tileEntity instanceof IGridTransmitter) { - ((ITransmitter)tileEntity).refreshTransmitterNetwork(); + ((IGridTransmitter)tileEntity).refreshTransmitterNetwork(); PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketTransmitterUpdate().setParams(PacketType.UPDATE, tileEntity), world.provider.dimensionId); } } @@ -327,9 +327,9 @@ public class BlockTransmitter extends Block if(!world.isRemote) { - if(tileEntity instanceof ITransmitter) + if(tileEntity instanceof IGridTransmitter) { - ((ITransmitter)tileEntity).refreshTransmitterNetwork(); + ((IGridTransmitter)tileEntity).refreshTransmitterNetwork(); PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketTransmitterUpdate().setParams(PacketType.UPDATE, tileEntity), world.provider.dimensionId); if(tileEntity instanceof TileEntityUniversalCable) diff --git a/common/mekanism/common/item/ItemDictionary.java b/common/mekanism/common/item/ItemDictionary.java index 2b609c74b..18a5d2a9f 100644 --- a/common/mekanism/common/item/ItemDictionary.java +++ b/common/mekanism/common/item/ItemDictionary.java @@ -1,7 +1,7 @@ package mekanism.common.item; import mekanism.api.EnumColor; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.Mekanism; import mekanism.common.util.MekanismUtils; diff --git a/common/mekanism/common/item/ItemNetworkReader.java b/common/mekanism/common/item/ItemNetworkReader.java index 4bba6b1da..86965d28c 100644 --- a/common/mekanism/common/item/ItemNetworkReader.java +++ b/common/mekanism/common/item/ItemNetworkReader.java @@ -1,7 +1,7 @@ package mekanism.common.item; import mekanism.api.EnumColor; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.Mekanism; import net.minecraft.entity.player.EntityPlayer; @@ -26,13 +26,13 @@ public class ItemNetworkReader extends ItemEnergized { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - if(tileEntity instanceof ITransmitter) + if(tileEntity instanceof IGridTransmitter) { if(getEnergy(stack) >= ENERGY_PER_USE) { setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE); - ITransmitter<?> transmitter = (ITransmitter<?>)tileEntity; + IGridTransmitter<?> transmitter = (IGridTransmitter<?>)tileEntity; player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getSize())); diff --git a/common/mekanism/common/multipart/ItemPartTransmitter.java b/common/mekanism/common/multipart/ItemPartTransmitter.java index 6bd052597..82fb2121b 100644 --- a/common/mekanism/common/multipart/ItemPartTransmitter.java +++ b/common/mekanism/common/multipart/ItemPartTransmitter.java @@ -5,7 +5,7 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.ITransmitterNetwork; import mekanism.api.transmitters.TransmissionType; import mekanism.common.Mekanism; @@ -54,9 +54,9 @@ public class ItemPartTransmitter extends JItemMultiPart { TileEntity tile = obj.getFromSide(side).getTileEntity(world); - if(tile instanceof ITransmitter && TransmissionType.checkTransmissionType(tile, type)) + if(tile instanceof IGridTransmitter && TransmissionType.checkTransmissionType(tile, type)) { - networks.add(((ITransmitter)tile).getTransmitterNetwork()); + networks.add(((IGridTransmitter)tile).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/multipart/MultipartMekanism.java b/common/mekanism/common/multipart/MultipartMekanism.java index c9cf40b20..c21c1e89a 100644 --- a/common/mekanism/common/multipart/MultipartMekanism.java +++ b/common/mekanism/common/multipart/MultipartMekanism.java @@ -24,6 +24,7 @@ public class MultipartMekanism implements IPartFactory, IPartConverter "mekanism:restrictive_transporter", "mekanism:diversion_transporter"}); MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.ITransmitter"); + MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.IGridTransmitter"); MultipartGenerator.registerPassThroughInterface("mekanism.common.ILogisticalTransporter"); MultipartGenerator.registerPassThroughInterface("ic2.api.energy.tile.IEnergySink"); MultipartGenerator.registerPassThroughInterface("cofh.api.energy.IEnergyHandler"); diff --git a/common/mekanism/common/multipart/PartDiversionTransporter.java b/common/mekanism/common/multipart/PartDiversionTransporter.java index 8ab1ef340..3921b614d 100644 --- a/common/mekanism/common/multipart/PartDiversionTransporter.java +++ b/common/mekanism/common/multipart/PartDiversionTransporter.java @@ -39,15 +39,6 @@ public class PartDiversionTransporter extends PartLogisticalTransporter return transporterIcons.getCenterIcon(2); } - @Override - public boolean canConnect(ForgeDirection side) - { - testingSide = side; - boolean unblocked = tile().canReplacePart(this, this); - testingSide = null; - return unblocked; - } - @Override public void load(NBTTagCompound nbtTags) { diff --git a/common/mekanism/common/multipart/PartLogisticalTransporter.java b/common/mekanism/common/multipart/PartLogisticalTransporter.java index f8cf65f13..5820ce08b 100644 --- a/common/mekanism/common/multipart/PartLogisticalTransporter.java +++ b/common/mekanism/common/multipart/PartLogisticalTransporter.java @@ -6,6 +6,7 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.api.transmitters.TransmissionType; import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; import mekanism.common.HashList; @@ -20,6 +21,7 @@ import mekanism.common.transporter.TransporterStack; import mekanism.common.transporter.TransporterStack.Path; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.PipeUtils; import mekanism.common.util.TransporterUtils; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -66,6 +68,12 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { return TransmitterType.LOGISTICAL_TRANSPORTER; } + + @Override + public TransmissionType getTransmissionType() + { + return TransmissionType.ITEM; + } public static void registerIcons(IconRegister register) { @@ -80,6 +88,63 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { RenderPartTransmitter.getInstance().renderContents(this, f, pos); } + + @Override + public boolean canConnect(ForgeDirection side) + { + testingSide = side; + boolean unblocked = tile().canReplacePart(this, this); + testingSide = null; + return unblocked; + } + + @Override + public byte getPossibleTransmitterConnections() + { + byte connections = 0x00; + + for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) + { + if(canConnectMutual(side)) + { + TileEntity tileEntity = Coord4D.get(tile()).getFromSide(side).getTileEntity(world()); + + if(TransmissionType.checkTransmissionType(tileEntity, getTransmitter().getType()) && isConnectable(tileEntity)) + { + connections |= 1 << side.ordinal(); + } + else { + System.out.println("Invalid type " + getTransmitter().getType()); + } + } + else { + System.out.println("can't connect"); + } + } + + return connections; + } + + @Override + public byte getPossibleAcceptorConnections() + { + byte connections = 0x00; + + for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) + { + if(canConnectMutual(side)) + { + TileEntity tileEntity = Coord4D.get(tile()).getFromSide(side).getTileEntity(world()); + + if(isValidAcceptor(tileEntity, side)) + { + connections |= 1 << side.ordinal(); + } + } + } + + return connections; + } @Override public Icon getCenterIcon() @@ -550,7 +615,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return null; + return PipeUtils.EMPTY; } @Override @@ -594,12 +659,6 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti return true; } - - @Override - public boolean onRightClick(EntityPlayer player, int side) - { - return false; - } @Override public EnumColor getColor() @@ -618,4 +677,10 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { return tile(); } + + @Override + public EnumColor getRenderColor() + { + return color; + } } diff --git a/common/mekanism/common/multipart/PartMechanicalPipe.java b/common/mekanism/common/multipart/PartMechanicalPipe.java index 412b0ec13..d1bd3f63d 100644 --- a/common/mekanism/common/multipart/PartMechanicalPipe.java +++ b/common/mekanism/common/multipart/PartMechanicalPipe.java @@ -2,7 +2,7 @@ package mekanism.common.multipart; import java.util.Set; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; @@ -186,7 +186,7 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements } @Override - public FluidNetwork createNetworkFromSingleTransmitter(ITransmitter<FluidNetwork> transmitter) + public FluidNetwork createNetworkFromSingleTransmitter(IGridTransmitter<FluidNetwork> transmitter) { return new FluidNetwork(transmitter); } diff --git a/common/mekanism/common/multipart/PartPressurizedTube.java b/common/mekanism/common/multipart/PartPressurizedTube.java index 6e87b7c3f..ec9efd4d5 100644 --- a/common/mekanism/common/multipart/PartPressurizedTube.java +++ b/common/mekanism/common/multipart/PartPressurizedTube.java @@ -6,7 +6,7 @@ import mekanism.api.gas.GasNetwork; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; @@ -168,7 +168,7 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork> } @Override - public GasNetwork createNetworkFromSingleTransmitter(ITransmitter<GasNetwork> transmitter) + public GasNetwork createNetworkFromSingleTransmitter(IGridTransmitter<GasNetwork> transmitter) { return new GasNetwork(transmitter); } diff --git a/common/mekanism/common/multipart/PartSidedPipe.java b/common/mekanism/common/multipart/PartSidedPipe.java index 809a29804..a7dce7dcd 100644 --- a/common/mekanism/common/multipart/PartSidedPipe.java +++ b/common/mekanism/common/multipart/PartSidedPipe.java @@ -10,13 +10,19 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.transmitters.IBlockableConnection; +import mekanism.api.transmitters.IGridTransmitter; +import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.client.render.RenderPartTransmitter; import mekanism.common.IConfigurable; import mekanism.common.ITileNetwork; import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; +import mekanism.common.PacketHandler.Transmission; import mekanism.common.item.ItemConfigurator; import mekanism.common.multipart.TransmitterType.Size; +import mekanism.common.network.PacketTransmitterUpdate; +import mekanism.common.network.PacketTransmitterUpdate.PacketType; import net.minecraft.client.particle.EffectRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -49,7 +55,7 @@ import com.google.common.io.ByteArrayDataInput; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects, ITileNetwork, IBlockableConnection, IConfigurable +public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects, ITileNetwork, IBlockableConnection, IConfigurable, ITransmitter { public static IndexedCuboid6[] smallSides = new IndexedCuboid6[7]; public static IndexedCuboid6[] largeSides = new IndexedCuboid6[7]; @@ -118,6 +124,29 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, public abstract Icon getCenterIcon(); public abstract Icon getSideIcon(); + + @Override + public void update() + { + if(world().isRemote) + { + if(delayTicks == 5) + { + delayTicks = 6; /* don't refresh again */ + refreshConnections(); + } + else if(delayTicks < 5) + { + delayTicks++; + } + } + + if(sendDesc) + { + sendDescUpdate(); + sendDesc = false; + } + } public Icon getIconForSide(ForgeDirection side) { @@ -398,6 +427,74 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, { return true; } + + protected void onRedstoneSplit() {} + + protected void onRefresh() {} + + public void refreshConnections() + { + byte possibleTransmitters = getPossibleTransmitterConnections(); + byte possibleAcceptors = getPossibleAcceptorConnections(); + + if(possibleTransmitters != currentTransmitterConnections) + { + boolean nowPowered = world().isBlockIndirectlyGettingPowered(x(), y(), z()); + + if(nowPowered != redstonePowered) + { + if(nowPowered) + { + onRedstoneSplit(); + } + + tile().notifyPartChange(this); + + redstonePowered = nowPowered; + } + } + + if(!world().isRemote) + { + currentTransmitterConnections = possibleTransmitters; + currentAcceptorConnections = possibleAcceptors; + + sendDesc = true; + } + } + + protected void onModeChange(ForgeDirection side) + { + refreshConnections(); + } + + @Override + public void onAdded() + { + super.onAdded(); + refreshConnections(); + } + + @Override + public void onChunkLoad() + { + super.onChunkLoad(); + refreshConnections(); + } + + @Override + public void onNeighborChanged() + { + super.onNeighborChanged(); + refreshConnections(); + } + + @Override + public void onPartChanged(TMultiPart part) + { + super.onPartChanged(part); + refreshConnections(); + } @Override public void handlePacketData(ByteArrayDataInput dataStream) throws Exception {} @@ -457,8 +554,6 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, } } } - - public abstract void onModeChange(ForgeDirection side); @Override public boolean onSneakRightClick(EntityPlayer player, int side) diff --git a/common/mekanism/common/multipart/PartTransmitter.java b/common/mekanism/common/multipart/PartTransmitter.java index 8adf4b8dc..ac8a7c54f 100644 --- a/common/mekanism/common/multipart/PartTransmitter.java +++ b/common/mekanism/common/multipart/PartTransmitter.java @@ -6,7 +6,7 @@ import java.util.Set; import codechicken.multipart.*; import mekanism.api.Coord4D; import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.client.ClientTickHandler; @@ -19,7 +19,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; -public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends PartSidedPipe implements ITransmitter<N>, IConfigurable +public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends PartSidedPipe implements IGridTransmitter<N>, IConfigurable { public N theNetwork; @@ -30,35 +30,12 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa { getTransmitterNetwork().transmitters.remove(tile()); super.bind(t); - getTransmitterNetwork().transmitters.add((ITransmitter<N>)tile()); + getTransmitterNetwork().transmitters.add((IGridTransmitter<N>)tile()); } else { super.bind(t); } } - - @Override - public void update() - { - if(world().isRemote) - { - if(delayTicks == 5) - { - delayTicks = 6; /* don't refresh again */ - refreshTransmitterNetwork(); - } - else if(delayTicks < 5) - { - delayTicks++; - } - } - - if(sendDesc) - { - sendDescUpdate(); - sendDesc = false; - } - } public static boolean connectionMapContainsSide(byte connections, ForgeDirection side) { @@ -72,46 +49,33 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa byte possibleTransmitters = getPossibleTransmitterConnections(); byte possibleAcceptors = getPossibleAcceptorConnections(); - if(possibleTransmitters != currentTransmitterConnections) + for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - boolean nowPowered = world().isBlockIndirectlyGettingPowered(x(), y(), z()); - - if(nowPowered != redstonePowered) + if(connectionMapContainsSide(possibleTransmitters, side)) { - if(nowPowered) - { - getTransmitterNetwork().split((ITransmitter<N>)tile()); - setTransmitterNetwork(null); - } + TileEntity tileEntity = Coord4D.get(tile()).getFromSide(side).getTileEntity(world()); - tile().notifyPartChange(this); - - redstonePowered = nowPowered; - } - - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) - { - if(connectionMapContainsSide(possibleTransmitters, side)) + if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()) && isConnectable(tileEntity)) { - TileEntity tileEntity = Coord4D.get(tile()).getFromSide(side).getTileEntity(world()); - - if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()) && isConnectable(tileEntity)) - { - ((DynamicNetwork<?,N>)getTransmitterNetwork()).merge(((ITransmitter<N>)tileEntity).getTransmitterNetwork()); - } + ((DynamicNetwork<?,N>)getTransmitterNetwork()).merge(((IGridTransmitter<N>)tileEntity).getTransmitterNetwork()); } } } ((DynamicNetwork<?,N>)getTransmitterNetwork()).refresh(); - - if(!world().isRemote) - { - currentTransmitterConnections = possibleTransmitters; - currentAcceptorConnections = possibleAcceptors; - - sendDesc = true; - } + } + + @Override + public void onRefresh() + { + refreshTransmitterNetwork(); + } + + @Override + public void onRedstoneSplit() + { + getTransmitterNetwork().split((IGridTransmitter<N>)tile()); + setTransmitterNetwork(null); } @Override @@ -127,7 +91,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa @Override public boolean areTransmitterNetworksEqual(TileEntity tileEntity) { - return tileEntity instanceof ITransmitter && getTransmissionType() == ((ITransmitter)tileEntity).getTransmissionType(); + return tileEntity instanceof IGridTransmitter && getTransmissionType() == ((IGridTransmitter)tileEntity).getTransmissionType(); } @Override @@ -150,28 +114,28 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa { TileEntity cable = Coord4D.get(tile()).getFromSide(side).getTileEntity(world()); - if(TransmissionType.checkTransmissionType(cable, getTransmissionType()) && ((ITransmitter<N>)cable).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(cable, getTransmissionType()) && ((IGridTransmitter<N>)cable).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter<N>)cable).getTransmitterNetwork()); + connectedNets.add(((IGridTransmitter<N>)cable).getTransmitterNetwork()); } } } if(connectedNets.size() == 0) { - theNetwork = createNetworkFromSingleTransmitter((ITransmitter<N>)tile()); + theNetwork = createNetworkFromSingleTransmitter((IGridTransmitter<N>)tile()); } else if(connectedNets.size() == 1) { N network = connectedNets.iterator().next(); preSingleMerge(network); theNetwork = network; - theNetwork.transmitters.add((ITransmitter<N>)tile()); + theNetwork.transmitters.add((IGridTransmitter<N>)tile()); theNetwork.refresh(); } else { theNetwork = createNetworkByMergingSet(connectedNets); - theNetwork.transmitters.add((ITransmitter<N>)tile()); + theNetwork.transmitters.add((IGridTransmitter<N>)tile()); } } @@ -185,17 +149,17 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa { if(theNetwork != null) { - theNetwork.removeTransmitter((ITransmitter<N>)tile()); + theNetwork.removeTransmitter((IGridTransmitter<N>)tile()); } } @Override public void fixTransmitterNetwork() { - getTransmitterNetwork().fixMessedUpNetwork((ITransmitter<N>) tile()); + getTransmitterNetwork().fixMessedUpNetwork((IGridTransmitter<N>) tile()); } - public abstract N createNetworkFromSingleTransmitter(ITransmitter<N> transmitter); + public abstract N createNetworkFromSingleTransmitter(IGridTransmitter<N> transmitter); public abstract N createNetworkByMergingSet(Set<N> networks); @@ -220,9 +184,9 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa @Override public void preRemove() { - if(tile() instanceof ITransmitter) + if(tile() instanceof IGridTransmitter) { - getTransmitterNetwork().split((ITransmitter<N>)tile()); + getTransmitterNetwork().split((IGridTransmitter<N>)tile()); if(!world().isRemote) { @@ -239,9 +203,9 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa } @Override - public void onModeChange(ForgeDirection side) + protected void onModeChange(ForgeDirection side) { - refreshTransmitterNetwork(); + super.onModeChange(side); if(!world().isRemote) { @@ -249,20 +213,6 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa } } - @Override - public void onAdded() - { - super.onAdded(); - refreshTransmitterNetwork(); - } - - @Override - public void onChunkLoad() - { - super.onChunkLoad(); - refreshTransmitterNetwork(); - } - @Override public void onNeighborChanged() { @@ -272,15 +222,6 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa { PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketTransmitterUpdate().setParams(PacketType.UPDATE, tile()), world().provider.dimensionId); } - - refreshTransmitterNetwork(); - } - - @Override - public void onPartChanged(TMultiPart part) - { - super.onPartChanged(part); - refreshTransmitterNetwork(); } @Override diff --git a/common/mekanism/common/multipart/PartUniversalCable.java b/common/mekanism/common/multipart/PartUniversalCable.java index 92ced4ad6..a65239a3c 100644 --- a/common/mekanism/common/multipart/PartUniversalCable.java +++ b/common/mekanism/common/multipart/PartUniversalCable.java @@ -9,7 +9,7 @@ import java.util.Arrays; import java.util.Set; import mekanism.api.Coord4D; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; @@ -125,7 +125,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement } @Override - public EnergyNetwork createNetworkFromSingleTransmitter(ITransmitter<EnergyNetwork> transmitter) + public EnergyNetwork createNetworkFromSingleTransmitter(IGridTransmitter<EnergyNetwork> transmitter) { return new EnergyNetwork(transmitter); } diff --git a/common/mekanism/common/network/PacketDataRequest.java b/common/mekanism/common/network/PacketDataRequest.java index 875e8e59a..607fb2ee3 100644 --- a/common/mekanism/common/network/PacketDataRequest.java +++ b/common/mekanism/common/network/PacketDataRequest.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import mekanism.api.Coord4D; import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.common.ITileNetwork; import mekanism.common.PacketHandler; import mekanism.common.PacketHandler.Transmission; @@ -57,9 +57,9 @@ public class PacketDataRequest implements IMekanismPacket ((TileEntityDynamicTank)tileEntity).sendStructure = true; } - if(tileEntity instanceof ITransmitter) + if(tileEntity instanceof IGridTransmitter) { - ITransmitter transmitter = (ITransmitter)tileEntity; + IGridTransmitter transmitter = (IGridTransmitter)tileEntity; if(transmitter.getTransmitterNetwork() instanceof DynamicNetwork) { diff --git a/common/mekanism/common/network/PacketTransmitterUpdate.java b/common/mekanism/common/network/PacketTransmitterUpdate.java index b58e1bb6a..86682aca1 100644 --- a/common/mekanism/common/network/PacketTransmitterUpdate.java +++ b/common/mekanism/common/network/PacketTransmitterUpdate.java @@ -6,7 +6,7 @@ import mekanism.api.gas.Gas; import mekanism.api.gas.GasNetwork; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.common.EnergyNetwork; import mekanism.common.FluidNetwork; import net.minecraft.entity.player.EntityPlayer; @@ -73,7 +73,7 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(transmitterType == 0) { - ITransmitter transmitter = (ITransmitter)world.getBlockTileEntity(x, y, z); + IGridTransmitter transmitter = (IGridTransmitter)world.getBlockTileEntity(x, y, z); if(transmitter != null) { @@ -88,7 +88,7 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { - ((ITransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork().clientEnergyScale = powerLevel; + ((IGridTransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork().clientEnergyScale = powerLevel; } } else if(transmitterType == 2) @@ -107,7 +107,7 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { - GasNetwork net = ((ITransmitter<GasNetwork>)tileEntity).getTransmitterNetwork(); + GasNetwork net = ((IGridTransmitter<GasNetwork>)tileEntity).getTransmitterNetwork(); if(gasType != null) { @@ -135,7 +135,7 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { - FluidNetwork net = ((ITransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork(); + FluidNetwork net = ((IGridTransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork(); if(fluidType != null) { diff --git a/common/mekanism/common/tileentity/TileEntityDynamicValve.java b/common/mekanism/common/tileentity/TileEntityDynamicValve.java index bb19fe445..dbc59b21f 100644 --- a/common/mekanism/common/tileentity/TileEntityDynamicValve.java +++ b/common/mekanism/common/tileentity/TileEntityDynamicValve.java @@ -1,6 +1,7 @@ package mekanism.common.tileentity; import mekanism.common.DynamicFluidTank; +import mekanism.common.util.PipeUtils; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -20,7 +21,7 @@ public class TileEntityDynamicValve extends TileEntityDynamicTank implements IFl @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return ((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) ? new FluidTankInfo[] {fluidTank.getInfo()} : new FluidTankInfo[0]; + return ((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) ? new FluidTankInfo[] {fluidTank.getInfo()} : PipeUtils.EMPTY; } @Override diff --git a/common/mekanism/common/tileentity/TileEntityElectricPump.java b/common/mekanism/common/tileentity/TileEntityElectricPump.java index 7548c0885..7e61f7a31 100644 --- a/common/mekanism/common/tileentity/TileEntityElectricPump.java +++ b/common/mekanism/common/tileentity/TileEntityElectricPump.java @@ -8,8 +8,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import mekanism.api.EnumColor; import mekanism.api.Coord4D; +import mekanism.api.EnumColor; import mekanism.common.IConfigurable; import mekanism.common.ISustainedTank; import mekanism.common.PacketHandler; @@ -17,6 +17,7 @@ import mekanism.common.PacketHandler.Transmission; import mekanism.common.network.PacketTileEntity; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.PipeUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -459,7 +460,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I return new FluidTankInfo[] {fluidTank.getInfo()}; } - return new FluidTankInfo[0]; + return PipeUtils.EMPTY; } @Override diff --git a/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java b/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java index 93370bb9c..071b41c4c 100644 --- a/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java +++ b/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java @@ -5,7 +5,7 @@ import java.util.Arrays; import java.util.HashSet; import mekanism.api.Coord4D; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.FluidNetwork; @@ -55,9 +55,9 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork for(TileEntity pipe : adjacentPipes) { - if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter<FluidNetwork>)pipe).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((IGridTransmitter<FluidNetwork>)pipe).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter<FluidNetwork>)pipe).getTransmitterNetwork()); + connectedNets.add(((IGridTransmitter<FluidNetwork>)pipe).getTransmitterNetwork()); } } @@ -124,7 +124,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType())) { - getTransmitterNetwork().merge(((ITransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork()); + getTransmitterNetwork().merge(((IGridTransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/tileentity/TileEntityPressurizedTube.java b/common/mekanism/common/tileentity/TileEntityPressurizedTube.java index e846c859e..6c5055998 100644 --- a/common/mekanism/common/tileentity/TileEntityPressurizedTube.java +++ b/common/mekanism/common/tileentity/TileEntityPressurizedTube.java @@ -7,7 +7,7 @@ import mekanism.api.gas.GasNetwork; import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasTransmitter; import mekanism.api.gas.ITubeConnection; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmitterNetworkRegistry; import net.minecraft.tileentity.TileEntity; @@ -31,9 +31,9 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork> for(TileEntity tube : adjacentTubes) { - if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter<GasNetwork>)tube).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((IGridTransmitter<GasNetwork>)tube).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter<GasNetwork>)tube).getTransmitterNetwork()); + connectedNets.add(((IGridTransmitter<GasNetwork>)tube).getTransmitterNetwork()); } } @@ -100,7 +100,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork> if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, this)) { - getTransmitterNetwork().merge(((ITransmitter<GasNetwork>)tileEntity).getTransmitterNetwork()); + getTransmitterNetwork().merge(((IGridTransmitter<GasNetwork>)tileEntity).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java b/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java index 5a2c7db8b..63c90b80c 100644 --- a/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java +++ b/common/mekanism/common/tileentity/TileEntityRotaryCondensentrator.java @@ -20,6 +20,7 @@ import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.network.PacketTileEntity; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.PipeUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -524,7 +525,7 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp return new FluidTankInfo[] {fluidTank.getInfo()}; } - return null; + return PipeUtils.EMPTY; } @Override diff --git a/common/mekanism/common/tileentity/TileEntityTransmitter.java b/common/mekanism/common/tileentity/TileEntityTransmitter.java index 5b32a95b6..3c05a78bd 100644 --- a/common/mekanism/common/tileentity/TileEntityTransmitter.java +++ b/common/mekanism/common/tileentity/TileEntityTransmitter.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import mekanism.api.Coord4D; import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.IConfigurable; import mekanism.common.ITileNetwork; @@ -19,7 +19,7 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public abstract class TileEntityTransmitter<N extends DynamicNetwork<?, N>> extends TileEntity implements ITransmitter<N>, ITileNetwork, IConfigurable +public abstract class TileEntityTransmitter<N extends DynamicNetwork<?, N>> extends TileEntity implements IGridTransmitter<N>, ITileNetwork, IConfigurable { public N theNetwork; @@ -81,7 +81,7 @@ public abstract class TileEntityTransmitter<N extends DynamicNetwork<?, N>> exte @Override public boolean areTransmitterNetworksEqual(TileEntity tileEntity) { - return tileEntity instanceof ITransmitter && getTransmissionType() == ((ITransmitter)tileEntity).getTransmissionType(); + return tileEntity instanceof IGridTransmitter && getTransmissionType() == ((IGridTransmitter)tileEntity).getTransmissionType(); } @Override diff --git a/common/mekanism/common/tileentity/TileEntityUniversalCable.java b/common/mekanism/common/tileentity/TileEntityUniversalCable.java index bf5ba537d..30698fe32 100644 --- a/common/mekanism/common/tileentity/TileEntityUniversalCable.java +++ b/common/mekanism/common/tileentity/TileEntityUniversalCable.java @@ -7,7 +7,7 @@ import ic2.api.energy.tile.IEnergySink; import java.util.HashSet; import mekanism.api.Coord4D; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.EnergyNetwork; @@ -59,9 +59,9 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor for(TileEntity cable : adjacentCables) { - if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<EnergyNetwork>)cable).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((IGridTransmitter<EnergyNetwork>)cable).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter<EnergyNetwork>)cable).getTransmitterNetwork()); + connectedNets.add(((IGridTransmitter<EnergyNetwork>)cable).getTransmitterNetwork()); } } @@ -137,7 +137,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.ENERGY)) { - getTransmitterNetwork().merge(((ITransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork()); + getTransmitterNetwork().merge(((IGridTransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/util/CableUtils.java b/common/mekanism/common/util/CableUtils.java index b622b2bd2..3fb4da63c 100644 --- a/common/mekanism/common/util/CableUtils.java +++ b/common/mekanism/common/util/CableUtils.java @@ -11,7 +11,7 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.energy.ICableOutputter; import mekanism.api.energy.IStrictEnergyAcceptor; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.common.EnergyNetwork; import mekanism.common.Mekanism; @@ -45,7 +45,7 @@ public final class CableUtils if(acceptor instanceof IStrictEnergyAcceptor || acceptor instanceof IEnergySink || - (acceptor instanceof IPowerReceptor && !(acceptor instanceof ITransmitter) && MekanismUtils.useBuildcraft()) || + (acceptor instanceof IPowerReceptor && !(acceptor instanceof IGridTransmitter) && MekanismUtils.useBuildcraft()) || acceptor instanceof IElectrical || acceptor instanceof IEnergyHandler) { if(!(acceptor instanceof IConductor)) @@ -171,7 +171,7 @@ public final class CableUtils public static boolean isConnectable(TileEntity orig, TileEntity tileEntity, ForgeDirection side) { - if(tileEntity instanceof ITransmitter) + if(tileEntity instanceof IGridTransmitter) { return false; } @@ -201,7 +201,7 @@ public final class CableUtils return true; } - if(tileEntity instanceof IPowerReceptor && !(tileEntity instanceof ITransmitter) && MekanismUtils.useBuildcraft()) + if(tileEntity instanceof IPowerReceptor && !(tileEntity instanceof IGridTransmitter) && MekanismUtils.useBuildcraft()) { if(!(tileEntity instanceof IEnergyAcceptor) || ((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(null, side.getOpposite())) { @@ -228,7 +228,7 @@ public final class CableUtils if(TransmissionType.checkTransmissionType(pointer, TransmissionType.ENERGY)) { - ITransmitter<EnergyNetwork> cable = (ITransmitter<EnergyNetwork>)pointer; + IGridTransmitter<EnergyNetwork> cable = (IGridTransmitter<EnergyNetwork>)pointer; return cable.getTransmitterNetwork().emit(amount); } diff --git a/common/mekanism/common/util/PipeUtils.java b/common/mekanism/common/util/PipeUtils.java index 0b5f40520..6adf10e7a 100644 --- a/common/mekanism/common/util/PipeUtils.java +++ b/common/mekanism/common/util/PipeUtils.java @@ -3,7 +3,7 @@ package mekanism.common.util; import java.util.Arrays; import mekanism.api.Coord4D; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; @@ -12,6 +12,8 @@ import net.minecraftforge.fluids.IFluidHandler; public final class PipeUtils { + public static final FluidTankInfo[] EMPTY = new FluidTankInfo[] {}; + /** * Gets all the pipes around a tile entity. * @param tileEntity - center tile entity @@ -52,7 +54,9 @@ public final class PipeUtils { int side = Arrays.asList(connectedAcceptors).indexOf(container); - if(container.getTankInfo(ForgeDirection.getOrientation(side).getOpposite()) != null && container.getTankInfo(ForgeDirection.getOrientation(side).getOpposite()).length > 0) + FluidTankInfo[] infoArray = container.getTankInfo(ForgeDirection.getOrientation(side).getOpposite()); + + if(infoArray != null && infoArray.length > 0) { boolean notNull = false; @@ -99,7 +103,7 @@ public final class PipeUtils { TileEntity acceptor = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); - if(acceptor instanceof IFluidHandler && !(acceptor instanceof ITransmitter)) + if(acceptor instanceof IFluidHandler && !(acceptor instanceof IGridTransmitter)) { acceptors[orientation.ordinal()] = (IFluidHandler)acceptor; } diff --git a/common/mekanism/common/util/TransporterUtils.java b/common/mekanism/common/util/TransporterUtils.java index 52f4d7ea1..3eac9c71f 100644 --- a/common/mekanism/common/util/TransporterUtils.java +++ b/common/mekanism/common/util/TransporterUtils.java @@ -5,7 +5,7 @@ import java.util.List; import mekanism.api.EnumColor; import mekanism.api.Coord4D; -import mekanism.api.transmitters.ITransmitter; +import mekanism.api.transmitters.IGridTransmitter; import mekanism.common.ILogisticalTransporter; import mekanism.common.tileentity.TileEntityDiversionTransporter; import mekanism.common.tileentity.TileEntityLogisticalSorter; @@ -163,7 +163,7 @@ public final class TransporterUtils { TileEntity inventory = Coord4D.get(tileEntity.getTile()).getFromSide(orientation).getTileEntity(tileEntity.getTile().worldObj); - if(inventory instanceof IInventory && !(inventory instanceof ITransmitter)) + if(inventory instanceof IInventory && !(inventory instanceof IGridTransmitter)) { inventories[orientation.ordinal()] = (IInventory)inventory; }