Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan C. Brady 2014-02-19 23:21:58 -05:00
commit 656a1a8baa

View file

@ -1,8 +1,11 @@
package mekanism.common.miner; package mekanism.common.miner;
import java.util.BitSet; import java.util.BitSet;
import java.util.HashMap;
import java.util.Map;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.ItemInfo;
import mekanism.common.IBoundingBlock; import mekanism.common.IBoundingBlock;
import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
@ -17,6 +20,8 @@ public class ThreadMinerSearch extends Thread
public BitSet oresToMine = new BitSet(); public BitSet oresToMine = new BitSet();
public Map<ItemInfo, Boolean> acceptedItems = new HashMap<ItemInfo, Boolean>();
public int found = 0; public int found = 0;
public ThreadMinerSearch(TileEntityDigitalMiner tile) public ThreadMinerSearch(TileEntityDigitalMiner tile)
@ -70,24 +75,36 @@ public class ThreadMinerSearch extends Thread
if(blockID != 0 && blockID != Block.bedrock.blockID) if(blockID != 0 && blockID != Block.bedrock.blockID)
{ {
ItemStack stack = new ItemStack(blockID, 1, meta); ItemInfo info = new ItemInfo(blockID, meta);
boolean canFilter = false;
if(tileEntity.replaceStack != null && tileEntity.replaceStack.isItemEqual(stack)) if(acceptedItems.containsKey(info))
{ {
continue; canFilter = acceptedItems.get(info);
} }
else {
ItemStack stack = new ItemStack(blockID, 1, meta);
boolean hasFilter = false; if(tileEntity.replaceStack != null && tileEntity.replaceStack.isItemEqual(stack))
for(MinerFilter filter : tileEntity.filters)
{
if(filter.canFilter(stack))
{ {
hasFilter = true; continue;
} }
boolean hasFilter = false;
for(MinerFilter filter : tileEntity.filters)
{
if(filter.canFilter(stack))
{
hasFilter = true;
}
}
canFilter = tileEntity.inverse ? !hasFilter : hasFilter;
acceptedItems.put(info, canFilter);
} }
if(tileEntity.inverse ? !hasFilter : hasFilter) if(canFilter)
{ {
oresToMine.set(i); oresToMine.set(i);
found++; found++;