Compare commits
3 Commits
wip
..
ctree-tweak
| Author | SHA1 | Date | |
|---|---|---|---|
| e3b3c8cc10 | |||
| eea5bc7c6b | |||
| d414c458ae |
+1
-1
@@ -4,7 +4,7 @@ aebuild=7
|
|||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
extended=extended_life
|
extended=extended_life
|
||||||
extendedversion=v50j
|
extendedversion=v50g
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package appeng.crafting;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import appeng.me.cache.GridStorageCache;
|
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -67,7 +66,6 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||||||
private final Stopwatch craftingTreeWatch = Stopwatch.createUnstarted();
|
private final Stopwatch craftingTreeWatch = Stopwatch.createUnstarted();
|
||||||
private CraftingTreeNode tree;
|
private CraftingTreeNode tree;
|
||||||
private final IAEItemStack output;
|
private final IAEItemStack output;
|
||||||
private long expectedOutput;
|
|
||||||
private boolean simulate = false;
|
private boolean simulate = false;
|
||||||
private MECraftingInventory availableCheck;
|
private MECraftingInventory availableCheck;
|
||||||
private long bytes = 0;
|
private long bytes = 0;
|
||||||
@@ -90,25 +88,14 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||||||
this.actionSrc = actionSrc;
|
this.actionSrc = actionSrc;
|
||||||
|
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
|
||||||
final ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
|
final ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
|
||||||
final GridStorageCache sg = grid.getCache( IStorageGrid.class );
|
final IStorageGrid sg = grid.getCache( IStorageGrid.class );
|
||||||
this.original = new MECraftingInventory( sg.getExtractableList( actionSrc ) );
|
this.original = new MECraftingInventory( sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), actionSrc, false, false, false );
|
||||||
|
|
||||||
this.setTree( this.getCraftingTree( cc, what ) );
|
this.setTree( this.getCraftingTree( cc, what ) );
|
||||||
this.availableCheck = null;
|
this.availableCheck = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getExpectedOutput()
|
|
||||||
{
|
|
||||||
return expectedOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void incExpectedOutput( long amount )
|
|
||||||
{
|
|
||||||
this.expectedOutput += amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CraftingTreeNode getCraftingTree( final ICraftingGrid cc, final IAEItemStack what )
|
private CraftingTreeNode getCraftingTree( final ICraftingGrid cc, final IAEItemStack what )
|
||||||
{
|
{
|
||||||
return new CraftingTreeNode( cc, this, what, null, -1, 0 );
|
return new CraftingTreeNode( cc, this, what, null, -1, 0 );
|
||||||
@@ -134,11 +121,6 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||||||
return this.availableCheck.extractItems( available, Actionable.MODULATE, this.actionSrc );
|
return this.availableCheck.extractItems( available, Actionable.MODULATE, this.actionSrc );
|
||||||
}
|
}
|
||||||
|
|
||||||
IAEItemStack checkAvailable( final IAEItemStack available )
|
|
||||||
{
|
|
||||||
return this.original.extractItems( available.copy().setStackSize( Long.MAX_VALUE ), Actionable.SIMULATE, this.actionSrc );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeToNBT( final NBTTagCompound out )
|
public void writeToNBT( final NBTTagCompound out )
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -286,7 +268,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Thread.interrupted() )
|
if( Thread.interrupted() )
|
||||||
{
|
{
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
import appeng.api.networking.security.IActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
@@ -79,32 +81,100 @@ public class CraftingTreeNode
|
|||||||
for( final 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.
|
// order.
|
||||||
{
|
{
|
||||||
if( this.parent == null || job.getExpectedOutput() < job.getOutput().getStackSize() )
|
if( this.parent == null || this.parent.notRecursive() )
|
||||||
{
|
{
|
||||||
this.nodes.add( new CraftingTreeProcess( cc, job, details, this, depth + 1 ) );
|
this.nodes.add( new CraftingTreeProcess( cc, job, details, this, depth + 1 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CraftingTreeNode( final ICraftingGrid cc, final CraftingJob job, final IAEItemStack wat, final CraftingTreeProcess par, final int slot, final int depth, boolean available )
|
||||||
|
{
|
||||||
|
this.what = wat;
|
||||||
|
this.parent = par;
|
||||||
|
this.slot = slot;
|
||||||
|
this.world = job.getWorld();
|
||||||
|
this.job = job;
|
||||||
|
this.sim = false;
|
||||||
|
|
||||||
|
this.canEmit = cc.canEmitFor( this.what );
|
||||||
|
|
||||||
|
if( this.canEmit )
|
||||||
|
{
|
||||||
|
return; // if you can emit for something, you can't make it with patterns.
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !available )
|
||||||
|
{
|
||||||
|
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() )
|
||||||
|
{
|
||||||
|
this.nodes.add( new CraftingTreeProcess( cc, job, details, this, depth + 1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean notRecursive( final ICraftingPatternDetails details )
|
||||||
|
{
|
||||||
|
IAEItemStack[] o = details.getCondensedOutputs();
|
||||||
|
|
||||||
|
for( final IAEItemStack i : o )
|
||||||
|
{
|
||||||
|
if( i.equals( this.what ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
o = details.getCondensedInputs();
|
||||||
|
|
||||||
|
for( final IAEItemStack i : o )
|
||||||
|
{
|
||||||
|
if( i.equals( this.what ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this.parent == null )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.parent.notRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
IAEItemStack request( final MECraftingInventory inv, long l, final IActionSource src ) throws CraftBranchFailure, InterruptedException
|
IAEItemStack request( final MECraftingInventory inv, long l, final IActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||||
{
|
{
|
||||||
this.job.handlePausing();
|
this.job.handlePausing();
|
||||||
|
|
||||||
final IItemList<IAEItemStack> inventoryList = inv.getItemList();
|
|
||||||
final List<IAEItemStack> thingsUsed = new ArrayList<>();
|
final List<IAEItemStack> thingsUsed = new ArrayList<>();
|
||||||
|
|
||||||
this.what.setStackSize( l );
|
this.what.setStackSize( l );
|
||||||
|
|
||||||
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
||||||
{
|
{
|
||||||
Collection<IAEItemStack> itemList = new ArrayList<>();
|
final Collection<IAEItemStack> itemList;
|
||||||
|
final IItemList<IAEItemStack> inventoryList = inv.getItemList();
|
||||||
|
|
||||||
if( this.parent.getContainerItems() != null && !this.parent.getContainerItems().findFuzzy( this.what, FuzzyMode.IGNORE_ALL ).isEmpty() )
|
if( this.parent.details.canSubstitute() )
|
||||||
{
|
{
|
||||||
itemList = inventoryList.findFuzzy( this.what, FuzzyMode.IGNORE_ALL );
|
final List<IAEItemStack> substitutes = this.parent.details.getSubstituteInputs( this.slot );
|
||||||
|
itemList = new ArrayList<>( substitutes.size() );
|
||||||
|
|
||||||
|
for( IAEItemStack stack : substitutes )
|
||||||
|
{
|
||||||
|
itemList.addAll( inventoryList.findFuzzy( stack, FuzzyMode.IGNORE_ALL ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
itemList = Lists.newArrayList();
|
||||||
|
|
||||||
final IAEItemStack item = inventoryList.findPrecise( this.what );
|
final IAEItemStack item = inventoryList.findPrecise( this.what );
|
||||||
|
|
||||||
if( item != null )
|
if( item != null )
|
||||||
{
|
{
|
||||||
itemList.add( item );
|
itemList.add( item );
|
||||||
@@ -275,6 +345,11 @@ public class CraftingTreeNode
|
|||||||
throw new CraftBranchFailure( this.what, l );
|
throw new CraftBranchFailure( this.what, l );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean notRecursive()
|
||||||
|
{
|
||||||
|
return job.getUniques().findPrecise( this.what ) == null || this.parent == null;
|
||||||
|
}
|
||||||
|
|
||||||
void dive( final CraftingJob job )
|
void dive( final CraftingJob job )
|
||||||
{
|
{
|
||||||
if( this.missing > 0 )
|
if( this.missing > 0 )
|
||||||
|
|||||||
@@ -19,19 +19,16 @@
|
|||||||
package appeng.crafting;
|
package appeng.crafting;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import com.google.common.collect.ImmutableCollection;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2LongArrayMap;
|
import it.unimi.dsi.fastutil.objects.Object2LongArrayMap;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
import appeng.api.networking.security.IActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
@@ -53,7 +50,6 @@ public class CraftingTreeProcess
|
|||||||
private long crafts = 0;
|
private long crafts = 0;
|
||||||
private IItemList<IAEItemStack> containerItems;
|
private IItemList<IAEItemStack> containerItems;
|
||||||
private boolean limitQty;
|
private boolean limitQty;
|
||||||
private final List<IAEItemStack> craftingResultList = new ArrayList<>();
|
|
||||||
private long bytes = 0;
|
private long bytes = 0;
|
||||||
|
|
||||||
public CraftingTreeProcess( final ICraftingGrid cc, final CraftingJob job, final ICraftingPatternDetails details, final CraftingTreeNode craftingTreeNode, final int depth )
|
public CraftingTreeProcess( final ICraftingGrid cc, final CraftingJob job, final ICraftingPatternDetails details, final CraftingTreeNode craftingTreeNode, final int depth )
|
||||||
@@ -76,215 +72,47 @@ public class CraftingTreeProcess
|
|||||||
}
|
}
|
||||||
containerItems.add( part );
|
containerItems.add( part );
|
||||||
this.limitQty = true;
|
this.limitQty = true;
|
||||||
//break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( final IAEItemStack part : details.getCondensedOutputs() )
|
|
||||||
{
|
|
||||||
if( part.equals( job.getOutput() ) )
|
|
||||||
{
|
|
||||||
job.incExpectedOutput( part.getStackSize() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for( final IAEItemStack part : details.getCondensedInputs() )
|
|
||||||
{
|
|
||||||
if( part.equals( job.getOutput() ) )
|
|
||||||
{
|
|
||||||
job.incExpectedOutput( -part.getStackSize() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is minor different then below, this slot uses the pattern, but kinda fudges it.
|
// this is minor different then below, this slot uses the pattern, but kinda fudges it.
|
||||||
for( IAEItemStack part : details.getCondensedInputs() )
|
for( IAEItemStack part : details.getCondensedInputs() ) {
|
||||||
{
|
if (part == null) {
|
||||||
if( part == null )
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for( int x = 0; x < list.length; x++ )
|
for (int x = 0; x < list.length; x++) {
|
||||||
{
|
|
||||||
final IAEItemStack comparePart = list[x];
|
final IAEItemStack comparePart = list[x];
|
||||||
if( part.equals( comparePart ) )
|
if (part.equals(comparePart)) {
|
||||||
{
|
if (isContainerItem(part)) {
|
||||||
boolean isPartContainer = false;
|
|
||||||
if( containerItems != null && !containerItems.findFuzzy( list[x], FuzzyMode.IGNORE_ALL ).isEmpty() )
|
|
||||||
{
|
|
||||||
part = list[x];
|
part = list[x];
|
||||||
isPartContainer = true;
|
|
||||||
}
|
}
|
||||||
long wantedSize = part.getStackSize();
|
this.nodes.put(new CraftingTreeNode(cc, job, part.copy(), this, x, depth + 1), part.getStackSize());
|
||||||
|
if (details.canSubstitute()) {
|
||||||
if( !isPartContainer )
|
for ()
|
||||||
{
|
|
||||||
IAEItemStack found = job.checkAvailable( part );
|
|
||||||
IAEItemStack used;
|
|
||||||
long requestAmount;
|
|
||||||
|
|
||||||
long remaining = 0;
|
|
||||||
if( found != null )
|
|
||||||
{
|
|
||||||
used = job.getUsedWhileBuilding().findPrecise( part );
|
|
||||||
remaining = found.getStackSize();
|
|
||||||
if( used != null )
|
|
||||||
{
|
|
||||||
if( used.getStackSize() >= found.getStackSize() )
|
|
||||||
{
|
|
||||||
remaining = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
remaining -= used.getStackSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( remaining > 0 )
|
|
||||||
{
|
|
||||||
if( remaining >= wantedSize )
|
|
||||||
{
|
|
||||||
requestAmount = wantedSize;
|
|
||||||
wantedSize = 0;
|
|
||||||
//we have the items
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
requestAmount = remaining;
|
|
||||||
wantedSize -= remaining;
|
|
||||||
}
|
|
||||||
part = part.copy().setStackSize( requestAmount );
|
|
||||||
job.getUsedWhileBuilding().addStorage( part );
|
|
||||||
this.nodes.put( new CraftingTreeNode( cc, job, part, this, x, depth + 1 ), requestAmount );
|
|
||||||
if( wantedSize == 0 )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( wantedSize > 0 )
|
|
||||||
{
|
|
||||||
if( details.canSubstitute() && cc.getCraftingFor( part, details, x, world ).isEmpty() )
|
|
||||||
{
|
|
||||||
//try to extract substitutes
|
|
||||||
for( IAEItemStack subs : details.getSubstituteInputs( x ) )
|
|
||||||
{
|
|
||||||
if( subs.equals( part ) )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
found = job.checkAvailable( subs );
|
|
||||||
remaining = 0;
|
|
||||||
|
|
||||||
if( found != null )
|
|
||||||
{
|
|
||||||
used = job.getUsedWhileBuilding().findPrecise( subs );
|
|
||||||
remaining = found.getStackSize();
|
|
||||||
if( used != null )
|
|
||||||
{
|
|
||||||
if( used.getStackSize() >= found.getStackSize() )
|
|
||||||
{
|
|
||||||
remaining = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
remaining -= used.getStackSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( remaining > 0 )
|
|
||||||
{
|
|
||||||
if( remaining >= wantedSize )
|
|
||||||
{
|
|
||||||
requestAmount = wantedSize;
|
|
||||||
wantedSize = 0;
|
|
||||||
//we have the items
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
requestAmount = remaining;
|
|
||||||
wantedSize -= remaining;
|
|
||||||
}
|
|
||||||
subs = subs.copy().setStackSize( requestAmount );
|
|
||||||
job.getUsedWhileBuilding().addStorage( subs );
|
|
||||||
this.nodes.put( new CraftingTreeNode( cc, job, subs, this, x, depth + 1 ), requestAmount );
|
|
||||||
}
|
|
||||||
if( wantedSize == 0 )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( wantedSize > 0 )
|
|
||||||
{
|
|
||||||
//try to order the crafting of a substitute
|
|
||||||
ICraftingPatternDetails prioritizedPattern = null;
|
|
||||||
IAEItemStack prioritizedIAE = null;
|
|
||||||
for( IAEItemStack subs : details.getSubstituteInputs( x ) )
|
|
||||||
{
|
|
||||||
if( subs.equals( part ) )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ImmutableCollection<ICraftingPatternDetails> detailCollection = cc.getCraftingFor( subs, details, x, world );
|
|
||||||
|
|
||||||
for( ICraftingPatternDetails sp : detailCollection )
|
|
||||||
{
|
|
||||||
if( prioritizedPattern == null )
|
|
||||||
{
|
|
||||||
prioritizedPattern = sp;
|
|
||||||
prioritizedIAE = subs;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( sp.getPriority() > prioritizedPattern.getPriority() )
|
|
||||||
{
|
|
||||||
prioritizedPattern = sp;
|
|
||||||
prioritizedIAE = subs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.nodes.put( new CraftingTreeNode( cc, job, prioritizedIAE.copy(), this, x, depth + 1 ), wantedSize );
|
|
||||||
wantedSize = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( wantedSize == 0 )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if( wantedSize > 0 )
|
break;
|
||||||
{
|
}
|
||||||
part = part.copy();
|
}
|
||||||
// use the first slot...
|
}
|
||||||
this.nodes.put( new CraftingTreeNode( cc, job, part, this, x, depth + 1 ), wantedSize );
|
|
||||||
wantedSize = 0;
|
if(!this.limitQty) {
|
||||||
}
|
for (final IAEItemStack part : details.getCondensedOutputs()) {
|
||||||
if( !isPartContainer && wantedSize == 0 )
|
for (final IAEItemStack o : details.getCondensedInputs()) {
|
||||||
{
|
if (part.equals(o)) {
|
||||||
|
this.limitQty = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( final IAEItemStack part : details.getCondensedOutputs() )
|
|
||||||
{
|
|
||||||
for( final IAEItemStack o : details.getCondensedInputs() )
|
|
||||||
{
|
|
||||||
if( part.equals( o ) )
|
|
||||||
{
|
|
||||||
this.limitQty = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IItemList<IAEItemStack> getContainerItems()
|
boolean isContainerItem(IAEItemStack iaeItemStack) {
|
||||||
|
return (containerItems != null && !containerItems.findFuzzy(iaeItemStack, FuzzyMode.IGNORE_ALL).isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean notRecursive()
|
||||||
{
|
{
|
||||||
return this.containerItems;
|
return this.parent == null || this.parent.notRecursive();
|
||||||
}
|
}
|
||||||
|
|
||||||
long getTimes( final long remaining, final long stackSize )
|
long getTimes( final long remaining, final long stackSize )
|
||||||
@@ -313,7 +141,7 @@ public class CraftingTreeProcess
|
|||||||
if( o != null )
|
if( o != null )
|
||||||
{
|
{
|
||||||
this.bytes++;
|
this.bytes++;
|
||||||
craftingResultList.add( o );
|
inv.injectItems( o, Actionable.MODULATE, src );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,22 +153,11 @@ public class CraftingTreeProcess
|
|||||||
{
|
{
|
||||||
final IAEItemStack o = out.copy();
|
final IAEItemStack o = out.copy();
|
||||||
o.setStackSize( o.getStackSize() * amountOfTimes );
|
o.setStackSize( o.getStackSize() * amountOfTimes );
|
||||||
craftingResultList.add( o );
|
inv.injectItems( o, Actionable.MODULATE, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( IAEItemStack i : craftingResultList )
|
|
||||||
{
|
|
||||||
inv.injectItems( i, Actionable.MODULATE, src );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.crafts += amountOfTimes;
|
this.crafts += amountOfTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IAEItemStack> getCraftingResultList()
|
|
||||||
{
|
|
||||||
return craftingResultList;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dive( final CraftingJob job )
|
void dive( final CraftingJob job )
|
||||||
{
|
{
|
||||||
job.addTask( this.getAmountCrafted( this.parent.getStack( 1 ) ), this.crafts, this.details, this.depth );
|
job.addTask( this.getAmountCrafted( this.parent.getStack( 1 ) ), this.crafts, this.details, this.depth );
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.me.helpers.PlayerSource;
|
||||||
import appeng.util.inv.ItemListIgnoreCrafting;
|
import appeng.util.inv.ItemListIgnoreCrafting;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
|
||||||
@@ -311,11 +312,11 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
|||||||
{
|
{
|
||||||
if( result == null )
|
if( result == null )
|
||||||
{
|
{
|
||||||
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getDisplayName() + " available but could not extract anything" ), false );
|
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getItem().getItemStackDisplayName( extra.getDefinition() ) + " available but could not extract anything" ), false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getDisplayName() + " available but could only extract " + result.getStackSize() ), false );
|
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getItem().getItemStackDisplayName( extra.getDefinition() ) + " available but could only extract " + result.getStackSize() ), false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|||||||
+8
-34
@@ -19,12 +19,13 @@
|
|||||||
package appeng.me.cache;
|
package appeng.me.cache;
|
||||||
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
|
||||||
import appeng.crafting.MECraftingInventory;
|
|
||||||
import appeng.helpers.IInterfaceHost;
|
|
||||||
import appeng.helpers.IPriorityHost;
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.SetMultimap;
|
import com.google.common.collect.SetMultimap;
|
||||||
|
|
||||||
@@ -54,8 +55,6 @@ import appeng.me.helpers.GenericInterestManager;
|
|||||||
import appeng.me.helpers.MachineSource;
|
import appeng.me.helpers.MachineSource;
|
||||||
import appeng.me.storage.ItemWatcher;
|
import appeng.me.storage.ItemWatcher;
|
||||||
import appeng.me.storage.NetworkInventoryHandler;
|
import appeng.me.storage.NetworkInventoryHandler;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
||||||
|
|
||||||
|
|
||||||
public class GridStorageCache implements IStorageGrid
|
public class GridStorageCache implements IStorageGrid
|
||||||
@@ -69,8 +68,6 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<>();
|
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<>();
|
||||||
private final Map<IStorageChannel<? extends IAEStack>, NetworkInventoryHandler<?>> storageNetworks;
|
private final Map<IStorageChannel<? extends IAEStack>, NetworkInventoryHandler<?>> storageNetworks;
|
||||||
private final Map<IStorageChannel<? extends IAEStack>, NetworkMonitor<?>> storageMonitors;
|
private final Map<IStorageChannel<? extends IAEStack>, NetworkMonitor<?>> storageMonitors;
|
||||||
private MECraftingInventory localCache = null;
|
|
||||||
private final Int2ObjectMap<MECraftingInventory> extractableItemPriorityMap = new Int2ObjectOpenHashMap<>();
|
|
||||||
private int localDepth;
|
private int localDepth;
|
||||||
|
|
||||||
public GridStorageCache( final IGrid g )
|
public GridStorageCache( final IGrid g )
|
||||||
@@ -85,8 +82,6 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
@Override
|
@Override
|
||||||
public void onUpdateTick()
|
public void onUpdateTick()
|
||||||
{
|
{
|
||||||
this.localCache = null;
|
|
||||||
this.extractableItemPriorityMap.clear();
|
|
||||||
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.onTick() );
|
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.onTick() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,28 +169,6 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
return (IMEMonitor<T>) this.storageMonitors.get( channel );
|
return (IMEMonitor<T>) this.storageMonitors.get( channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
public MECraftingInventory getExtractableList( IActionSource src )
|
|
||||||
{
|
|
||||||
if( src instanceof MachineSource )
|
|
||||||
{
|
|
||||||
if( src.machine().isPresent() )
|
|
||||||
{
|
|
||||||
IActionHost machine = src.machine().get();
|
|
||||||
if( machine instanceof IInterfaceHost )
|
|
||||||
{
|
|
||||||
extractableItemPriorityMap.putIfAbsent( ( (IPriorityHost) machine ).getPriority(), new MECraftingInventory( getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), src, false, false, false ) );
|
|
||||||
return extractableItemPriorityMap.get( ( (IPriorityHost) machine ).getPriority() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( localCache == null )
|
|
||||||
{
|
|
||||||
localCache = new MECraftingInventory( getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), src, false, false, false );
|
|
||||||
}
|
|
||||||
return localCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
|
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
|
||||||
{
|
{
|
||||||
if( this.inactiveCellProviders.contains( cc ) )
|
if( this.inactiveCellProviders.contains( cc ) )
|
||||||
@@ -225,7 +198,8 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
|
|
||||||
final IActionSource actionSrc = cc instanceof IActionHost ? new MachineSource( (IActionHost) cc ) : new BaseActionSource();
|
final IActionSource actionSrc = cc instanceof IActionHost ? new MachineSource( (IActionHost) cc ) : new BaseActionSource();
|
||||||
|
|
||||||
this.storageMonitors.forEach( ( channel, monitor ) -> {
|
this.storageMonitors.forEach( ( channel, monitor ) ->
|
||||||
|
{
|
||||||
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( channel ) )
|
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( channel ) )
|
||||||
{
|
{
|
||||||
tracker.postChanges( channel, -1, h, actionSrc );
|
tracker.postChanges( channel, -1, h, actionSrc );
|
||||||
|
|||||||
@@ -239,8 +239,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
// also stop accepting items when the job is complete, i.e. to prevent re-insertion when pushing out
|
// also stop accepting items when the job is complete, i.e. to prevent re-insertion when pushing out
|
||||||
// items during storeItems
|
// items during storeItems
|
||||||
if( input == null || isComplete )
|
if (input == null || isComplete) {
|
||||||
{
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +375,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
final ImmutableList<IAEItemStack> single = ImmutableList.of( diff.copy() );
|
final ImmutableList<IAEItemStack> single = ImmutableList.of( diff.copy() );
|
||||||
|
|
||||||
while ( i.hasNext() )
|
while( i.hasNext() )
|
||||||
{
|
{
|
||||||
final Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next();
|
final Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next();
|
||||||
final IMEMonitorHandlerReceiver<IAEItemStack> receiver = o.getKey();
|
final IMEMonitorHandlerReceiver<IAEItemStack> receiver = o.getKey();
|
||||||
@@ -496,14 +495,15 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCraft( final ICraftingPatternDetails details, final IAEItemStack[] condensedInputs )
|
private boolean canCraft(final ICraftingPatternDetails details, final IAEItemStack[] condensedInputs)
|
||||||
{
|
{
|
||||||
if( !details.isCraftable() )
|
if( !details.isCraftable() )
|
||||||
{
|
{
|
||||||
// Processing patterns are relatively easy
|
// Processing patterns are relatively easy
|
||||||
for( IAEItemStack input : condensedInputs )
|
for ( IAEItemStack input : condensedInputs )
|
||||||
{
|
{
|
||||||
final IAEItemStack ais = this.inventory.extractItems( input.copy(), Actionable.SIMULATE, this.machineSrc );
|
final IAEItemStack ais = this.inventory.extractItems( input.copy(), Actionable.SIMULATE,
|
||||||
|
this.machineSrc );
|
||||||
|
|
||||||
if( ais == null || ais.getStackSize() < input.getStackSize() )
|
if( ais == null || ais.getStackSize() < input.getStackSize() )
|
||||||
{
|
{
|
||||||
@@ -516,7 +516,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
// When substitutions are allowed, we have to keep track of which items we've reserved
|
// When substitutions are allowed, we have to keep track of which items we've reserved
|
||||||
IAEItemStack[] inputs = details.getInputs();
|
IAEItemStack[] inputs = details.getInputs();
|
||||||
Map<IAEItemStack, Integer> consumedCount = new HashMap<>();
|
Map<IAEItemStack, Integer> consumedCount = new HashMap<>();
|
||||||
for( int i = 0; i < inputs.length; i++ )
|
for ( int i = 0; i < inputs.length; i++ )
|
||||||
{
|
{
|
||||||
List<IAEItemStack> substitutes = details.getSubstituteInputs( i );
|
List<IAEItemStack> substitutes = details.getSubstituteInputs( i );
|
||||||
if( substitutes.isEmpty() )
|
if( substitutes.isEmpty() )
|
||||||
@@ -525,9 +525,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for( IAEItemStack substitute : substitutes )
|
for ( IAEItemStack substitute : substitutes )
|
||||||
{
|
{
|
||||||
for( IAEItemStack fuzz : this.inventory.getItemList().findFuzzy( substitute, FuzzyMode.IGNORE_ALL ) )
|
for ( IAEItemStack fuzz : this.inventory.getItemList().findFuzzy( substitute, FuzzyMode.IGNORE_ALL ) )
|
||||||
{
|
{
|
||||||
int alreadyConsumed = consumedCount.getOrDefault( fuzz, 0 );
|
int alreadyConsumed = consumedCount.getOrDefault( fuzz, 0 );
|
||||||
if( fuzz.getStackSize() - alreadyConsumed <= 0 )
|
if( fuzz.getStackSize() - alreadyConsumed <= 0 )
|
||||||
@@ -537,7 +537,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
|
|
||||||
fuzz = fuzz.copy();
|
fuzz = fuzz.copy();
|
||||||
fuzz.setStackSize( 1 ); // We're iterating over non condensed inputs which means there's 1 of each needed
|
fuzz.setStackSize( 1 ); // We're iterating over non condensed inputs which means there's 1 of each needed
|
||||||
final IAEItemStack ais = this.inventory.extractItems( fuzz, Actionable.SIMULATE, this.machineSrc );
|
final IAEItemStack ais = this.inventory.extractItems( fuzz, Actionable.SIMULATE,
|
||||||
|
this.machineSrc );
|
||||||
|
|
||||||
if( ais != null && ais.getStackSize() > 0 )
|
if( ais != null && ais.getStackSize() > 0 )
|
||||||
{
|
{
|
||||||
@@ -564,11 +565,11 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
// When no substitutions can occur, we can simply check that all items are accounted since
|
// When no substitutions can occur, we can simply check that all items are accounted since
|
||||||
// each type of item should only occur once
|
// each type of item should only occur once
|
||||||
for( IAEItemStack g : condensedInputs )
|
for ( IAEItemStack g : condensedInputs )
|
||||||
{
|
{
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
for( IAEItemStack fuzz : this.inventory.getItemList().findFuzzy( g, FuzzyMode.IGNORE_ALL ) )
|
for ( IAEItemStack fuzz : this.inventory.getItemList().findFuzzy( g, FuzzyMode.IGNORE_ALL ) )
|
||||||
{
|
{
|
||||||
fuzz = fuzz.copy();
|
fuzz = fuzz.copy();
|
||||||
fuzz.setStackSize( g.getStackSize() );
|
fuzz.setStackSize( g.getStackSize() );
|
||||||
@@ -674,7 +675,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
this.somethingChanged = false;
|
this.somethingChanged = false;
|
||||||
this.executeCrafting( eg, cc );
|
this.executeCrafting( eg, cc );
|
||||||
} while ( this.somethingChanged && this.remainingOperations > 0 );
|
}
|
||||||
|
while( this.somethingChanged && this.remainingOperations > 0 );
|
||||||
}
|
}
|
||||||
this.usedOps[2] = this.usedOps[1];
|
this.usedOps[2] = this.usedOps[1];
|
||||||
this.usedOps[1] = this.usedOps[0];
|
this.usedOps[1] = this.usedOps[0];
|
||||||
@@ -690,7 +692,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
final Iterator<Entry<ICraftingPatternDetails, TaskProgress>> i = this.tasks.entrySet().iterator();
|
final Iterator<Entry<ICraftingPatternDetails, TaskProgress>> i = this.tasks.entrySet().iterator();
|
||||||
|
|
||||||
while ( i.hasNext() )
|
while( i.hasNext() )
|
||||||
{
|
{
|
||||||
final Entry<ICraftingPatternDetails, TaskProgress> e = i.next();
|
final Entry<ICraftingPatternDetails, TaskProgress> e = i.next();
|
||||||
|
|
||||||
@@ -706,12 +708,12 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
InventoryCrafting ic = null;
|
InventoryCrafting ic = null;
|
||||||
|
|
||||||
if( !visitedMediums.containsKey( details ) || visitedMediums.get( details ).isEmpty() )
|
if (!visitedMediums.containsKey( details ) || visitedMediums.get( details ).isEmpty())
|
||||||
{
|
{
|
||||||
visitedMediums.put( details, new ArrayDeque<>( cc.getMediums( details ).stream().filter( Objects::nonNull ).collect( Collectors.toList() ) ) );
|
visitedMediums.put( details, new ArrayDeque<>( cc.getMediums( details ).stream().filter( Objects::nonNull ).collect( Collectors.toList()) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( !visitedMediums.get( details ).isEmpty() )
|
while (!visitedMediums.get( details ).isEmpty())
|
||||||
{
|
{
|
||||||
|
|
||||||
ICraftingMedium m = visitedMediums.get( details ).poll();
|
ICraftingMedium m = visitedMediums.get( details ).poll();
|
||||||
@@ -771,58 +773,52 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
itemList.addAll( this.inventory.getItemList().findFuzzy( stack, FuzzyMode.IGNORE_ALL ) );
|
itemList.addAll( this.inventory.getItemList().findFuzzy( stack, FuzzyMode.IGNORE_ALL ) );
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
itemList = new ArrayList<>(1);
|
||||||
{
|
|
||||||
itemList = new ArrayList<>( 1 );
|
|
||||||
|
|
||||||
final IAEItemStack item = this.inventory.getItemList().findPrecise( input[x] );
|
final IAEItemStack item = this.inventory.getItemList()
|
||||||
|
.findPrecise(input[x]);
|
||||||
|
|
||||||
if( item != null )
|
if (item != null) {
|
||||||
{
|
itemList.add(item);
|
||||||
itemList.add( item );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( IAEItemStack fuzz : itemList )
|
for (IAEItemStack fuzz : itemList) {
|
||||||
{
|
|
||||||
fuzz = fuzz.copy();
|
fuzz = fuzz.copy();
|
||||||
fuzz.setStackSize( input[x].getStackSize() );
|
fuzz.setStackSize(input[x].getStackSize());
|
||||||
|
|
||||||
if( details.isValidItemForSlot( x, fuzz.createItemStack(), this.getWorld() ) )
|
if (details.isValidItemForSlot(x, fuzz.createItemStack(),
|
||||||
{
|
this.getWorld())) {
|
||||||
final IAEItemStack ais = this.inventory.extractItems( fuzz, Actionable.MODULATE, this.machineSrc );
|
final IAEItemStack ais = this.inventory.extractItems(fuzz,
|
||||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
Actionable.MODULATE, this.machineSrc);
|
||||||
|
final ItemStack is = ais == null ? ItemStack.EMPTY
|
||||||
|
: ais.createItemStack();
|
||||||
|
|
||||||
if( !is.isEmpty() )
|
if (!is.isEmpty()) {
|
||||||
{
|
this.postChange(AEItemStack.fromItemStack(is), this.machineSrc);
|
||||||
this.postChange( AEItemStack.fromItemStack( is ), this.machineSrc );
|
ic.setInventorySlotContents(x, is);
|
||||||
ic.setInventorySlotContents( x, is );
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
final IAEItemStack ais = this.inventory.extractItems(input[x].copy(),
|
||||||
{
|
Actionable.MODULATE, this.machineSrc);
|
||||||
final IAEItemStack ais = this.inventory.extractItems( input[x].copy(), Actionable.MODULATE, this.machineSrc );
|
|
||||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
||||||
|
|
||||||
if( !is.isEmpty() )
|
if (!is.isEmpty()) {
|
||||||
{
|
this.postChange(input[x], this.machineSrc);
|
||||||
this.postChange( input[x], this.machineSrc );
|
ic.setInventorySlotContents(x, is);
|
||||||
ic.setInventorySlotContents( x, is );
|
if (is.getCount() == input[x].getStackSize()) {
|
||||||
if( is.getCount() == input[x].getStackSize() )
|
|
||||||
{
|
|
||||||
found = true;
|
found = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !found )
|
if (!found) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -906,7 +902,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
|
|
||||||
private void storeItems()
|
private void storeItems()
|
||||||
{
|
{
|
||||||
Preconditions.checkState( isComplete, "CPU should be complete to prevent re-insertion when dumping items" );
|
Preconditions.checkState(isComplete, "CPU should be complete to prevent re-insertion when dumping items");
|
||||||
final IGrid g = this.getGrid();
|
final IGrid g = this.getGrid();
|
||||||
|
|
||||||
if( g == null )
|
if( g == null )
|
||||||
@@ -1020,7 +1016,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
public boolean isBusy()
|
public boolean isBusy()
|
||||||
{
|
{
|
||||||
|
|
||||||
this.tasks.entrySet().removeIf( taskProgressEntry -> taskProgressEntry.getValue().value <= 0 );
|
this.tasks.entrySet().removeIf(
|
||||||
|
taskProgressEntry -> taskProgressEntry.getValue().value <= 0 );
|
||||||
|
|
||||||
if( !this.waitingFor.isEmpty() || !this.tasks.isEmpty() )
|
if( !this.waitingFor.isEmpty() || !this.tasks.isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -1078,7 +1075,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
final int hash = System.identityHashCode( this );
|
final int hash = System.identityHashCode( this );
|
||||||
final int hmm = this.finalOutput == null ? 0 : this.finalOutput.hashCode();
|
final int hmm = this.finalOutput == null ? 0 : this.finalOutput.hashCode();
|
||||||
|
|
||||||
return Long.toString( now, Character.MAX_RADIX ) + '-' + Integer.toString( hash, Character.MAX_RADIX ) + '-' + Integer.toString( hmm, Character.MAX_RADIX );
|
return Long.toString( now, Character.MAX_RADIX ) + '-' + Integer.toString( hash, Character.MAX_RADIX ) + '-' + Integer.toString( hmm,
|
||||||
|
Character.MAX_RADIX );
|
||||||
}
|
}
|
||||||
|
|
||||||
private NBTTagCompound generateLinkData( final String craftingID, final boolean standalone, final boolean req )
|
private NBTTagCompound generateLinkData( final String craftingID, final boolean standalone, final boolean req )
|
||||||
@@ -1105,7 +1103,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
|
|
||||||
public void getListOfItem( final IItemList<IAEItemStack> list, final CraftingItemList whichList )
|
public void getListOfItem( final IItemList<IAEItemStack> list, final CraftingItemList whichList )
|
||||||
{
|
{
|
||||||
switch ( whichList )
|
switch( whichList )
|
||||||
{
|
{
|
||||||
case ACTIVE:
|
case ACTIVE:
|
||||||
for( final IAEItemStack ais : this.waitingFor )
|
for( final IAEItemStack ais : this.waitingFor )
|
||||||
@@ -1176,7 +1174,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
{
|
{
|
||||||
IAEItemStack is;
|
IAEItemStack is;
|
||||||
|
|
||||||
switch ( storage2 )
|
switch( storage2 )
|
||||||
{
|
{
|
||||||
case STORAGE:
|
case STORAGE:
|
||||||
is = this.inventory.getItemList().findPrecise( what );
|
is = this.inventory.getItemList().findPrecise( what );
|
||||||
|
|||||||
Reference in New Issue
Block a user