Merge branch 'master' of https://github.com/aidancbrady/Mekanism
Conflicts: common/mekanism/api/GasNetwork.java common/mekanism/common/EnergyNetwork.java common/mekanism/common/FluidNetwork.java common/mekanism/common/InventoryNetwork.java common/mekanism/common/TileEntityEnergyCube.java common/mekanism/generators/common/TileEntityGenerator.java
This commit is contained in:
commit
5e379f052a
24 changed files with 134 additions and 64 deletions
|
@ -97,7 +97,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
|||
{
|
||||
if(transmitter instanceof TileEntity)
|
||||
{
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)transmitter).getWorldObj(), getClass(), Object3D.get((TileEntity)transmitter));
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)transmitter).getWorldObj(), getTransmissionType(), Object3D.get((TileEntity)transmitter));
|
||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||
Set<ITransmitter<N>> newTransporters = new HashSet<ITransmitter<N>>();
|
||||
|
||||
|
@ -105,7 +105,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
|||
{
|
||||
TileEntity nodeTile = node.getTileEntity(((TileEntity)transmitter).worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(nodeTile, getClass()))
|
||||
if(MekanismUtils.checkTransmissionType(nodeTile, getTransmissionType()))
|
||||
{
|
||||
((ITransmitter<N>)nodeTile).removeFromNetwork();
|
||||
newTransporters.add((ITransmitter<N>)nodeTile);
|
||||
|
@ -127,20 +127,20 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
|||
|
||||
public static class NetworkFinder
|
||||
{
|
||||
public TransmissionType transmissionType;
|
||||
|
||||
public World worldObj;
|
||||
public Object3D start;
|
||||
|
||||
public Class<? extends ITransmitterNetwork> networkClass;
|
||||
|
||||
public List<Object3D> iterated = new ArrayList<Object3D>();
|
||||
public List<Object3D> toIgnore = new ArrayList<Object3D>();
|
||||
|
||||
public NetworkFinder(World world, Class<? extends ITransmitterNetwork> network, Object3D location, Object3D... ignore)
|
||||
public NetworkFinder(World world, TransmissionType type, Object3D location, Object3D... ignore)
|
||||
{
|
||||
worldObj = world;
|
||||
start = location;
|
||||
|
||||
networkClass = network;
|
||||
transmissionType = type;
|
||||
|
||||
if(ignore != null)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
|||
|
||||
public void loopAll(Object3D location)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(location.getTileEntity(worldObj), networkClass))
|
||||
if(MekanismUtils.checkTransmissionType(location.getTileEntity(worldObj), transmissionType))
|
||||
{
|
||||
iterated.add(location);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
|||
{
|
||||
TileEntity tileEntity = obj.getTileEntity(worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tileEntity, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
||||
{
|
||||
loopAll(obj);
|
||||
}
|
||||
|
|
|
@ -180,16 +180,16 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
|||
{
|
||||
TileEntity connectedBlockA = connectedBlocks[countOne];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockA, GasNetwork.class) && !dealtWith[countOne])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockA, TransmissionType.GAS) && !dealtWith[countOne])
|
||||
{
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getClass(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getTransmissionType(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||
|
||||
for(int countTwo = countOne + 1; countTwo < connectedBlocks.length; countTwo++)
|
||||
{
|
||||
TileEntity connectedBlockB = connectedBlocks[countTwo];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockB, GasNetwork.class) && !dealtWith[countTwo])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockB, TransmissionType.GAS) && !dealtWith[countTwo])
|
||||
{
|
||||
if(partNetwork.contains(Object3D.get(connectedBlockB)))
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
|||
{
|
||||
TileEntity nodeTile = node.getTileEntity(((TileEntity)splitPoint).worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(nodeTile, GasNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(nodeTile, TransmissionType.GAS))
|
||||
{
|
||||
if(nodeTile != splitPoint)
|
||||
{
|
||||
|
@ -257,4 +257,10 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
|||
{
|
||||
return new GasNetwork(networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.GAS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class GasTransmission
|
|||
{
|
||||
TileEntity tube = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tube, GasNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tube, TransmissionType.GAS))
|
||||
{
|
||||
tubes[orientation.ordinal()] = tube;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public final class GasTransmission
|
|||
{
|
||||
TileEntity pointer = Object3D.get(sender).getFromSide(facing).getTileEntity(sender.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(pointer, GasNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(pointer, TransmissionType.GAS))
|
||||
{
|
||||
return ((ITransmitter<GasNetwork>)pointer).getNetwork().emit(amount, type, sender);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public final class GasTransmission
|
|||
{
|
||||
TileEntity sideTile = Object3D.get(pointer).getFromSide(side).getTileEntity(pointer.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(sideTile, GasNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(sideTile, TransmissionType.GAS))
|
||||
{
|
||||
networks.add(((ITransmitter<GasNetwork>)sideTile).getNetwork());
|
||||
}
|
||||
|
|
|
@ -4,6 +4,13 @@ import net.minecraft.tileentity.TileEntity;
|
|||
|
||||
public interface ITransmitter<N>
|
||||
{
|
||||
/**
|
||||
* Get the transmitter's transmission type
|
||||
*
|
||||
* @return TransmissionType this transmitter uses
|
||||
*/
|
||||
public TransmissionType getTransmissionType();
|
||||
|
||||
/**
|
||||
* Gets the network currently in use by this transmitter segment.
|
||||
* @return network this transmitter is using
|
||||
|
|
|
@ -25,4 +25,6 @@ public interface ITransmitterNetwork<A, N>
|
|||
public void deregister();
|
||||
|
||||
public void setFixed(boolean value);
|
||||
|
||||
public TransmissionType getTransmissionType();
|
||||
}
|
||||
|
|
9
common/mekanism/api/TransmissionType.java
Normal file
9
common/mekanism/api/TransmissionType.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package mekanism.api;
|
||||
|
||||
public enum TransmissionType
|
||||
{
|
||||
ENERGY,
|
||||
FLUID,
|
||||
GAS,
|
||||
ITEM;
|
||||
}
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
|
||||
import mekanism.api.DynamicNetwork.NetworkFinder;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnergyNetwork;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.TileEntityUniversalCable;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -21,7 +21,7 @@ public class EnergyClientUpdate
|
|||
{
|
||||
worldObj = head.worldObj;
|
||||
energyScale = power;
|
||||
finder = new NetworkFinder(head.worldObj, EnergyNetwork.class, Object3D.get(head));
|
||||
finder = new NetworkFinder(head.worldObj, TransmissionType.ENERGY, Object3D.get(head));
|
||||
}
|
||||
|
||||
public void clientUpdate()
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
|
||||
import mekanism.api.DynamicNetwork.NetworkFinder;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.FluidNetwork;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.TileEntityMechanicalPipe;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -22,7 +22,7 @@ public class FluidClientUpdate
|
|||
{
|
||||
worldObj = head.worldObj;
|
||||
fluidStack = fluid;
|
||||
finder = new NetworkFinder(head.worldObj, FluidNetwork.class, Object3D.get(head));
|
||||
finder = new NetworkFinder(head.worldObj, TransmissionType.FLUID, Object3D.get(head));
|
||||
}
|
||||
|
||||
public void clientUpdate()
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.util.List;
|
|||
|
||||
import mekanism.api.DynamicNetwork.NetworkFinder;
|
||||
import mekanism.api.EnumGas;
|
||||
import mekanism.api.GasNetwork;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.TileEntityPressurizedTube;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -22,7 +22,7 @@ public class GasClientUpdate
|
|||
{
|
||||
worldObj = head.worldObj;
|
||||
gasType = type;
|
||||
finder = new NetworkFinder(head.worldObj, GasNetwork.class, Object3D.get(head));
|
||||
finder = new NetworkFinder(head.worldObj, TransmissionType.GAS, Object3D.get(head));
|
||||
}
|
||||
|
||||
public void clientUpdate()
|
||||
|
|
|
@ -13,6 +13,7 @@ import mekanism.api.ICableOutputter;
|
|||
import mekanism.api.IStrictEnergyAcceptor;
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
|
@ -58,7 +59,7 @@ public final class CableUtils
|
|||
{
|
||||
TileEntity cable = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(cable, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(cable, TransmissionType.ENERGY))
|
||||
{
|
||||
cables[orientation.ordinal()] = cable;
|
||||
}
|
||||
|
@ -192,7 +193,7 @@ public final class CableUtils
|
|||
{
|
||||
TileEntity pointer = Object3D.get(sender).getFromSide(facing).getTileEntity(sender.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(pointer, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(pointer, TransmissionType.ENERGY))
|
||||
{
|
||||
ITransmitter<EnergyNetwork> cable = (ITransmitter<EnergyNetwork>)pointer;
|
||||
|
||||
|
@ -225,7 +226,7 @@ public final class CableUtils
|
|||
{
|
||||
TileEntity sideTile = Object3D.get(pointer).getFromSide(side).getTileEntity(pointer.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(sideTile, EnergyNetwork.class) && !ignored.contains(sideTile))
|
||||
if(MekanismUtils.checkTransmissionType(sideTile, TransmissionType.ENERGY) && !ignored.contains(sideTile))
|
||||
{
|
||||
networks.add(((ITransmitter<EnergyNetwork>)sideTile).getNetwork());
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import mekanism.api.DynamicNetwork;
|
|||
import mekanism.api.IStrictEnergyAcceptor;
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -282,16 +283,16 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
{
|
||||
TileEntity connectedBlockA = connectedBlocks[countOne];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockA, EnergyNetwork.class) && !dealtWith[countOne])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockA, TransmissionType.ENERGY) && !dealtWith[countOne])
|
||||
{
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getClass(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getTransmissionType(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||
|
||||
for(int countTwo = countOne + 1; countTwo < connectedBlocks.length; countTwo++)
|
||||
{
|
||||
TileEntity connectedBlockB = connectedBlocks[countTwo];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockB, EnergyNetwork.class) && !dealtWith[countTwo])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockB, TransmissionType.ENERGY) && !dealtWith[countTwo])
|
||||
{
|
||||
if(partNetwork.contains(Object3D.get(connectedBlockB)))
|
||||
{
|
||||
|
@ -306,7 +307,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
{
|
||||
TileEntity nodeTile = node.getTileEntity(((TileEntity)splitPoint).worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(nodeTile, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(nodeTile, TransmissionType.ENERGY))
|
||||
{
|
||||
if(nodeTile != splitPoint)
|
||||
{
|
||||
|
@ -329,7 +330,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
{
|
||||
if(cable instanceof TileEntity)
|
||||
{
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)cable).getWorldObj(), getClass(), Object3D.get((TileEntity)cable));
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)cable).getWorldObj(), getTransmissionType(), Object3D.get((TileEntity)cable));
|
||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||
Set<ITransmitter<EnergyNetwork>> newCables = new HashSet<ITransmitter<EnergyNetwork>>();
|
||||
|
||||
|
@ -420,4 +421,10 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
{
|
||||
return new EnergyNetwork(networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.ENERGY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Set;
|
|||
import mekanism.api.DynamicNetwork;
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -182,16 +183,16 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
|||
{
|
||||
TileEntity connectedBlockA = connectedBlocks[countOne];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockA, FluidNetwork.class) && !dealtWith[countOne])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockA, TransmissionType.FLUID) && !dealtWith[countOne])
|
||||
{
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getClass(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getTransmissionType(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||
|
||||
for(int countTwo = countOne + 1; countTwo < connectedBlocks.length; countTwo++)
|
||||
{
|
||||
TileEntity connectedBlockB = connectedBlocks[countTwo];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockB, FluidNetwork.class) && !dealtWith[countTwo])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockB, TransmissionType.FLUID) && !dealtWith[countTwo])
|
||||
{
|
||||
if(partNetwork.contains(Object3D.get(connectedBlockB)))
|
||||
{
|
||||
|
@ -206,7 +207,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
|||
{
|
||||
TileEntity nodeTile = node.getTileEntity(((TileEntity)splitPoint).worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(nodeTile, FluidNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(nodeTile, TransmissionType.FLUID))
|
||||
{
|
||||
if(nodeTile != splitPoint)
|
||||
{
|
||||
|
@ -260,4 +261,10 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
|||
{
|
||||
return new FluidNetwork(networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.FLUID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
@ -10,11 +9,10 @@ import java.util.Set;
|
|||
|
||||
import mekanism.api.DynamicNetwork;
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.ITransmitterNetwork;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwork>
|
||||
|
@ -127,16 +125,16 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
|||
{
|
||||
TileEntity connectedBlockA = connectedBlocks[countOne];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockA, InventoryNetwork.class) && !dealtWith[countOne])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockA, TransmissionType.ITEM) && !dealtWith[countOne])
|
||||
{
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getClass(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
NetworkFinder finder = new NetworkFinder(((TileEntity)splitPoint).worldObj, getTransmissionType(), Object3D.get(connectedBlockA), Object3D.get((TileEntity)splitPoint));
|
||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||
|
||||
for(int countTwo = countOne + 1; countTwo < connectedBlocks.length; countTwo++)
|
||||
{
|
||||
TileEntity connectedBlockB = connectedBlocks[countTwo];
|
||||
|
||||
if(MekanismUtils.checkNetwork(connectedBlockB, InventoryNetwork.class) && !dealtWith[countTwo])
|
||||
if(MekanismUtils.checkTransmissionType(connectedBlockB, TransmissionType.ITEM) && !dealtWith[countTwo])
|
||||
{
|
||||
if(partNetwork.contains(Object3D.get(connectedBlockB)))
|
||||
{
|
||||
|
@ -151,7 +149,7 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
|||
{
|
||||
TileEntity nodeTile = node.getTileEntity(((TileEntity)splitPoint).worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(nodeTile, InventoryNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(nodeTile, TransmissionType.ITEM))
|
||||
{
|
||||
if(nodeTile != splitPoint)
|
||||
{
|
||||
|
@ -192,4 +190,10 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
|||
{
|
||||
return new InventoryNetwork(networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.ITEM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.TransmitterNetworkRegistry;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -29,7 +30,7 @@ public class ItemEnergyMeter extends ItemEnergized
|
|||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tileEntity, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
||||
{
|
||||
if(getEnergy(stack) >= ENERGY_PER_USE)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ import mekanism.api.IConfigurable;
|
|||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.ITransmitterNetwork;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
import mekanism.common.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
|
@ -960,11 +961,11 @@ public final class MekanismUtils
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkNetwork(TileEntity tileEntity, Class<? extends ITransmitterNetwork> networkClass)
|
||||
public static boolean checkTransmissionType(TileEntity tileEntity, TransmissionType type)
|
||||
{
|
||||
if(tileEntity instanceof ITransmitter)
|
||||
{
|
||||
if(((ITransmitter)tileEntity).getNetwork().getClass() == networkClass)
|
||||
if(((ITransmitter<?>)tileEntity).getTransmissionType() == type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
@ -24,7 +25,7 @@ public final class PipeUtils
|
|||
{
|
||||
TileEntity pipe = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(pipe, FluidNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(pipe, TransmissionType.FLUID))
|
||||
{
|
||||
pipes[orientation.ordinal()] = pipe;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.Direction;
|
||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
import ic2.api.energy.tile.IEnergyConductor;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
import ic2.api.tile.IEnergyStorage;
|
||||
|
@ -14,13 +11,13 @@ import java.util.HashSet;
|
|||
import mekanism.api.ICableOutputter;
|
||||
import mekanism.api.IStrictEnergyAcceptor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.Tier.EnergyCubeTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.electricity.ElectricityHelper;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
|
@ -72,7 +69,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
|
||||
if(getEnergy() > 0)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(tileEntity, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
||||
{
|
||||
setEnergy(getEnergy() - (Math.min(getEnergy(), tier.OUTPUT) - CableUtils.emitEnergyToNetwork(Math.min(getEnergy(), tier.OUTPUT), this, ForgeDirection.getOrientation(facing))));
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
|||
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketDataRequest;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -22,6 +23,12 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
|||
/** This transporter's active state. */
|
||||
public boolean isActive = false;
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryNetwork getNetwork(boolean createIfNull)
|
||||
{
|
||||
|
@ -33,7 +40,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
|||
|
||||
for(TileEntity transporter : adjacentTransporters)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(transporter, InventoryNetwork.class) && ((ITransmitter<InventoryNetwork>)transporter).getNetwork(false) != null)
|
||||
if(MekanismUtils.checkTransmissionType(transporter, getTransmissionType()) && ((ITransmitter<InventoryNetwork>)transporter).getNetwork(false) != null)
|
||||
{
|
||||
connectedNets.add(((ITransmitter<InventoryNetwork>)transporter).getNetwork());
|
||||
}
|
||||
|
@ -92,7 +99,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
|||
{
|
||||
TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tileEntity, InventoryNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, getTransmissionType()))
|
||||
{
|
||||
getNetwork().merge(((ITransmitter<InventoryNetwork>)tileEntity).getNetwork());
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.HashSet;
|
|||
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketDataRequest;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -51,6 +52,12 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.FLUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidNetwork getNetwork(boolean createIfNull)
|
||||
{
|
||||
|
@ -61,7 +68,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
|
||||
for(TileEntity pipe : adjacentPipes)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(pipe, FluidNetwork.class) && ((ITransmitter<FluidNetwork>)pipe).getNetwork(false) != null)
|
||||
if(MekanismUtils.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter<FluidNetwork>)pipe).getNetwork(false) != null)
|
||||
{
|
||||
connectedNets.add(((ITransmitter<FluidNetwork>)pipe).getNetwork());
|
||||
}
|
||||
|
@ -120,7 +127,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
|||
{
|
||||
TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tileEntity, FluidNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, getTransmissionType()))
|
||||
{
|
||||
getNetwork().merge(((ITransmitter<FluidNetwork>)tileEntity).getNetwork());
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.api.GasTransmission;
|
|||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.ITubeConnection;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
|
@ -19,6 +20,12 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
|||
/** The scale of the gas (0F -> 1F) currently inside this tube. */
|
||||
public float gasScale;
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasNetwork getNetwork(boolean createIfNull)
|
||||
{
|
||||
|
@ -29,7 +36,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
|||
|
||||
for(TileEntity tube : adjacentTubes)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(tube, GasNetwork.class) && ((ITransmitter<GasNetwork>)tube).getNetwork(false) != null)
|
||||
if(MekanismUtils.checkTransmissionType(tube, TransmissionType.GAS) && ((ITransmitter<GasNetwork>)tube).getNetwork(false) != null)
|
||||
{
|
||||
connectedNets.add(((ITransmitter<GasNetwork>)tube).getNetwork());
|
||||
}
|
||||
|
@ -88,7 +95,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
|||
{
|
||||
TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tileEntity, GasNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, TransmissionType.GAS))
|
||||
{
|
||||
getNetwork().merge(((ITransmitter<GasNetwork>)tileEntity).getNetwork());
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.api.TransmitterNetworkRegistry;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -38,7 +39,7 @@ public abstract class TileEntityTransmitter<N> extends TileEntity implements ITr
|
|||
@Override
|
||||
public boolean areNetworksEqual(TileEntity tileEntity)
|
||||
{
|
||||
return tileEntity instanceof ITransmitter && getNetwork().getClass() == ((ITransmitter)tileEntity).getNetwork().getClass();
|
||||
return tileEntity instanceof ITransmitter && getTransmissionType() == ((ITransmitter)tileEntity).getTransmissionType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.HashSet;
|
|||
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -28,6 +29,12 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
powerHandler.configure(0, 100, 0, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
return TransmissionType.ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate()
|
||||
{
|
||||
|
@ -44,7 +51,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
|
||||
for(TileEntity cable : adjacentCables)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(cable, EnergyNetwork.class) && ((ITransmitter<EnergyNetwork>)cable).getNetwork(false) != null)
|
||||
if(MekanismUtils.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<EnergyNetwork>)cable).getNetwork(false) != null)
|
||||
{
|
||||
connectedNets.add(((ITransmitter<EnergyNetwork>)cable).getNetwork());
|
||||
}
|
||||
|
@ -103,7 +110,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
{
|
||||
TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(tileEntity, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
||||
{
|
||||
getNetwork().merge(((ITransmitter<EnergyNetwork>)tileEntity).getNetwork());
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||
|
||||
import mekanism.api.ITransmitter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -24,7 +25,7 @@ public final class TransporterUtils
|
|||
{
|
||||
TileEntity transporter = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj);
|
||||
|
||||
if(MekanismUtils.checkNetwork(transporter, InventoryNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(transporter, TransmissionType.ITEM))
|
||||
{
|
||||
transporters[orientation.ordinal()] = transporter;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package mekanism.generators.common;
|
||||
|
||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
import ic2.api.energy.tile.IEnergyConductor;
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
import ic2.api.tile.IEnergyStorage;
|
||||
|
||||
|
@ -10,9 +8,9 @@ import java.util.EnumSet;
|
|||
|
||||
import mekanism.api.ICableOutputter;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.TransmissionType;
|
||||
import mekanism.client.IHasSound;
|
||||
import mekanism.common.CableUtils;
|
||||
import mekanism.common.EnergyNetwork;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -25,7 +23,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.electricity.ElectricityHelper;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
|
@ -104,7 +101,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(MekanismUtils.checkNetwork(tileEntity, EnergyNetwork.class))
|
||||
if(MekanismUtils.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
||||
{
|
||||
setEnergy(getEnergy() - (Math.min(getEnergy(), output) - CableUtils.emitEnergyToNetwork(Math.min(getEnergy(), output), this, ForgeDirection.getOrientation(facing))));
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue