Reduces visibility of internal fields/methods
Reduces the visibility of all fields to private and create setters/getters when necessary. Exceptions are fields with GuiSync as these need to be public. Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
@@ -27,7 +27,7 @@ public class CraftBranchFailure extends Exception
|
||||
|
||||
private static final long serialVersionUID = 654603652836724823L;
|
||||
|
||||
final IAEItemStack missing;
|
||||
private final IAEItemStack missing;
|
||||
|
||||
public CraftBranchFailure( final IAEItemStack what, final long howMany )
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CraftingCalculationFailure extends RuntimeException
|
||||
|
||||
private static final long serialVersionUID = 654603652836724823L;
|
||||
|
||||
final IAEItemStack missing;
|
||||
private final IAEItemStack missing;
|
||||
|
||||
public CraftingCalculationFailure( final IAEItemStack what, final long howMany )
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@ package appeng.crafting;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -46,36 +44,25 @@ import com.google.common.base.Stopwatch;
|
||||
public class CraftingJob implements Runnable, ICraftingJob
|
||||
{
|
||||
|
||||
final IItemList<IAEItemStack> storage;
|
||||
final Set<IAEItemStack> prophecies;
|
||||
final MECraftingInventory original;
|
||||
final World world;
|
||||
final IItemList<IAEItemStack> crafting = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<String, TwoIntegers>();
|
||||
private final MECraftingInventory original;
|
||||
private final World world;
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<String, TwoIntegers>();
|
||||
private final Object monitor = new Object();
|
||||
private final Stopwatch watch = Stopwatch.createUnstarted();
|
||||
public CraftingTreeNode tree;
|
||||
IAEItemStack output;
|
||||
boolean simulate = false;
|
||||
MECraftingInventory availableCheck;
|
||||
long bytes = 0;
|
||||
private BaseActionSource actionSrc;
|
||||
private ICraftingCallback callback;
|
||||
private CraftingTreeNode tree;
|
||||
private final IAEItemStack output;
|
||||
private boolean simulate = false;
|
||||
private MECraftingInventory availableCheck;
|
||||
private long bytes = 0;
|
||||
private final BaseActionSource actionSrc;
|
||||
private final ICraftingCallback callback;
|
||||
private boolean running = false;
|
||||
private boolean done = false;
|
||||
private int time = 5;
|
||||
private int incTime = Integer.MAX_VALUE;
|
||||
|
||||
public CraftingJob( final World w, final NBTTagCompound data )
|
||||
{
|
||||
this.world = this.wrapWorld( w );
|
||||
this.storage = AEApi.instance().storage().createItemList();
|
||||
this.prophecies = new HashSet<IAEItemStack>();
|
||||
this.original = null;
|
||||
this.availableCheck = null;
|
||||
}
|
||||
|
||||
private World wrapWorld( final World w )
|
||||
{
|
||||
return w;
|
||||
@@ -85,8 +72,6 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
{
|
||||
this.world = this.wrapWorld( w );
|
||||
this.output = what.copy();
|
||||
this.storage = AEApi.instance().storage().createItemList();
|
||||
this.prophecies = new HashSet<IAEItemStack>();
|
||||
this.actionSrc = actionSrc;
|
||||
|
||||
this.callback = callback;
|
||||
@@ -94,7 +79,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
final IStorageGrid sg = grid.getCache( IStorageGrid.class );
|
||||
this.original = new MECraftingInventory( sg.getItemInventory(), actionSrc, false, false, false );
|
||||
|
||||
this.tree = this.getCraftingTree( cc, what );
|
||||
this.setTree( this.getCraftingTree( cc, what ) );
|
||||
this.availableCheck = null;
|
||||
}
|
||||
|
||||
@@ -103,12 +88,12 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
return new CraftingTreeNode( cc, this, what, null, -1, 0 );
|
||||
}
|
||||
|
||||
public void refund( final IAEItemStack o )
|
||||
void refund( final IAEItemStack o )
|
||||
{
|
||||
this.availableCheck.injectItems( o, Actionable.MODULATE, this.actionSrc );
|
||||
}
|
||||
|
||||
public IAEItemStack checkUse( final IAEItemStack available )
|
||||
IAEItemStack checkUse( final IAEItemStack available )
|
||||
{
|
||||
return this.availableCheck.extractItems( available, Actionable.MODULATE, this.actionSrc );
|
||||
}
|
||||
@@ -118,7 +103,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
}
|
||||
|
||||
public void addTask( IAEItemStack what, final long crafts, final ICraftingPatternDetails details, final int depth )
|
||||
void addTask( IAEItemStack what, final long crafts, final ICraftingPatternDetails details, final int depth )
|
||||
{
|
||||
if( crafts > 0 )
|
||||
{
|
||||
@@ -128,7 +113,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
}
|
||||
}
|
||||
|
||||
public void addMissing( IAEItemStack what )
|
||||
void addMissing( IAEItemStack what )
|
||||
{
|
||||
what = what.copy();
|
||||
this.missing.add( what );
|
||||
@@ -150,8 +135,8 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
craftingInventory.ignore( this.output );
|
||||
|
||||
this.availableCheck = new MECraftingInventory( this.original, false, false, false );
|
||||
this.tree.request( craftingInventory, this.output.getStackSize(), this.actionSrc );
|
||||
this.tree.dive( this );
|
||||
this.getTree().request( craftingInventory, this.output.getStackSize(), this.actionSrc );
|
||||
this.getTree().dive( this );
|
||||
|
||||
for( final String s : this.opsAndMultiplier.keySet() )
|
||||
{
|
||||
@@ -175,9 +160,9 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
this.availableCheck = new MECraftingInventory( this.original, false, false, false );
|
||||
|
||||
this.tree.setSimulate();
|
||||
this.tree.request( craftingInventory, this.output.getStackSize(), this.actionSrc );
|
||||
this.tree.dive( this );
|
||||
this.getTree().setSimulate();
|
||||
this.getTree().request( craftingInventory, this.output.getStackSize(), this.actionSrc );
|
||||
this.getTree().dive( this );
|
||||
|
||||
for( final String s : this.opsAndMultiplier.keySet() )
|
||||
{
|
||||
@@ -224,7 +209,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
this.finish();
|
||||
}
|
||||
|
||||
public void handlePausing() throws InterruptedException
|
||||
void handlePausing() throws InterruptedException
|
||||
{
|
||||
if( this.incTime > 100 )
|
||||
{
|
||||
@@ -260,7 +245,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
this.incTime++;
|
||||
}
|
||||
|
||||
public void finish()
|
||||
private void finish()
|
||||
{
|
||||
if( this.callback != null )
|
||||
{
|
||||
@@ -297,9 +282,9 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
@Override
|
||||
public void populatePlan( final IItemList<IAEItemStack> plan )
|
||||
{
|
||||
if( this.tree != null )
|
||||
if( this.getTree() != null )
|
||||
{
|
||||
this.tree.getPlan( plan );
|
||||
this.getTree().getPlan( plan );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +299,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
return this.done;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
World getWorld()
|
||||
{
|
||||
return this.world;
|
||||
}
|
||||
@@ -362,15 +347,25 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addBytes( final long crafts )
|
||||
void addBytes( final long crafts )
|
||||
{
|
||||
this.bytes += crafts;
|
||||
}
|
||||
|
||||
static class TwoIntegers
|
||||
public CraftingTreeNode getTree()
|
||||
{
|
||||
return this.tree;
|
||||
}
|
||||
|
||||
private void setTree( final CraftingTreeNode tree )
|
||||
{
|
||||
this.tree = tree;
|
||||
}
|
||||
|
||||
private static class TwoIntegers
|
||||
{
|
||||
|
||||
public final long perOp = 0;
|
||||
public final long times = 0;
|
||||
private final long perOp = 0;
|
||||
private final long times = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,19 +30,19 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
public class CraftingLink implements ICraftingLink
|
||||
{
|
||||
|
||||
final ICraftingRequester req;
|
||||
final ICraftingCPU cpu;
|
||||
final String CraftID;
|
||||
final boolean standalone;
|
||||
boolean canceled = false;
|
||||
boolean done = false;
|
||||
CraftingLinkNexus tie;
|
||||
private final ICraftingRequester req;
|
||||
private final ICraftingCPU cpu;
|
||||
private final String CraftID;
|
||||
private final boolean standalone;
|
||||
private boolean canceled = false;
|
||||
private boolean done = false;
|
||||
private CraftingLinkNexus tie;
|
||||
|
||||
public CraftingLink( final NBTTagCompound data, final ICraftingRequester req )
|
||||
{
|
||||
this.CraftID = data.getString( "CraftID" );
|
||||
this.canceled = data.getBoolean( "canceled" );
|
||||
this.done = data.getBoolean( "done" );
|
||||
this.setCanceled( data.getBoolean( "canceled" ) );
|
||||
this.setDone( data.getBoolean( "done" ) );
|
||||
this.standalone = data.getBoolean( "standalone" );
|
||||
|
||||
if( !data.hasKey( "req" ) || !data.getBoolean( "req" ) )
|
||||
@@ -57,8 +57,8 @@ public class CraftingLink implements ICraftingLink
|
||||
public CraftingLink( final NBTTagCompound data, final ICraftingCPU cpu )
|
||||
{
|
||||
this.CraftID = data.getString( "CraftID" );
|
||||
this.canceled = data.getBoolean( "canceled" );
|
||||
this.done = data.getBoolean( "done" );
|
||||
this.setCanceled( data.getBoolean( "canceled" ) );
|
||||
this.setDone( data.getBoolean( "done" ) );
|
||||
this.standalone = data.getBoolean( "standalone" );
|
||||
|
||||
if( !data.hasKey( "req" ) || data.getBoolean( "req" ) )
|
||||
@@ -120,7 +120,7 @@ public class CraftingLink implements ICraftingLink
|
||||
return;
|
||||
}
|
||||
|
||||
this.canceled = true;
|
||||
this.setCanceled( true );
|
||||
|
||||
if( this.tie != null )
|
||||
{
|
||||
@@ -140,10 +140,10 @@ public class CraftingLink implements ICraftingLink
|
||||
public void writeToNBT( final NBTTagCompound tag )
|
||||
{
|
||||
tag.setString( "CraftID", this.CraftID );
|
||||
tag.setBoolean( "canceled", this.canceled );
|
||||
tag.setBoolean( "done", this.done );
|
||||
tag.setBoolean( "canceled", this.isCanceled() );
|
||||
tag.setBoolean( "done", this.isDone() );
|
||||
tag.setBoolean( "standalone", this.standalone );
|
||||
tag.setBoolean( "req", this.req != null );
|
||||
tag.setBoolean( "req", this.getRequester() != null );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +159,7 @@ public class CraftingLink implements ICraftingLink
|
||||
this.tie.remove( this );
|
||||
}
|
||||
|
||||
if( this.canceled && n != null )
|
||||
if( this.isCanceled() && n != null )
|
||||
{
|
||||
n.cancel();
|
||||
this.tie = null;
|
||||
@@ -176,12 +176,12 @@ public class CraftingLink implements ICraftingLink
|
||||
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode )
|
||||
{
|
||||
if( this.tie == null || this.tie.req == null || this.tie.req.req == null )
|
||||
if( this.tie == null || this.tie.getRequest() == null || this.tie.getRequest().getRequester() == null )
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
return this.tie.req.req.injectCraftedItems( this.tie.req, input, mode );
|
||||
return this.tie.getRequest().getRequester().injectCraftedItems( this.tie.getRequest(), input, mode );
|
||||
}
|
||||
|
||||
public void markDone()
|
||||
@@ -191,4 +191,24 @@ public class CraftingLink implements ICraftingLink
|
||||
this.tie.markDone();
|
||||
}
|
||||
}
|
||||
|
||||
void setCanceled( final boolean canceled )
|
||||
{
|
||||
this.canceled = canceled;
|
||||
}
|
||||
|
||||
ICraftingRequester getRequester()
|
||||
{
|
||||
return this.req;
|
||||
}
|
||||
|
||||
ICraftingCPU getCpu()
|
||||
{
|
||||
return this.cpu;
|
||||
}
|
||||
|
||||
void setDone( final boolean done )
|
||||
{
|
||||
this.done = done;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@ import appeng.me.cache.CraftingGridCache;
|
||||
public class CraftingLinkNexus
|
||||
{
|
||||
|
||||
public final String CraftID;
|
||||
boolean canceled = false;
|
||||
boolean done = false;
|
||||
int tickOfDeath = 0;
|
||||
CraftingLink req;
|
||||
CraftingLink cpu;
|
||||
private final String craftID;
|
||||
private boolean canceled = false;
|
||||
private boolean done = false;
|
||||
private int tickOfDeath = 0;
|
||||
private CraftingLink req;
|
||||
private CraftingLink cpu;
|
||||
|
||||
public CraftingLinkNexus( final String craftID )
|
||||
{
|
||||
this.CraftID = craftID;
|
||||
this.craftID = craftID;
|
||||
}
|
||||
|
||||
public boolean isDead( final IGrid g, final CraftingGridCache craftingGridCache )
|
||||
@@ -46,14 +46,14 @@ public class CraftingLinkNexus
|
||||
return true;
|
||||
}
|
||||
|
||||
if( this.req == null || this.cpu == null )
|
||||
if( this.getRequest() == null || this.cpu == null )
|
||||
{
|
||||
this.tickOfDeath++;
|
||||
}
|
||||
else
|
||||
{
|
||||
final boolean hasCpu = craftingGridCache.hasCpu( this.cpu.cpu );
|
||||
final boolean hasMachine = this.req.req.getActionableNode().getGrid() == g;
|
||||
final boolean hasCpu = craftingGridCache.hasCpu( this.cpu.getCpu() );
|
||||
final boolean hasMachine = this.getRequest().getRequester().getActionableNode().getGrid() == g;
|
||||
|
||||
if( hasCpu && hasMachine )
|
||||
{
|
||||
@@ -74,30 +74,30 @@ public class CraftingLinkNexus
|
||||
return false;
|
||||
}
|
||||
|
||||
public void cancel()
|
||||
void cancel()
|
||||
{
|
||||
this.canceled = true;
|
||||
|
||||
if( this.req != null )
|
||||
if( this.getRequest() != null )
|
||||
{
|
||||
this.req.canceled = true;
|
||||
if( this.req.req != null )
|
||||
this.getRequest().setCanceled( true );
|
||||
if( this.getRequest().getRequester() != null )
|
||||
{
|
||||
this.req.req.jobStateChange( this.req );
|
||||
this.getRequest().getRequester().jobStateChange( this.getRequest() );
|
||||
}
|
||||
}
|
||||
|
||||
if( this.cpu != null )
|
||||
{
|
||||
this.cpu.canceled = true;
|
||||
this.cpu.setCanceled( true );
|
||||
}
|
||||
}
|
||||
|
||||
public void remove( final CraftingLink craftingLink )
|
||||
void remove( final CraftingLink craftingLink )
|
||||
{
|
||||
if( this.req == craftingLink )
|
||||
if( this.getRequest() == craftingLink )
|
||||
{
|
||||
this.req = null;
|
||||
this.setRequest( null );
|
||||
}
|
||||
else if( this.cpu == craftingLink )
|
||||
{
|
||||
@@ -105,60 +105,70 @@ public class CraftingLinkNexus
|
||||
}
|
||||
}
|
||||
|
||||
public void add( final CraftingLink craftingLink )
|
||||
void add( final CraftingLink craftingLink )
|
||||
{
|
||||
if( craftingLink.cpu != null )
|
||||
if( craftingLink.getCpu() != null )
|
||||
{
|
||||
this.cpu = craftingLink;
|
||||
}
|
||||
else if( craftingLink.req != null )
|
||||
else if( craftingLink.getRequester() != null )
|
||||
{
|
||||
this.req = craftingLink;
|
||||
this.setRequest( craftingLink );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCanceled()
|
||||
boolean isCanceled()
|
||||
{
|
||||
return this.canceled;
|
||||
}
|
||||
|
||||
public boolean isDone()
|
||||
boolean isDone()
|
||||
{
|
||||
return this.done;
|
||||
}
|
||||
|
||||
public void markDone()
|
||||
void markDone()
|
||||
{
|
||||
this.done = true;
|
||||
|
||||
if( this.req != null )
|
||||
if( this.getRequest() != null )
|
||||
{
|
||||
this.req.done = true;
|
||||
if( this.req.req != null )
|
||||
this.getRequest().setDone( true );
|
||||
if( this.getRequest().getRequester() != null )
|
||||
{
|
||||
this.req.req.jobStateChange( this.req );
|
||||
this.getRequest().getRequester().jobStateChange( this.getRequest() );
|
||||
}
|
||||
}
|
||||
|
||||
if( this.cpu != null )
|
||||
{
|
||||
this.cpu.done = true;
|
||||
this.cpu.setDone( true );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMachine( final IGridHost machine )
|
||||
{
|
||||
return this.req == machine;
|
||||
return this.getRequest() == machine;
|
||||
}
|
||||
|
||||
public void removeNode()
|
||||
{
|
||||
if( this.req != null )
|
||||
if( this.getRequest() != null )
|
||||
{
|
||||
this.req.setNexus( null );
|
||||
this.getRequest().setNexus( null );
|
||||
}
|
||||
|
||||
this.req = null;
|
||||
this.setRequest( null );
|
||||
this.tickOfDeath = 0;
|
||||
}
|
||||
|
||||
public CraftingLink getRequest()
|
||||
{
|
||||
return req;
|
||||
}
|
||||
|
||||
public void setRequest( CraftingLink req )
|
||||
{
|
||||
this.req = req;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CraftingTreeNode
|
||||
{
|
||||
|
||||
// what slot!
|
||||
final int slot;
|
||||
private final int slot;
|
||||
private final CraftingJob job;
|
||||
private final IItemList<IAEItemStack> used = AEApi.instance().storage().createItemList();
|
||||
// parent node.
|
||||
@@ -54,10 +54,10 @@ public class CraftingTreeNode
|
||||
private final ArrayList<CraftingTreeProcess> nodes = new ArrayList<CraftingTreeProcess>();
|
||||
private int bytes = 0;
|
||||
private boolean canEmit = false;
|
||||
private boolean cannotUse = false;
|
||||
private long missing = 0;
|
||||
private long howManyEmitted = 0;
|
||||
private boolean exhausted = false;
|
||||
|
||||
private boolean sim;
|
||||
|
||||
public CraftingTreeNode( final ICraftingGrid cc, final CraftingJob job, final IAEItemStack wat, final CraftingTreeProcess par, final int slot, final int depth )
|
||||
@@ -116,14 +116,14 @@ public class CraftingTreeNode
|
||||
return this.parent.notRecursive( details );
|
||||
}
|
||||
|
||||
public IAEItemStack request( final MECraftingInventory inv, long l, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
IAEItemStack request( final MECraftingInventory inv, long l, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
{
|
||||
this.job.handlePausing();
|
||||
|
||||
final List<IAEItemStack> thingsUsed = new LinkedList<IAEItemStack>();
|
||||
|
||||
this.what.setStackSize( l );
|
||||
if( this.slot >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
||||
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
||||
{
|
||||
final Collection<IAEItemStack> itemList;
|
||||
final IItemList<IAEItemStack> inventoryList = inv.getItemList();
|
||||
@@ -146,7 +146,7 @@ public class CraftingTreeNode
|
||||
|
||||
for( IAEItemStack fuzz : itemList )
|
||||
{
|
||||
if( this.parent.details.isValidItemForSlot( this.slot, fuzz.getItemStack(), this.world ) )
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.getItemStack(), this.world ) )
|
||||
{
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( l );
|
||||
@@ -308,7 +308,7 @@ public class CraftingTreeNode
|
||||
throw new CraftBranchFailure( this.what, l );
|
||||
}
|
||||
|
||||
public void dive( final CraftingJob job )
|
||||
void dive( final CraftingJob job )
|
||||
{
|
||||
if( this.missing > 0 )
|
||||
{
|
||||
@@ -324,14 +324,14 @@ public class CraftingTreeNode
|
||||
}
|
||||
}
|
||||
|
||||
public IAEItemStack getStack( final long size )
|
||||
IAEItemStack getStack( final long size )
|
||||
{
|
||||
final IAEItemStack is = this.what.copy();
|
||||
is.setStackSize( size );
|
||||
return is;
|
||||
}
|
||||
|
||||
public void setSimulate()
|
||||
void setSimulate()
|
||||
{
|
||||
this.sim = true;
|
||||
this.missing = 0;
|
||||
@@ -372,7 +372,7 @@ public class CraftingTreeNode
|
||||
}
|
||||
}
|
||||
|
||||
public void getPlan( final IItemList<IAEItemStack> plan )
|
||||
void getPlan( final IItemList<IAEItemStack> plan )
|
||||
{
|
||||
if( this.missing > 0 )
|
||||
{
|
||||
@@ -398,4 +398,9 @@ public class CraftingTreeNode
|
||||
pro.getPlan( plan );
|
||||
}
|
||||
}
|
||||
|
||||
int getSlot()
|
||||
{
|
||||
return this.slot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,17 +43,17 @@ import appeng.util.Platform;
|
||||
public class CraftingTreeProcess
|
||||
{
|
||||
|
||||
final CraftingTreeNode parent;
|
||||
private final CraftingTreeNode parent;
|
||||
final ICraftingPatternDetails details;
|
||||
final CraftingJob job;
|
||||
final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>();
|
||||
private final CraftingJob job;
|
||||
private final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>();
|
||||
private final int depth;
|
||||
public boolean possible = true;
|
||||
World world;
|
||||
long crafts = 0;
|
||||
boolean containerItems;
|
||||
boolean limitQty;
|
||||
boolean fullSimulation;
|
||||
boolean possible = true;
|
||||
private World world;
|
||||
private long crafts = 0;
|
||||
private boolean containerItems;
|
||||
private boolean limitQty;
|
||||
private boolean fullSimulation;
|
||||
private long bytes = 0;
|
||||
|
||||
public CraftingTreeProcess( final ICraftingGrid cc, final CraftingJob job, final ICraftingPatternDetails details, final CraftingTreeNode craftingTreeNode, final int depth )
|
||||
@@ -169,7 +169,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
}
|
||||
|
||||
public boolean notRecursive( final ICraftingPatternDetails details )
|
||||
boolean notRecursive( final ICraftingPatternDetails details )
|
||||
{
|
||||
return this.parent == null || this.parent.notRecursive( details );
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class CraftingTreeProcess
|
||||
return ( remaining / stackSize ) + ( remaining % stackSize != 0 ? 1 : 0 );
|
||||
}
|
||||
|
||||
public void request( final MECraftingInventory inv, final long i, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
void request( final MECraftingInventory inv, final long i, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
{
|
||||
this.job.handlePausing();
|
||||
|
||||
@@ -196,7 +196,7 @@ public class CraftingTreeProcess
|
||||
final IAEItemStack item = entry.getKey().getStack( entry.getValue() );
|
||||
final IAEItemStack stack = entry.getKey().request( inv, item.getStackSize(), src );
|
||||
|
||||
ic.setInventorySlotContents( entry.getKey().slot, stack.getItemStack() );
|
||||
ic.setInventorySlotContents( entry.getKey().getSlot(), stack.getItemStack() );
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.world ), this.details.getOutput( ic, this.world ), ic );
|
||||
@@ -248,7 +248,7 @@ public class CraftingTreeProcess
|
||||
this.crafts += i;
|
||||
}
|
||||
|
||||
public void dive( final CraftingJob job )
|
||||
void dive( final CraftingJob job )
|
||||
{
|
||||
job.addTask( this.getAmountCrafted( this.parent.getStack( 1 ) ), this.crafts, this.details, this.depth );
|
||||
for( final CraftingTreeNode pro : this.nodes.keySet() )
|
||||
@@ -285,7 +285,7 @@ public class CraftingTreeProcess
|
||||
throw new IllegalStateException( "Crafting Tree construction failed." );
|
||||
}
|
||||
|
||||
public void setSimulate()
|
||||
void setSimulate()
|
||||
{
|
||||
this.crafts = 0;
|
||||
this.bytes = 0;
|
||||
@@ -296,7 +296,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
}
|
||||
|
||||
public void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure
|
||||
void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure
|
||||
{
|
||||
craftingCPUCluster.addCrafting( this.details, this.crafts );
|
||||
|
||||
@@ -306,7 +306,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
}
|
||||
|
||||
public void getPlan( final IItemList<IAEItemStack> plan )
|
||||
void getPlan( final IItemList<IAEItemStack> plan )
|
||||
{
|
||||
for( IAEItemStack i : this.details.getOutputs() )
|
||||
{
|
||||
|
||||
@@ -37,9 +37,9 @@ import appeng.me.cache.CraftingGridCache;
|
||||
public class CraftingWatcher implements ICraftingWatcher
|
||||
{
|
||||
|
||||
final CraftingGridCache gsc;
|
||||
final ICraftingWatcherHost host;
|
||||
final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
|
||||
private final CraftingGridCache gsc;
|
||||
private final ICraftingWatcherHost host;
|
||||
private final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
|
||||
|
||||
public CraftingWatcher( final CraftingGridCache cache, final ICraftingWatcherHost host )
|
||||
{
|
||||
@@ -99,13 +99,13 @@ public class CraftingWatcher implements ICraftingWatcher
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.myInterests.add( e.copy() ) && this.gsc.interestManager.put( e, this );
|
||||
return this.myInterests.add( e.copy() ) && this.gsc.getInterestManager().put( e, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove( final Object o )
|
||||
{
|
||||
return this.myInterests.remove( o ) && this.gsc.interestManager.remove( (IAEStack) o, this );
|
||||
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,17 +162,17 @@ public class CraftingWatcher implements ICraftingWatcher
|
||||
final Iterator<IAEStack> i = this.myInterests.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
this.gsc.interestManager.remove( i.next(), this );
|
||||
this.gsc.getInterestManager().remove( i.next(), this );
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
||||
class ItemWatcherIterator implements Iterator<IAEStack>
|
||||
private class ItemWatcherIterator implements Iterator<IAEStack>
|
||||
{
|
||||
|
||||
final CraftingWatcher watcher;
|
||||
final Iterator<IAEStack> interestIterator;
|
||||
IAEStack myLast;
|
||||
private final CraftingWatcher watcher;
|
||||
private final Iterator<IAEStack> interestIterator;
|
||||
private IAEStack myLast;
|
||||
|
||||
public ItemWatcherIterator( final CraftingWatcher parent, final Iterator<IAEStack> i )
|
||||
{
|
||||
@@ -195,7 +195,7 @@ public class CraftingWatcher implements ICraftingWatcher
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
CraftingWatcher.this.gsc.interestManager.remove( this.myLast, this.watcher );
|
||||
CraftingWatcher.this.gsc.getInterestManager().remove( this.myLast, this.watcher );
|
||||
this.interestIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,19 +32,19 @@ import appeng.api.storage.data.IItemList;
|
||||
public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
|
||||
final MECraftingInventory par;
|
||||
private final MECraftingInventory par;
|
||||
|
||||
final IMEInventory<IAEItemStack> target;
|
||||
final IItemList<IAEItemStack> localCache;
|
||||
private final IMEInventory<IAEItemStack> target;
|
||||
private final IItemList<IAEItemStack> localCache;
|
||||
|
||||
final boolean logExtracted;
|
||||
final IItemList<IAEItemStack> extractedCache;
|
||||
private final boolean logExtracted;
|
||||
private final IItemList<IAEItemStack> extractedCache;
|
||||
|
||||
final boolean logInjections;
|
||||
final IItemList<IAEItemStack> injectedCache;
|
||||
private final boolean logInjections;
|
||||
private final IItemList<IAEItemStack> injectedCache;
|
||||
|
||||
final boolean logMissing;
|
||||
final IItemList<IAEItemStack> missingCache;
|
||||
private final boolean logMissing;
|
||||
private final IItemList<IAEItemStack> missingCache;
|
||||
|
||||
public MECraftingInventory()
|
||||
{
|
||||
@@ -336,12 +336,12 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addMissing( final IAEItemStack extra )
|
||||
private void addMissing( final IAEItemStack extra )
|
||||
{
|
||||
this.missingCache.add( extra );
|
||||
}
|
||||
|
||||
public void ignore( final IAEItemStack what )
|
||||
void ignore( final IAEItemStack what )
|
||||
{
|
||||
final IAEItemStack list = this.localCache.findPrecise( what );
|
||||
if( list != null )
|
||||
|
||||
Reference in New Issue
Block a user