Automatic vs Manual Job Sorting.

This commit is contained in:
AlgorithmX2 2014-07-31 20:06:37 -05:00
parent 95c770e198
commit 62289dcf82
3 changed files with 14 additions and 5 deletions

View file

@ -323,7 +323,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
if ( result != null && simulation == false )
{
ICraftingGrid cc = getGrid().getCache( ICraftingGrid.class );
ICraftingLink g = cc.submitJob( result, null, selectedCpu == -1 ? null : cpus.get( selectedCpu ).cpu, getActionSrc() );
ICraftingLink g = cc.submitJob( result, null, selectedCpu == -1 ? null : cpus.get( selectedCpu ).cpu, true, getActionSrc() );
autoStart = false;
if ( g != null && OriginalGui != null && openContext != null )
{

View file

@ -80,7 +80,7 @@ public class MultiCraftingTracker
if ( job != null )
{
setJob( x, null );
setLink( x, cg.submitJob( job, owner, null, mySrc ) );
setLink( x, cg.submitJob( job, owner, null, false, mySrc ) );
return true;
}
}

View file

@ -386,7 +386,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public ICraftingLink submitJob(ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, BaseActionSource src)
public ICraftingLink submitJob(ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, final boolean prioritizePower,
BaseActionSource src)
{
if ( job.isSimulation() )
return null;
@ -413,10 +414,18 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
@Override
public int compare(CraftingCPUCluster o1, CraftingCPUCluster o2)
{
int a = ItemSorters.compareLong( o2.getCoProcessors(), o1.getCoProcessors() );
if ( prioritizePower )
{
int a = ItemSorters.compareLong( o2.getCoProcessors(), o1.getCoProcessors() );
if ( a != 0 )
return a;
return ItemSorters.compareLong( o2.getAvailableStorage(), o1.getAvailableStorage() );
}
int a = ItemSorters.compareLong( o1.getCoProcessors(), o2.getCoProcessors() );
if ( a != 0 )
return a;
return ItemSorters.compareLong( o2.getAvailableStorage(), o1.getAvailableStorage() );
return ItemSorters.compareLong( o1.getAvailableStorage(), o2.getAvailableStorage() );
}
} );