diff --git a/common/mekanism/api/gas/GasNetwork.java b/common/mekanism/api/gas/GasNetwork.java index f4b3178fd..b4eaabef7 100644 --- a/common/mekanism/api/gas/GasNetwork.java +++ b/common/mekanism/api/gas/GasNetwork.java @@ -17,7 +17,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event; import cpw.mods.fml.common.FMLCommonHandler; -public class GasNetwork extends DynamicNetwork +public class GasNetwork extends DynamicNetwork { public int transferDelay = 0; @@ -27,13 +27,13 @@ public class GasNetwork extends DynamicNetwork public float gasScale; public Gas refGas = null; - public GasNetwork(ITransmitter... varPipes) + public GasNetwork(ITransmitter... varPipes) { transmitters.addAll(Arrays.asList(varPipes)); register(); } - public GasNetwork(Collection> collection) + public GasNetwork(Collection> collection) { transmitters.addAll(collection); register(); @@ -181,15 +181,15 @@ public class GasNetwork extends DynamicNetwork @Override public synchronized void refresh() { - Set> iterTubes = (Set>)transmitters.clone(); - Iterator> it = iterTubes.iterator(); + Set> iterTubes = (Set>)transmitters.clone(); + Iterator> it = iterTubes.iterator(); possibleAcceptors.clear(); acceptorDirections.clear(); while(it.hasNext()) { - ITransmitter conductor = (ITransmitter)it.next(); + ITransmitter conductor = (ITransmitter)it.next(); if(conductor == null || ((TileEntity)conductor).isInvalid()) { @@ -201,7 +201,7 @@ public class GasNetwork extends DynamicNetwork } } - for(ITransmitter pipe : transmitters) + for(ITransmitter pipe : transmitters) { IGasAcceptor[] acceptors = GasTransmission.getConnectedAcceptors((TileEntity)pipe); @@ -251,7 +251,7 @@ public class GasNetwork extends DynamicNetwork } @Override - protected GasNetwork create(ITransmitter... varTransmitters) + protected GasNetwork create(ITransmitter... varTransmitters) { GasNetwork network = new GasNetwork(varTransmitters); network.refGas = refGas; @@ -260,7 +260,7 @@ public class GasNetwork extends DynamicNetwork } @Override - protected GasNetwork create(Collection> collection) + protected GasNetwork create(Collection> 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 25b8050d4..b1969d016 100644 --- a/common/mekanism/api/gas/GasTransmission.java +++ b/common/mekanism/api/gas/GasTransmission.java @@ -97,7 +97,7 @@ public final class GasTransmission if(TransmissionType.checkTransmissionType(pointer, TransmissionType.GAS, sender)) { - return ((ITransmitter)pointer).getTransmitterNetwork().emit(stack, sender); + return ((ITransmitter)pointer).getTransmitterNetwork().emit(stack, sender); } return 0; diff --git a/common/mekanism/api/gas/IGasTransmitter.java b/common/mekanism/api/gas/IGasTransmitter.java index e18be82ba..a7a172c6a 100644 --- a/common/mekanism/api/gas/IGasTransmitter.java +++ b/common/mekanism/api/gas/IGasTransmitter.java @@ -3,7 +3,7 @@ package mekanism.api.gas; import mekanism.api.transmitters.ITransmitter; import net.minecraft.tileentity.TileEntity; -public interface IGasTransmitter extends ITransmitter +public interface IGasTransmitter extends ITransmitter { public boolean canTransferGasToTube(TileEntity tile); } diff --git a/common/mekanism/api/transmitters/DynamicNetwork.java b/common/mekanism/api/transmitters/DynamicNetwork.java index 45c27798b..ed8e48c34 100644 --- a/common/mekanism/api/transmitters/DynamicNetwork.java +++ b/common/mekanism/api/transmitters/DynamicNetwork.java @@ -20,9 +20,9 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event; import cpw.mods.fml.common.FMLCommonHandler; -public abstract class DynamicNetwork implements ITransmitterNetwork, IClientTicker +public abstract class DynamicNetwork, D> implements ITransmitterNetwork, IClientTicker { - public HashSet> transmitters = new HashSet>(); + public HashSet> transmitters = new HashSet>(); public HashSet possibleAcceptors = new HashSet(); public HashMap acceptorDirections = new HashMap(); @@ -35,19 +35,19 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, protected boolean needsUpdate = false; - protected abstract ITransmitterNetwork create(ITransmitter... varTransmitters); + protected abstract ITransmitterNetwork create(ITransmitter... varTransmitters); - protected abstract ITransmitterNetwork create(Collection> collection); + protected abstract ITransmitterNetwork create(Collection> collection); - protected abstract ITransmitterNetwork create(Set networks); + protected abstract ITransmitterNetwork create(Set networks); - public void addAllTransmitters(Set> newTransmitters) + public void addAllTransmitters(Set> newTransmitters) { transmitters.addAll(newTransmitters); } @Override - public void removeTransmitter(ITransmitter transmitter) + public void removeTransmitter(ITransmitter transmitter) { transmitters.remove(transmitter); @@ -61,7 +61,7 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, public void register() { try { - ITransmitter aTransmitter = transmitters.iterator().next(); + ITransmitter aTransmitter = transmitters.iterator().next(); if(aTransmitter instanceof TileEntity) { @@ -137,13 +137,13 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, } @Override - public synchronized void fixMessedUpNetwork(ITransmitter transmitter) + public synchronized void fixMessedUpNetwork(ITransmitter transmitter) { if(transmitter instanceof TileEntity) { NetworkFinder finder = new NetworkFinder(((TileEntity)transmitter).getWorldObj(), getTransmissionType(), Object3D.get((TileEntity)transmitter)); List partNetwork = finder.exploreNetwork(); - Set> newTransporters = new HashSet>(); + Set> newTransporters = new HashSet>(); for(Object3D node : partNetwork) { @@ -151,12 +151,12 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity)transmitter)) { - ((ITransmitter)nodeTile).removeFromTransmitterNetwork(); - newTransporters.add((ITransmitter)nodeTile); + ((ITransmitter)nodeTile).removeFromTransmitterNetwork(); + newTransporters.add((ITransmitter)nodeTile); } } - ITransmitterNetwork newNetwork = create(newTransporters); + ITransmitterNetwork newNetwork = create(newTransporters); newNetwork.refresh(); newNetwork.setFixed(true); deregister(); @@ -164,7 +164,7 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, } @Override - public synchronized void split(ITransmitter splitPoint) + public synchronized void split(ITransmitter splitPoint) { if(splitPoint instanceof TileEntity) { @@ -205,7 +205,7 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, } } - Set> newNetCables = new HashSet>(); + Set> newNetCables = new HashSet>(); for(Object3D node : finder.iterated) { @@ -215,12 +215,12 @@ public abstract class DynamicNetwork implements ITransmitterNetwork, { if(nodeTile != splitPoint) { - newNetCables.add((ITransmitter)nodeTile); + newNetCables.add((ITransmitter)nodeTile); } } } - ITransmitterNetwork newNetwork = create(newNetCables); + ITransmitterNetwork newNetwork = create(newNetCables); newNetwork.refresh(); } } diff --git a/common/mekanism/api/transmitters/ITransmitter.java b/common/mekanism/api/transmitters/ITransmitter.java index f1e8183a7..decbc7fb8 100644 --- a/common/mekanism/api/transmitters/ITransmitter.java +++ b/common/mekanism/api/transmitters/ITransmitter.java @@ -64,13 +64,14 @@ public interface ITransmitter, D> * and the tile in the given direction isn't prevented from connecting. */ public boolean canConnectMutual(ForgeDirection side); - - /** - * Update a client-side transmitter. This tells the client how much the - * transmitter is transmitting. - * @param data Should represent what the transmitter can transmit. - */ - public void clientUpdate(D data); public boolean areTransmitterNetworksEqual(TileEntity tileEntity); + + public int getTransmitterNetworkSize(); + + public int getTransmitterNetworkAcceptorSize(); + + public String getTransmitterNetworkNeeded(); + + public String getTransmitterNetworkFlow(); } diff --git a/common/mekanism/client/EnergyClientUpdate.java b/common/mekanism/client/EnergyClientUpdate.java deleted file mode 100644 index b6e49e230..000000000 --- a/common/mekanism/client/EnergyClientUpdate.java +++ /dev/null @@ -1,41 +0,0 @@ -package mekanism.client; - -import java.util.List; - -import mekanism.api.transmitters.ITransmitter; -import mekanism.api.transmitters.TransmissionType; -import mekanism.api.transmitters.DynamicNetwork.NetworkFinder; -import mekanism.api.Object3D; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class EnergyClientUpdate -{ - public NetworkFinder finder; - - public World worldObj; - - public double energyScale; - - public EnergyClientUpdate(TileEntity head, double power) - { - worldObj = head.worldObj; - energyScale = power; - finder = new NetworkFinder(head.worldObj, TransmissionType.ENERGY, Object3D.get(head)); - } - - public void clientUpdate() - { - List found = finder.exploreNetwork(); - System.out.println(energyScale); - for(Object3D object : found) - { - TileEntity tileEntity = object.getTileEntity(worldObj); - - if(tileEntity instanceof ITransmitter && ((ITransmitter)tileEntity).getTransmissionType() == TransmissionType.ENERGY) - { - ((ITransmitter)tileEntity).clientUpdate(energyScale); - } - } - } -} diff --git a/common/mekanism/client/FluidClientUpdate.java b/common/mekanism/client/FluidClientUpdate.java deleted file mode 100644 index 24efda644..000000000 --- a/common/mekanism/client/FluidClientUpdate.java +++ /dev/null @@ -1,42 +0,0 @@ -package mekanism.client; - -import java.util.List; - -import mekanism.api.transmitters.ITransmitter; -import mekanism.api.transmitters.TransmissionType; -import mekanism.api.transmitters.DynamicNetwork.NetworkFinder; -import mekanism.api.Object3D; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; - -public class FluidClientUpdate -{ - public NetworkFinder finder; - - public World worldObj; - - public FluidStack fluidStack; - - public FluidClientUpdate(TileEntity head, FluidStack fluid) - { - worldObj = head.worldObj; - fluidStack = fluid; - finder = new NetworkFinder(head.worldObj, TransmissionType.FLUID, Object3D.get(head)); - } - - public void clientUpdate() - { - List found = finder.exploreNetwork(); - - for(Object3D object : found) - { - TileEntity tileEntity = object.getTileEntity(worldObj); - - if(tileEntity instanceof ITransmitter && ((ITransmitter)tileEntity).getTransmissionType() == TransmissionType.FLUID) - { - ((ITransmitter)tileEntity).clientUpdate(fluidStack); - } - } - } -} diff --git a/common/mekanism/client/GasClientUpdate.java b/common/mekanism/client/GasClientUpdate.java deleted file mode 100644 index 19675d29c..000000000 --- a/common/mekanism/client/GasClientUpdate.java +++ /dev/null @@ -1,42 +0,0 @@ -package mekanism.client; - -import java.util.List; - -import mekanism.api.gas.EnumGas; -import mekanism.api.transmitters.ITransmitter; -import mekanism.api.transmitters.TransmissionType; -import mekanism.api.transmitters.DynamicNetwork.NetworkFinder; -import mekanism.api.Object3D; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class GasClientUpdate -{ - public NetworkFinder finder; - - public World worldObj; - - public EnumGas gasType; - - public GasClientUpdate(TileEntity head, EnumGas type) - { - worldObj = head.worldObj; - gasType = type; - finder = new NetworkFinder(head.worldObj, TransmissionType.GAS, Object3D.get(head)); - } - - public void clientUpdate() - { - List found = finder.exploreNetwork(); - - for(Object3D object : found) - { - TileEntity tileEntity = object.getTileEntity(worldObj); - - if(tileEntity instanceof ITransmitter && ((ITransmitter)tileEntity).getTransmissionType() == TransmissionType.GAS) - { - ((ITransmitter)tileEntity).clientUpdate(gasType); - } - } - } -} diff --git a/common/mekanism/client/render/RenderPartTransmitter.java b/common/mekanism/client/render/RenderPartTransmitter.java index 745f73572..2610c5976 100644 --- a/common/mekanism/client/render/RenderPartTransmitter.java +++ b/common/mekanism/client/render/RenderPartTransmitter.java @@ -3,6 +3,21 @@ package mekanism.client.render; import java.util.HashMap; import java.util.Map; +import mekanism.api.transmitters.TransmissionType; +import mekanism.client.render.MekanismRenderer.DisplayInteger; +import mekanism.client.render.MekanismRenderer.Model3D; +import mekanism.common.multipart.PartMechanicalPipe; +import mekanism.common.multipart.PartPressurizedTube; +import mekanism.common.multipart.PartTransmitter; +import mekanism.common.multipart.PartUniversalCable; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.util.Icon; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + import org.lwjgl.opengl.GL11; import codechicken.lib.colour.Colour; @@ -16,21 +31,6 @@ import codechicken.lib.render.TextureUtils; import codechicken.lib.render.TextureUtils.IIconRegister; import codechicken.lib.vec.Translation; import codechicken.lib.vec.Vector3; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.util.Icon; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import mekanism.api.transmitters.TransmissionType; -import mekanism.client.render.MekanismRenderer.DisplayInteger; -import mekanism.client.render.MekanismRenderer.Model3D; -import mekanism.common.multipart.PartLogisticalTransporter; -import mekanism.common.multipart.PartMechanicalPipe; -import mekanism.common.multipart.PartPressurizedTube; -import mekanism.common.multipart.PartTransmitter; -import mekanism.common.multipart.PartUniversalCable; public class RenderPartTransmitter implements IIconRegister { @@ -39,7 +39,6 @@ public class RenderPartTransmitter implements IIconRegister public static Icon[] uniCableTextures = new Icon[2]; public static Icon[] mechPipeTextures = new Icon[2]; public static Icon[] pressTubeTextures = new Icon[2]; - public static Icon[] logiTransporterTextures = new Icon[2]; public static Icon liquidEnergyTexture; public static Icon sideTexture; public static Map typeMap = new HashMap(); @@ -69,7 +68,6 @@ public class RenderPartTransmitter implements IIconRegister typeMap.put(TransmissionType.ENERGY, uniCableTextures); typeMap.put(TransmissionType.FLUID, mechPipeTextures); typeMap.put(TransmissionType.GAS, pressTubeTextures); - typeMap.put(TransmissionType.ITEM, logiTransporterTextures); } public static RenderPartTransmitter getInstance() @@ -131,7 +129,7 @@ public class RenderPartTransmitter implements IIconRegister MekanismRenderer.glowOn(); } - CCRenderState.changeTexture((MekanismRenderer.getLiquidTexture())); + CCRenderState.changeTexture((MekanismRenderer.getBlocksTexture())); GL11.glTranslated(pos.x, pos.y, pos.z); for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) @@ -296,11 +294,6 @@ public class RenderPartTransmitter implements IIconRegister System.out.println("specific"); } - public void renderContents(PartLogisticalTransporter transmitter, Vector3 pos) - { - System.out.println("specific"); - } - public void renderStatic(PartTransmitter transmitter) { TextureUtils.bindAtlas(0); @@ -357,8 +350,6 @@ public class RenderPartTransmitter implements IIconRegister pressTubeTextures[1] = pressTubeTextures[0]; mechPipeTextures[0] = register.registerIcon("mekanism:models/MechanicalPipe"); mechPipeTextures[1] = register.registerIcon("mekanism:models/MechanicalPipeActive"); - logiTransporterTextures[0] = register.registerIcon("mekanism:models/LogisticalTransporter"); - logiTransporterTextures[1] = register.registerIcon("mekanism:models/LogisticalTransporterActive"); liquidEnergyTexture = register.registerIcon("mekanism:LiquidEnergy"); } diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index 7f91b90fd..3d82f7825 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -26,7 +26,7 @@ import universalelectricity.core.electricity.ElectricityPack; import cofh.api.energy.IEnergyHandler; import cpw.mods.fml.common.FMLCommonHandler; -public class EnergyNetwork extends DynamicNetwork +public class EnergyNetwork extends DynamicNetwork { private double lastPowerScale = 0; private double joulesTransmitted = 0; @@ -34,13 +34,13 @@ public class EnergyNetwork extends DynamicNetwork public double clientEnergyScale = 0; - public EnergyNetwork(ITransmitter... varCables) + public EnergyNetwork(ITransmitter... varCables) { transmitters.addAll(Arrays.asList(varCables)); register(); } - public EnergyNetwork(Collection> collection) + public EnergyNetwork(Collection> collection) { transmitters.addAll(collection); register(); @@ -277,15 +277,15 @@ public class EnergyNetwork extends DynamicNetwork @Override public synchronized void refresh() { - Set> iterCables = (Set>)transmitters.clone(); - Iterator> it = iterCables.iterator(); + Set> iterCables = (Set>)transmitters.clone(); + Iterator> it = iterCables.iterator(); possibleAcceptors.clear(); acceptorDirections.clear(); while(it.hasNext()) { - ITransmitter conductor = (ITransmitter)it.next(); + ITransmitter conductor = (ITransmitter)it.next(); if(conductor == null || ((TileEntity)conductor).isInvalid()) { @@ -297,7 +297,7 @@ public class EnergyNetwork extends DynamicNetwork } } - for(ITransmitter cable : iterCables) + for(ITransmitter cable : iterCables) { TileEntity[] acceptors = CableUtils.getConnectedEnergyAcceptors((TileEntity)cable); @@ -389,7 +389,7 @@ public class EnergyNetwork extends DynamicNetwork } @Override - protected EnergyNetwork create(ITransmitter... varTransmitters) + protected EnergyNetwork create(ITransmitter... varTransmitters) { EnergyNetwork network = new EnergyNetwork(varTransmitters); network.clientEnergyScale = clientEnergyScale; @@ -400,7 +400,7 @@ public class EnergyNetwork extends DynamicNetwork } @Override - protected EnergyNetwork create(Collection> collection) + protected EnergyNetwork create(Collection> collection) { EnergyNetwork network = new EnergyNetwork(collection); network.clientEnergyScale = clientEnergyScale; diff --git a/common/mekanism/common/FluidNetwork.java b/common/mekanism/common/FluidNetwork.java index 4190df649..8bc550272 100644 --- a/common/mekanism/common/FluidNetwork.java +++ b/common/mekanism/common/FluidNetwork.java @@ -9,7 +9,6 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import mekanism.api.gas.GasNetwork; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; @@ -24,7 +23,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; import cpw.mods.fml.common.FMLCommonHandler; -public class FluidNetwork extends DynamicNetwork +public class FluidNetwork extends DynamicNetwork { public int transferDelay = 0; @@ -34,13 +33,13 @@ public class FluidNetwork extends DynamicNetwork public float fluidScale; public Fluid refFluid = null; - public FluidNetwork(ITransmitter... varPipes) + public FluidNetwork(ITransmitter... varPipes) { transmitters.addAll(Arrays.asList(varPipes)); register(); } - public FluidNetwork(Collection> collection) + public FluidNetwork(Collection> collection) { transmitters.addAll(collection); register(); @@ -201,7 +200,7 @@ public class FluidNetwork extends DynamicNetwork @Override public synchronized void refresh() { - Set> iterPipes = (Set>)transmitters.clone(); + Set> iterPipes = (Set>)transmitters.clone(); Iterator it = iterPipes.iterator(); possibleAcceptors.clear(); @@ -209,7 +208,7 @@ public class FluidNetwork extends DynamicNetwork while(it.hasNext()) { - ITransmitter conductor = (ITransmitter)it.next(); + ITransmitter conductor = (ITransmitter)it.next(); if(conductor == null || ((TileEntity)conductor).isInvalid()) { @@ -221,7 +220,7 @@ public class FluidNetwork extends DynamicNetwork } } - for(ITransmitter pipe : iterPipes) + for(ITransmitter pipe : iterPipes) { if(pipe instanceof TileEntityMechanicalPipe && ((TileEntityMechanicalPipe)pipe).isActive) continue; @@ -273,7 +272,7 @@ public class FluidNetwork extends DynamicNetwork } @Override - protected FluidNetwork create(ITransmitter... varTransmitters) + protected FluidNetwork create(ITransmitter... varTransmitters) { FluidNetwork network = new FluidNetwork(varTransmitters); network.refFluid = refFluid; @@ -282,7 +281,7 @@ public class FluidNetwork extends DynamicNetwork } @Override - protected FluidNetwork create(Collection> collection) + protected FluidNetwork create(Collection> collection) { FluidNetwork network = new FluidNetwork(collection); network.refFluid = refFluid; diff --git a/common/mekanism/common/InventoryNetwork.java b/common/mekanism/common/InventoryNetwork.java deleted file mode 100644 index c65a23727..000000000 --- a/common/mekanism/common/InventoryNetwork.java +++ /dev/null @@ -1,145 +0,0 @@ -package mekanism.common; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import mekanism.api.transmitters.DynamicNetwork; -import mekanism.api.transmitters.ITransmitter; -import mekanism.api.transmitters.TransmissionType; -import mekanism.common.util.TransporterUtils; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; - -public class InventoryNetwork extends DynamicNetwork -{ - public InventoryNetwork(ITransmitter... varTransporters) - { - transmitters.addAll(Arrays.asList(varTransporters)); - register(); - } - - public InventoryNetwork(Collection> collection) - { - transmitters.addAll(collection); - register(); - } - - public InventoryNetwork(Set networks) - { - for(InventoryNetwork net : networks) - { - if(net != null) - { - addAllTransmitters(net.transmitters); - net.deregister(); - } - } - - refresh(); - register(); - } - - @Override - public Set getAcceptors(Object... data) - { - return null; - } - - @Override - public void refresh() - { - Set> iterTransmitters = (Set>)transmitters.clone(); - Iterator it = iterTransmitters.iterator(); - - possibleAcceptors.clear(); - acceptorDirections.clear(); - - while(it.hasNext()) - { - ITransmitter conductor = (ITransmitter)it.next(); - - if(conductor == null || ((TileEntity)conductor).isInvalid()) - { - it.remove(); - transmitters.remove(conductor); - } - else { - conductor.setTransmitterNetwork(this); - } - } - - for(ITransmitter transmitter : iterTransmitters) - { - IInventory[] inventories = TransporterUtils.getConnectedInventories((TileEntity)transmitter); - - for(IInventory inventory : inventories) - { - if(inventory != null && !(inventory instanceof ITransmitter)) - { - possibleAcceptors.add(inventory); - acceptorDirections.put(inventory, ForgeDirection.getOrientation(Arrays.asList(inventories).indexOf(inventory))); - } - } - } - } - - @Override - public void merge(InventoryNetwork network) - { - if(network != null && network != this) - { - Set networks = new HashSet(); - networks.add(this); - networks.add(network); - InventoryNetwork newNetwork = new InventoryNetwork(networks); - newNetwork.refresh(); - } - } - - @Override - public String toString() - { - return "[InventoryNetwork] " + transmitters.size() + " transmitters, " + possibleAcceptors.size() + " acceptors."; - } - - @Override - protected InventoryNetwork create(ITransmitter... varTransmitters) - { - return new InventoryNetwork(varTransmitters); - } - - @Override - protected InventoryNetwork create(Collection> collection) - { - return new InventoryNetwork(collection); - } - - @Override - protected InventoryNetwork create(Set networks) - { - return new InventoryNetwork(networks); - } - - @Override - public TransmissionType getTransmissionType() - { - return TransmissionType.ITEM; - } - - @Override - public String getFlow() - { - return "Undefined for Inventory networks"; - } - - @Override - public String getNeeded() - { - return "Undefined for Inventory Networks"; - } -} diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index 392978890..4e4c167da 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -60,6 +60,7 @@ import mekanism.common.item.ItemPortableTeleporter; import mekanism.common.item.ItemProxy; import mekanism.common.item.ItemRobit; import mekanism.common.item.ItemWalkieTalkie; +import mekanism.common.multipart.ItemPartTransmitter; import mekanism.common.network.PacketConfigurationUpdate; import mekanism.common.network.PacketConfiguratorState; import mekanism.common.network.PacketDataRequest; @@ -206,6 +207,7 @@ public class Mekanism public static Item NetworkReader; public static Item WalkieTalkie; public static Item ItemProxy; + public static Item PartTransmitter; //Blocks public static Block BasicBlock; @@ -568,6 +570,7 @@ public class Mekanism NetworkReader = new ItemNetworkReader(configuration.getItem("NetworkReader", 11222).getInt()).setUnlocalizedName("NetworkReader"); //OPEN 11223 WalkieTalkie = new ItemWalkieTalkie(configuration.getItem("WalkieTalkie", 11224).getInt()).setUnlocalizedName("WalkieTalkie"); + PartTransmitter = new ItemPartTransmitter(configuration.getItem("MultipartTransmitter", 11223).getInt()).setUnlocalizedName("MultipartTransmitter"); configuration.save(); //Registrations diff --git a/common/mekanism/common/multipart/MultipartMekanism.java b/common/mekanism/common/multipart/MultipartMekanism.java index 04ec4f675..5760bb917 100644 --- a/common/mekanism/common/multipart/MultipartMekanism.java +++ b/common/mekanism/common/multipart/MultipartMekanism.java @@ -16,8 +16,6 @@ public class MultipartMekanism implements IPartFactory return new PartMechanicalPipe(); if(name == "mekanism:pressurized_tube") return new PartPressurizedTube(); - if(name == "mekanism:logistical_transporter") - return new PartLogisticalTransporter(); return null; } diff --git a/common/mekanism/common/multipart/PartLogisticalTransporter.java b/common/mekanism/common/multipart/PartLogisticalTransporter.java deleted file mode 100644 index dade179f5..000000000 --- a/common/mekanism/common/multipart/PartLogisticalTransporter.java +++ /dev/null @@ -1,45 +0,0 @@ -package mekanism.common.multipart; - -import java.util.Set; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; -import mekanism.api.transmitters.ITransmitter; -import mekanism.api.transmitters.TransmissionType; -import mekanism.common.InventoryNetwork; - -public class PartLogisticalTransporter extends PartTransmitter -{ - @Override - public String getType() - { - return "mekanism:logistical_transporter"; - } - - @Override - public TransmissionType getTransmissionType() - { - return TransmissionType.ITEM; - } - - @Override - public boolean isValidAcceptor(TileEntity tile, ForgeDirection side) - { - return tile instanceof IInventory; - } - - @Override - public InventoryNetwork createNetworkFromSingleTransmitter(ITransmitter transmitter) - { - return new InventoryNetwork(transmitter); - } - - @Override - public InventoryNetwork createNetworkByMergingSet(Set networks) - { - return new InventoryNetwork(networks); - } - -} diff --git a/common/mekanism/common/multipart/PartMechanicalPipe.java b/common/mekanism/common/multipart/PartMechanicalPipe.java index 416143ab5..4fd135a8d 100644 --- a/common/mekanism/common/multipart/PartMechanicalPipe.java +++ b/common/mekanism/common/multipart/PartMechanicalPipe.java @@ -161,4 +161,31 @@ public class PartMechanicalPipe extends PartTransmitter +public class PartPressurizedTube extends PartTransmitter { @Override public String getType() @@ -31,7 +31,7 @@ public class PartPressurizedTube extends PartTransmitter } @Override - public GasNetwork createNetworkFromSingleTransmitter(ITransmitter transmitter) + public GasNetwork createNetworkFromSingleTransmitter(ITransmitter transmitter) { return new GasNetwork(transmitter); } @@ -41,4 +41,35 @@ public class PartPressurizedTube extends PartTransmitter { return new GasNetwork(networks); } + + @Override + public void chunkLoad() + { + // TODO Auto-generated method stub + + } + + @Override + public int getTransmitterNetworkSize() + { + return getTransmitterNetwork().getSize(); + } + + @Override + public int getTransmitterNetworkAcceptorSize() + { + return getTransmitterNetwork().getAcceptorSize(); + } + + @Override + public String getTransmitterNetworkNeeded() + { + return getTransmitterNetwork().getNeeded(); + } + + @Override + public String getTransmitterNetworkFlow() + { + return getTransmitterNetwork().getFlow(); + } } diff --git a/common/mekanism/common/multipart/PartTransmitter.java b/common/mekanism/common/multipart/PartTransmitter.java index bf35fec59..46105d6d1 100644 --- a/common/mekanism/common/multipart/PartTransmitter.java +++ b/common/mekanism/common/multipart/PartTransmitter.java @@ -70,8 +70,6 @@ public abstract class PartTransmitter, D> exten return new PartMechanicalPipe(); case GAS: return new PartPressurizedTube(); - case ITEM: - return new PartLogisticalTransporter(); default: return null; } @@ -412,12 +410,6 @@ public abstract class PartTransmitter, D> exten return Collections.singletonList(new ItemStack(Mekanism.PartTransmitter, 1, getTransmissionType().ordinal())); } - @Override - public void clientUpdate(D data) - { - transmitting = data; - } - @Override public void preRemove() { diff --git a/common/mekanism/common/multipart/PartUniversalCable.java b/common/mekanism/common/multipart/PartUniversalCable.java index cc04372bf..33e26fce5 100644 --- a/common/mekanism/common/multipart/PartUniversalCable.java +++ b/common/mekanism/common/multipart/PartUniversalCable.java @@ -104,12 +104,6 @@ public class PartUniversalCable extends PartTransmitter RenderPartTransmitter.getInstance().renderContents(this, pos); } - @Override - public void clientUpdate(Double level) - { - setLevel = level; - } - @Override public void update() { @@ -123,4 +117,33 @@ public class PartUniversalCable extends PartTransmitter } } } + + @Override + public void chunkLoad() + { + } + + @Override + public int getTransmitterNetworkSize() + { + return getTransmitterNetwork().getSize(); + } + + @Override + public int getTransmitterNetworkAcceptorSize() + { + return getTransmitterNetwork().getAcceptorSize(); + } + + @Override + public String getTransmitterNetworkNeeded() + { + return getTransmitterNetwork().getNeeded(); + } + + @Override + public String getTransmitterNetworkFlow() + { + return getTransmitterNetwork().getFlow(); + } } diff --git a/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java b/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java index 402894bde..2051ec356 100644 --- a/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java +++ b/common/mekanism/common/tileentity/TileEntityMechanicalPipe.java @@ -31,7 +31,7 @@ import com.google.common.io.ByteArrayDataInput; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class TileEntityMechanicalPipe extends TileEntityTransmitter implements IFluidHandler +public class TileEntityMechanicalPipe extends TileEntityTransmitter implements IFluidHandler { /** The fake tank used for fluid transfer calculations. */ public FluidTank dummyTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); @@ -55,9 +55,9 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter)pipe).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter)pipe).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter)pipe).getTransmitterNetwork()); + connectedNets.add(((ITransmitter)pipe).getTransmitterNetwork()); } } @@ -124,7 +124,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter)tileEntity).getTransmitterNetwork()); + getTransmitterNetwork().merge(((ITransmitter)tileEntity).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/tileentity/TileEntityPressurizedTube.java b/common/mekanism/common/tileentity/TileEntityPressurizedTube.java index bd10acd7b..865c55046 100644 --- a/common/mekanism/common/tileentity/TileEntityPressurizedTube.java +++ b/common/mekanism/common/tileentity/TileEntityPressurizedTube.java @@ -3,6 +3,7 @@ package mekanism.common.tileentity; import java.util.HashSet; import mekanism.api.Object3D; +import mekanism.api.gas.Gas; import mekanism.api.gas.GasNetwork; import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasTransmitter; @@ -10,13 +11,10 @@ import mekanism.api.gas.ITubeConnection; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmitterNetworkRegistry; -import mekanism.common.PacketHandler; -import mekanism.common.PacketHandler.Transmission; -import mekanism.common.network.PacketDataRequest; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; -public class TileEntityPressurizedTube extends TileEntityTransmitter implements ITubeConnection, IGasTransmitter +public class TileEntityPressurizedTube extends TileEntityTransmitter implements ITubeConnection, IGasTransmitter { @Override public TransmissionType getTransmissionType() @@ -34,9 +32,9 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter for(TileEntity tube : adjacentTubes) { - if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter)tube).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter)tube).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter)tube).getTransmitterNetwork()); + connectedNets.add(((ITransmitter)tube).getTransmitterNetwork()); } } @@ -103,7 +101,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, this)) { - getTransmitterNetwork().merge(((ITransmitter)tileEntity).getTransmitterNetwork()); + getTransmitterNetwork().merge(((ITransmitter)tileEntity).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/tileentity/TileEntityTransmitter.java b/common/mekanism/common/tileentity/TileEntityTransmitter.java index 010f32f0b..5fdb6a129 100644 --- a/common/mekanism/common/tileentity/TileEntityTransmitter.java +++ b/common/mekanism/common/tileentity/TileEntityTransmitter.java @@ -2,6 +2,8 @@ package mekanism.common.tileentity; import java.util.ArrayList; +import mekanism.api.Object3D; +import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.IConfigurable; @@ -9,6 +11,7 @@ import mekanism.common.ITileNetwork; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.ForgeDirection; import com.google.common.io.ByteArrayDataInput; @@ -16,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 extends TileEntity implements ITransmitter, ITileNetwork, IConfigurable +public abstract class TileEntityTransmitter, D> extends TileEntity implements ITransmitter, ITileNetwork, IConfigurable { public N theNetwork; @@ -75,6 +78,21 @@ public abstract class TileEntityTransmitter extends TileEntity implements ITr } } + @Override + public boolean canConnectMutual(ForgeDirection side) + { + if(!canConnect(side)) return false; + + TileEntity tile = Object3D.get(this).getFromSide(side).getTileEntity(worldObj); + return (!(tile instanceof ITransmitter) || ((ITransmitter)tile).canConnect(side.getOpposite())); + } + + @Override + public boolean canConnect(ForgeDirection side) + { + return true; + } + @Override public boolean areTransmitterNetworksEqual(TileEntity tileEntity) { diff --git a/common/mekanism/common/tileentity/TileEntityUniversalCable.java b/common/mekanism/common/tileentity/TileEntityUniversalCable.java index ab996618b..11b732882 100644 --- a/common/mekanism/common/tileentity/TileEntityUniversalCable.java +++ b/common/mekanism/common/tileentity/TileEntityUniversalCable.java @@ -22,7 +22,7 @@ import universalelectricity.core.electricity.ElectricityPack; import universalelectricity.core.grid.IElectricityNetwork; import cofh.api.energy.IEnergyHandler; -public class TileEntityUniversalCable extends TileEntityTransmitter implements IEnergySink, IEnergyHandler, IElectrical +public class TileEntityUniversalCable extends TileEntityTransmitter implements IEnergySink, IEnergyHandler, IElectrical { /** A fake UE ElectricityNetwork used to accept power from EU machines */ public IElectricityNetwork ueNetwork; @@ -45,9 +45,9 @@ public class TileEntityUniversalCable extends TileEntityTransmitter)cable).getTransmitterNetwork(false) != null) + if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter)cable).getTransmitterNetwork(false) != null) { - connectedNets.add(((ITransmitter)cable).getTransmitterNetwork()); + connectedNets.add(((ITransmitter)cable).getTransmitterNetwork()); } } @@ -123,7 +123,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter)tileEntity).getTransmitterNetwork()); + getTransmitterNetwork().merge(((ITransmitter)tileEntity).getTransmitterNetwork()); } } diff --git a/common/mekanism/common/util/CableUtils.java b/common/mekanism/common/util/CableUtils.java index ea1e16f50..ed28455a8 100644 --- a/common/mekanism/common/util/CableUtils.java +++ b/common/mekanism/common/util/CableUtils.java @@ -193,7 +193,7 @@ public final class CableUtils if(TransmissionType.checkTransmissionType(pointer, TransmissionType.ENERGY)) { - ITransmitter cable = (ITransmitter)pointer; + ITransmitter cable = (ITransmitter)pointer; ArrayList ignored = new ArrayList(); ignored.add(sender);