final variables and parameters
This commit is contained in:
@@ -58,7 +58,7 @@ public class CraftingTreeNode
|
||||
|
||||
boolean sim;
|
||||
|
||||
public CraftingTreeNode( ICraftingGrid cc, CraftingJob job, IAEItemStack wat, CraftingTreeProcess par, int slot, int depth )
|
||||
public CraftingTreeNode( final ICraftingGrid cc, final CraftingJob job, final IAEItemStack wat, final CraftingTreeProcess par, final int slot, final int depth )
|
||||
{
|
||||
this.what = wat;
|
||||
this.parent = par;
|
||||
@@ -73,7 +73,7 @@ public class CraftingTreeNode
|
||||
return; // if you can emit for something, you can't make it with patterns.
|
||||
}
|
||||
|
||||
for( ICraftingPatternDetails details : cc.getCraftingFor( this.what, this.parent == null ? null : this.parent.details, slot, this.world ) )// in
|
||||
for( final ICraftingPatternDetails details : cc.getCraftingFor( this.what, this.parent == null ? null : this.parent.details, slot, this.world ) )// in
|
||||
// order.
|
||||
{
|
||||
if( this.parent == null || this.parent.notRecursive( details ) )
|
||||
@@ -83,10 +83,10 @@ public class CraftingTreeNode
|
||||
}
|
||||
}
|
||||
|
||||
boolean notRecursive( ICraftingPatternDetails details )
|
||||
boolean notRecursive( final ICraftingPatternDetails details )
|
||||
{
|
||||
IAEItemStack[] o = details.getCondensedOutputs();
|
||||
for( IAEItemStack i : o )
|
||||
for( final IAEItemStack i : o )
|
||||
{
|
||||
if( i.equals( this.what ) )
|
||||
{
|
||||
@@ -95,7 +95,7 @@ public class CraftingTreeNode
|
||||
}
|
||||
|
||||
o = details.getCondensedInputs();
|
||||
for( IAEItemStack i : o )
|
||||
for( final IAEItemStack i : o )
|
||||
{
|
||||
if( i.equals( this.what ) )
|
||||
{
|
||||
@@ -111,11 +111,11 @@ public class CraftingTreeNode
|
||||
return this.parent.notRecursive( details );
|
||||
}
|
||||
|
||||
public IAEItemStack request( MECraftingInventory inv, long l, BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
public IAEItemStack request( final MECraftingInventory inv, long l, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
{
|
||||
this.job.handlePausing();
|
||||
|
||||
List<IAEItemStack> thingsUsed = new LinkedList<IAEItemStack>();
|
||||
final List<IAEItemStack> thingsUsed = new LinkedList<IAEItemStack>();
|
||||
|
||||
this.what.setStackSize( l );
|
||||
if( this.slot >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
||||
@@ -126,13 +126,13 @@ public class CraftingTreeNode
|
||||
{
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( l );
|
||||
IAEItemStack available = inv.extractItems( fuzz, Actionable.MODULATE, src );
|
||||
final IAEItemStack available = inv.extractItems( fuzz, Actionable.MODULATE, src );
|
||||
|
||||
if( available != null )
|
||||
{
|
||||
if( !this.exhausted )
|
||||
{
|
||||
IAEItemStack is = this.job.checkUse( available );
|
||||
final IAEItemStack is = this.job.checkUse( available );
|
||||
if( is != null )
|
||||
{
|
||||
thingsUsed.add( is.copy() );
|
||||
@@ -153,13 +153,13 @@ public class CraftingTreeNode
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack available = inv.extractItems( this.what, Actionable.MODULATE, src );
|
||||
final IAEItemStack available = inv.extractItems( this.what, Actionable.MODULATE, src );
|
||||
|
||||
if( available != null )
|
||||
{
|
||||
if( !this.exhausted )
|
||||
{
|
||||
IAEItemStack is = this.job.checkUse( available );
|
||||
final IAEItemStack is = this.job.checkUse( available );
|
||||
if( is != null )
|
||||
{
|
||||
thingsUsed.add( is.copy() );
|
||||
@@ -179,7 +179,7 @@ public class CraftingTreeNode
|
||||
|
||||
if( this.canEmit )
|
||||
{
|
||||
IAEItemStack wat = this.what.copy();
|
||||
final IAEItemStack wat = this.what.copy();
|
||||
wat.setStackSize( l );
|
||||
|
||||
this.howManyEmitted = wat.getStackSize();
|
||||
@@ -192,16 +192,16 @@ public class CraftingTreeNode
|
||||
|
||||
if( this.nodes.size() == 1 )
|
||||
{
|
||||
CraftingTreeProcess pro = this.nodes.get( 0 );
|
||||
final CraftingTreeProcess pro = this.nodes.get( 0 );
|
||||
|
||||
while( pro.possible && l > 0 )
|
||||
{
|
||||
IAEItemStack madeWhat = pro.getAmountCrafted( this.what );
|
||||
final IAEItemStack madeWhat = pro.getAmountCrafted( this.what );
|
||||
|
||||
pro.request( inv, pro.getTimes( l, madeWhat.getStackSize() ), src );
|
||||
|
||||
madeWhat.setStackSize( l );
|
||||
IAEItemStack available = inv.extractItems( madeWhat, Actionable.MODULATE, src );
|
||||
final IAEItemStack available = inv.extractItems( madeWhat, Actionable.MODULATE, src );
|
||||
|
||||
if( available != null )
|
||||
{
|
||||
@@ -221,17 +221,17 @@ public class CraftingTreeNode
|
||||
}
|
||||
else if( this.nodes.size() > 1 )
|
||||
{
|
||||
for( CraftingTreeProcess pro : this.nodes )
|
||||
for( final CraftingTreeProcess pro : this.nodes )
|
||||
{
|
||||
try
|
||||
{
|
||||
while( pro.possible && l > 0 )
|
||||
{
|
||||
MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true );
|
||||
final MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true );
|
||||
pro.request( subInv, 1, src );
|
||||
|
||||
this.what.setStackSize( l );
|
||||
IAEItemStack available = subInv.extractItems( this.what, Actionable.MODULATE, src );
|
||||
final IAEItemStack available = subInv.extractItems( this.what, Actionable.MODULATE, src );
|
||||
|
||||
if( available != null )
|
||||
{
|
||||
@@ -254,7 +254,7 @@ public class CraftingTreeNode
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( CraftBranchFailure fail )
|
||||
catch( final CraftBranchFailure fail )
|
||||
{
|
||||
pro.possible = true;
|
||||
}
|
||||
@@ -265,12 +265,12 @@ public class CraftingTreeNode
|
||||
{
|
||||
this.missing += l;
|
||||
this.bytes += l;
|
||||
IAEItemStack rv = this.what.copy();
|
||||
final IAEItemStack rv = this.what.copy();
|
||||
rv.setStackSize( l );
|
||||
return rv;
|
||||
}
|
||||
|
||||
for( IAEItemStack o : thingsUsed )
|
||||
for( final IAEItemStack o : thingsUsed )
|
||||
{
|
||||
this.job.refund( o.copy() );
|
||||
o.setStackSize( -o.getStackSize() );
|
||||
@@ -280,7 +280,7 @@ public class CraftingTreeNode
|
||||
throw new CraftBranchFailure( this.what, l );
|
||||
}
|
||||
|
||||
public void dive( CraftingJob job )
|
||||
public void dive( final CraftingJob job )
|
||||
{
|
||||
if( this.missing > 0 )
|
||||
{
|
||||
@@ -290,15 +290,15 @@ public class CraftingTreeNode
|
||||
|
||||
job.addBytes( 8 + this.bytes );
|
||||
|
||||
for( CraftingTreeProcess pro : this.nodes )
|
||||
for( final CraftingTreeProcess pro : this.nodes )
|
||||
{
|
||||
pro.dive( job );
|
||||
}
|
||||
}
|
||||
|
||||
public IAEItemStack getStack( long size )
|
||||
public IAEItemStack getStack( final long size )
|
||||
{
|
||||
IAEItemStack is = this.what.copy();
|
||||
final IAEItemStack is = this.what.copy();
|
||||
is.setStackSize( size );
|
||||
return is;
|
||||
}
|
||||
@@ -311,17 +311,17 @@ public class CraftingTreeNode
|
||||
this.used.resetStatus();
|
||||
this.exhausted = false;
|
||||
|
||||
for( CraftingTreeProcess pro : this.nodes )
|
||||
for( final CraftingTreeProcess pro : this.nodes )
|
||||
{
|
||||
pro.setSimulate();
|
||||
}
|
||||
}
|
||||
|
||||
public void setJob( MECraftingInventory storage, CraftingCPUCluster craftingCPUCluster, BaseActionSource src ) throws CraftBranchFailure
|
||||
public void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure
|
||||
{
|
||||
for( IAEItemStack i : this.used )
|
||||
for( final IAEItemStack i : this.used )
|
||||
{
|
||||
IAEItemStack ex = storage.extractItems( i, Actionable.MODULATE, src );
|
||||
final IAEItemStack ex = storage.extractItems( i, Actionable.MODULATE, src );
|
||||
|
||||
if( ex == null || ex.getStackSize() != i.getStackSize() )
|
||||
{
|
||||
@@ -333,39 +333,39 @@ public class CraftingTreeNode
|
||||
|
||||
if( this.howManyEmitted > 0 )
|
||||
{
|
||||
IAEItemStack i = this.what.copy();
|
||||
final IAEItemStack i = this.what.copy();
|
||||
i.setStackSize( this.howManyEmitted );
|
||||
craftingCPUCluster.addEmitable( i );
|
||||
}
|
||||
|
||||
for( CraftingTreeProcess pro : this.nodes )
|
||||
for( final CraftingTreeProcess pro : this.nodes )
|
||||
{
|
||||
pro.setJob( storage, craftingCPUCluster, src );
|
||||
}
|
||||
}
|
||||
|
||||
public void getPlan( IItemList<IAEItemStack> plan )
|
||||
public void getPlan( final IItemList<IAEItemStack> plan )
|
||||
{
|
||||
if( this.missing > 0 )
|
||||
{
|
||||
IAEItemStack o = this.what.copy();
|
||||
final IAEItemStack o = this.what.copy();
|
||||
o.setStackSize( this.missing );
|
||||
plan.add( o );
|
||||
}
|
||||
|
||||
if( this.howManyEmitted > 0 )
|
||||
{
|
||||
IAEItemStack i = this.what.copy();
|
||||
final IAEItemStack i = this.what.copy();
|
||||
i.setCountRequestable( this.howManyEmitted );
|
||||
plan.addRequestable( i );
|
||||
}
|
||||
|
||||
for( IAEItemStack i : this.used )
|
||||
for( final IAEItemStack i : this.used )
|
||||
{
|
||||
plan.add( i.copy() );
|
||||
}
|
||||
|
||||
for( CraftingTreeProcess pro : this.nodes )
|
||||
for( final CraftingTreeProcess pro : this.nodes )
|
||||
{
|
||||
pro.getPlan( plan );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user