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,6 +75,14 @@ public class ThreadMinerSearch extends Thread
if(blockID != 0 && blockID != Block.bedrock.blockID) if(blockID != 0 && blockID != Block.bedrock.blockID)
{ {
ItemInfo info = new ItemInfo(blockID, meta);
boolean canFilter = false;
if(acceptedItems.containsKey(info))
{
canFilter = acceptedItems.get(info);
}
else {
ItemStack stack = new ItemStack(blockID, 1, meta); ItemStack stack = new ItemStack(blockID, 1, meta);
if(tileEntity.replaceStack != null && tileEntity.replaceStack.isItemEqual(stack)) if(tileEntity.replaceStack != null && tileEntity.replaceStack.isItemEqual(stack))
@ -87,7 +100,11 @@ public class ThreadMinerSearch extends Thread
} }
} }
if(tileEntity.inverse ? !hasFilter : hasFilter) canFilter = tileEntity.inverse ? !hasFilter : hasFilter;
acceptedItems.put(info, canFilter);
}
if(canFilter)
{ {
oresToMine.set(i); oresToMine.set(i);
found++; found++;