Applied-Energistics-2-tiler.../me/cluster/implementations/CraftingCPUCluster.java

70 lines
1.3 KiB
Java
Raw Normal View History

package appeng.me.cluster.implementations;
import java.util.Iterator;
import java.util.LinkedList;
import appeng.api.networking.IGridHost;
import appeng.api.util.WorldCoord;
import appeng.me.cluster.IAECluster;
2014-05-14 04:42:14 +02:00
import appeng.tile.crafting.TileCraftingTile;
public class CraftingCPUCluster implements IAECluster
{
public WorldCoord min;
public WorldCoord max;
public boolean isDestroyed = false;
2014-05-14 04:42:14 +02:00
private LinkedList<TileCraftingTile> tiles = new LinkedList();
int accelerator = 0;
private LinkedList<TileCraftingTile> storage = new LinkedList<TileCraftingTile>();
private LinkedList<TileCraftingTile> status = new LinkedList<TileCraftingTile>();
@Override
public Iterator<IGridHost> getTiles()
{
2014-05-14 04:42:14 +02:00
return (Iterator) tiles.iterator();
}
public CraftingCPUCluster(WorldCoord _min, WorldCoord _max) {
min = _min;
max = _max;
}
@Override
public void updateStatus(boolean updateGrid)
{
2014-05-14 04:42:14 +02:00
for (TileCraftingTile r : tiles)
{
r.updateMeta();
}
}
@Override
public void destroy()
{
if ( isDestroyed )
return;
isDestroyed = true;
2014-05-14 04:42:14 +02:00
for (TileCraftingTile r : tiles)
{
r.updateStatus( null );
}
}
public void addTile(TileCraftingTile te)
{
tiles.add( te );
if ( te.isStorage() )
storage.add( te );
else if ( te.isStatus() )
status.add( te );
else if ( te.isAccelerator() )
accelerator++;
}
}