Fix Digital Miner issues (hopefully)

This commit is contained in:
Aidan C. Brady 2014-02-16 23:48:06 -05:00
parent 7b53164be6
commit 819e82e0f0
2 changed files with 31 additions and 7 deletions

View file

@ -1,7 +1,6 @@
package mekanism.common.miner; package mekanism.common.miner;
import java.util.BitSet; import java.util.BitSet;
import java.util.Collections;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.common.IBoundingBlock; import mekanism.common.IBoundingBlock;
@ -16,6 +15,10 @@ public class ThreadMinerSearch extends Thread
public State state = State.IDLE; public State state = State.IDLE;
public BitSet oresToMine = new BitSet();
public int found = 0;
public ThreadMinerSearch(TileEntityDigitalMiner tile) public ThreadMinerSearch(TileEntityDigitalMiner tile)
{ {
tileEntity = tile; tileEntity = tile;
@ -36,8 +39,6 @@ public class ThreadMinerSearch extends Thread
int diameter = tileEntity.getDiameter(); int diameter = tileEntity.getDiameter();
int size = tileEntity.getTotalSize(); int size = tileEntity.getTotalSize();
System.out.println(diameter + " " + size);
for(int i = 0; i < size; i++) for(int i = 0; i < size; i++)
{ {
int x = coord.xCoord+i%diameter; int x = coord.xCoord+i%diameter;
@ -83,12 +84,14 @@ public class ThreadMinerSearch extends Thread
if(tileEntity.inverse ? !hasFilter : hasFilter) if(tileEntity.inverse ? !hasFilter : hasFilter)
{ {
tileEntity.oresToMine.set(i); oresToMine.set(i);
found++;
} }
} }
} }
state = State.FINISHED; state = State.FINISHED;
tileEntity.oresToMine = oresToMine;
MekanismUtils.saveChunk(tileEntity); MekanismUtils.saveChunk(tileEntity);
} }

View file

@ -764,7 +764,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
data.add(false); data.add(false);
} }
data.add(oresToMine.cardinality()); if(searcher.state == State.SEARCHING)
{
data.add(searcher.found);
}
else {
data.add(oresToMine.cardinality());
}
data.add(controlType.ordinal()); data.add(controlType.ordinal());
data.add(inverse); data.add(inverse);
@ -786,7 +793,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
data.add(isActive); data.add(isActive);
data.add(running); data.add(running);
data.add(oresToMine.cardinality());
if(searcher.state == State.SEARCHING)
{
data.add(searcher.found);
}
else {
data.add(oresToMine.cardinality());
}
return data; return data;
} }
@ -818,7 +832,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
data.add(false); data.add(false);
} }
data.add(oresToMine.cardinality()); if(searcher.state == State.SEARCHING)
{
data.add(searcher.found);
}
else {
data.add(oresToMine.cardinality());
}
data.add(controlType.ordinal()); data.add(controlType.ordinal());
data.add(inverse); data.add(inverse);