workss
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ aebuild=7
|
||||
aegroup=appeng
|
||||
aebasename=appliedenergistics2
|
||||
extended=extended_life
|
||||
extendedversion=v51g
|
||||
extendedversion=v52b
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
|
||||
@@ -93,7 +93,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
private CraftingTreeNode getCraftingTree( final ICraftingGrid cc, final IAEItemStack what )
|
||||
{
|
||||
return new CraftingTreeNode( cc, this, what, null, -1 );
|
||||
return new CraftingTreeNode( cc, this, what, what.getStackSize(), null, -1 );
|
||||
}
|
||||
|
||||
void refund( final IAEItemStack o )
|
||||
|
||||
@@ -33,13 +33,13 @@ import appeng.core.sync.packets.PacketInformPlayer;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -60,13 +60,12 @@ public class CraftingTreeNode
|
||||
private final ArrayList<CraftingTreeProcess> nodes = new ArrayList<>();
|
||||
private final boolean canEmit;
|
||||
private CraftingTreeNode loopHead;
|
||||
private int times;
|
||||
private int bytes = 0;
|
||||
private long missing = 0;
|
||||
private long howManyEmitted = 0;
|
||||
private boolean exhausted = false;
|
||||
|
||||
public CraftingTreeNode( final ICraftingGrid cc, final CraftingJob job, final IAEItemStack wat, final CraftingTreeProcess par, final int slot )
|
||||
public CraftingTreeNode( final ICraftingGrid cc, final CraftingJob job, final IAEItemStack wat, long amount, final CraftingTreeProcess par, final int slot )
|
||||
{
|
||||
this.what = wat;
|
||||
this.parent = par;
|
||||
@@ -89,7 +88,7 @@ public class CraftingTreeNode
|
||||
{
|
||||
if( what.equals( o ) )
|
||||
{
|
||||
times = (int) ( what.getStackSize() / o.getStackSize() + ( what.getStackSize() % o.getStackSize() != 0 ? 1 : 0 ) );
|
||||
times = (int) ( amount / o.getStackSize() + ( amount % o.getStackSize() != 0 ? 1 : 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +97,10 @@ public class CraftingTreeNode
|
||||
this.nodes.add( new CraftingTreeProcess( cc, job, details, times, this ) );
|
||||
continue;
|
||||
}
|
||||
if( details == parent.details )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CraftingTreeNode recursive = recursiveNode( this );
|
||||
if( recursive == null )
|
||||
{
|
||||
@@ -123,7 +126,7 @@ public class CraftingTreeNode
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.reserverForNode();
|
||||
parent.reserveForNode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +154,7 @@ public class CraftingTreeNode
|
||||
|
||||
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
||||
{
|
||||
Collection<IAEItemStack> itemList = new ArrayList<>();
|
||||
Collection<IAEItemStack> itemList = new HashSet<>();
|
||||
|
||||
if( this.what.getItem().isDamageable() || Platform.isGTDamageableItem( this.what.getItem() ) )
|
||||
{
|
||||
@@ -183,7 +186,7 @@ public class CraftingTreeNode
|
||||
{
|
||||
for( IAEItemStack ss : inventoryList.findFuzzy( s, FuzzyMode.IGNORE_ALL ) )
|
||||
{
|
||||
if( ss != null && !itemList.contains( ss ) )
|
||||
if( ss != null )
|
||||
{
|
||||
itemList.add( ss );
|
||||
}
|
||||
@@ -195,7 +198,7 @@ public class CraftingTreeNode
|
||||
|
||||
for( IAEItemStack fuzz : itemList )
|
||||
{
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.copy().getCachedItemStack( 1 ), this.world ) )
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.getDefinition(), this.world ) )
|
||||
{
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( l );
|
||||
@@ -294,6 +297,7 @@ public class CraftingTreeNode
|
||||
while ( pro.possible && l > 0 )
|
||||
{
|
||||
final IAEItemStack madeWhat = pro.getAmountCrafted( this.what );
|
||||
|
||||
pro.request( inv, pro.getTimes( l, madeWhat.getStackSize() ), src );
|
||||
|
||||
madeWhat.setStackSize( l );
|
||||
|
||||
@@ -87,7 +87,7 @@ public class CraftingTreeProcess
|
||||
{
|
||||
if( subs.fuzzyComparison( part, FuzzyMode.IGNORE_ALL ) )
|
||||
{
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, subs.copy().setStackSize( wantedSize ), this, x ), wantedSize );
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, subs.copy(), wantedSize, this, x ), part.getStackSize() / times );
|
||||
wantedSize = 0;
|
||||
break;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
if( prioritizedIAE != null )
|
||||
{
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, prioritizedIAE.copy().setStackSize( wantedSize ), this, x ), wantedSize );
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, prioritizedIAE.copy(), wantedSize, this, x ), part.getStackSize() / times );
|
||||
wantedSize = 0;
|
||||
break;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class CraftingTreeProcess
|
||||
{
|
||||
part = part.copy().setStackSize( wantedSize );
|
||||
// use the first slot...
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, part, this, x ), wantedSize );
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, part.copy(), wantedSize, this, x ), part.getStackSize() / times );
|
||||
wantedSize = 0;
|
||||
}
|
||||
if( !isPartContainer && wantedSize == 0 )
|
||||
@@ -168,14 +168,14 @@ public class CraftingTreeProcess
|
||||
// request and remove inputs...
|
||||
for( final Entry<CraftingTreeNode, Long> entry : this.nodes.object2LongEntrySet() )
|
||||
{
|
||||
final IAEItemStack stack = entry.getKey().request( inv, hasContainerItem ? 1 : entry.getValue(), src );
|
||||
final IAEItemStack stack = entry.getKey().request( inv, details.isCraftable() && hasContainerItem ? 1 : entry.getValue() * amountOfTimes, src );
|
||||
|
||||
if( stack.equals( job.getOutput() ) )
|
||||
{
|
||||
job.getNeededForLoop().add( stack.copy() );
|
||||
}
|
||||
|
||||
if( stack.getItem().hasContainerItem( stack.getDefinition() ) )
|
||||
if( details.isCraftable() && stack.getItem().hasContainerItem( stack.getDefinition() ) )
|
||||
{
|
||||
final ItemStack is = Platform.getContainerItem( stack.createItemStack() );
|
||||
final IAEItemStack o = AEItemStack.fromItemStack( is );
|
||||
@@ -189,16 +189,16 @@ public class CraftingTreeProcess
|
||||
o.setCachedItemStack( is );
|
||||
containerItems.add( o );
|
||||
}
|
||||
if( containerItems != null )
|
||||
{
|
||||
for( IAEItemStack i : containerItems )
|
||||
{
|
||||
inv.injectItems( i, Actionable.MODULATE, src );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( containerItems != null )
|
||||
{
|
||||
for( IAEItemStack i : containerItems )
|
||||
{
|
||||
inv.injectItems( i, Actionable.MODULATE, src );
|
||||
}
|
||||
}
|
||||
|
||||
// assume its possible.
|
||||
|
||||
@@ -285,7 +285,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
}
|
||||
|
||||
public void reserverForNode()
|
||||
public void reserveForNode()
|
||||
{
|
||||
parent.reserveForNode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user