Skip to content

Commit

Permalink
Optimization to Digital Miner search thread
Browse files Browse the repository at this point in the history
This is a slight change to the digital miner search thread to remove the
object creation that occurs for each block checked. It is a sort of
minor thing, but it will help to keep the memory requirements for the
thread down and execution maybe slightly faster.
  • Loading branch information
JDGBOLT committed Feb 20, 2014
1 parent 7c9d267 commit c3f48c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions common/mekanism/common/miner/ThreadMinerSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void run()
Coord4D coord = tileEntity.getStartingCoord();
int diameter = tileEntity.getDiameter();
int size = tileEntity.getTotalSize();
ItemInfo info = new ItemInfo(0,0);

for(int i = 0; i < size; i++)
{
Expand Down Expand Up @@ -70,20 +71,19 @@ public void run()
continue;
}

int blockID = tileEntity.worldObj.getBlockId(x, y, z);
int meta = tileEntity.worldObj.getBlockMetadata(x, y, z);
info.id = tileEntity.worldObj.getBlockId(x, y, z);
info.meta = tileEntity.worldObj.getBlockMetadata(x, y, z);

if(blockID != 0 && blockID != Block.bedrock.blockID)
if(info.id != 0 && info.id != 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(info.id, 1, info.meta);

if(tileEntity.replaceStack != null && tileEntity.replaceStack.isItemEqual(stack))
{
Expand Down

0 comments on commit c3f48c3

Please sign in to comment.