2013-08-04 02:48:13 +02:00
|
|
|
package mekanism.client;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.api.transmitters.TransmissionType;
|
|
|
|
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
2013-08-04 02:48:13 +02:00
|
|
|
import mekanism.api.Object3D;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.tileentity.TileEntityUniversalCable;
|
2013-08-04 02:48:13 +02:00
|
|
|
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;
|
2013-08-22 20:07:28 +02:00
|
|
|
finder = new NetworkFinder(head.worldObj, TransmissionType.ENERGY, Object3D.get(head));
|
2013-08-04 02:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void clientUpdate()
|
|
|
|
{
|
|
|
|
List<Object3D> found = finder.exploreNetwork();
|
|
|
|
|
|
|
|
for(Object3D object : found)
|
|
|
|
{
|
|
|
|
TileEntity tileEntity = object.getTileEntity(worldObj);
|
2013-08-06 00:58:24 +02:00
|
|
|
|
2013-08-19 03:32:47 +02:00
|
|
|
if(tileEntity instanceof TileEntityUniversalCable)
|
2013-08-04 02:48:13 +02:00
|
|
|
{
|
2013-08-19 03:32:47 +02:00
|
|
|
((TileEntityUniversalCable)tileEntity).setCachedEnergy(energyScale);
|
2013-08-04 02:48:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|