Fix issue with over utilization of items as they array, only use what you ware waiting for.
Interface now wakes it self up when power arrives.
This commit is contained in:
@@ -830,6 +830,18 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
|||||||
|
|
||||||
public void notifyNeightbors()
|
public void notifyNeightbors()
|
||||||
{
|
{
|
||||||
|
if ( gridProxy.isActive() )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||||
|
}
|
||||||
|
catch (GridAccessException e)
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TileEntity te = iHost.getTileEntity();
|
TileEntity te = iHost.getTileEntity();
|
||||||
if ( te != null && te.getWorldObj() != null )
|
if ( te != null && te.getWorldObj() != null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
|
|
||||||
public IAEStack injectItems(IAEStack input, Actionable type, BaseActionSource src)
|
public IAEStack injectItems(IAEStack input, Actionable type, BaseActionSource src)
|
||||||
{
|
{
|
||||||
if ( input instanceof IAEItemStack && type == Actionable.SIMULATE && false )// causes crafting to lock up?
|
if ( input instanceof IAEItemStack && type == Actionable.SIMULATE )// causes crafting to lock up?
|
||||||
{
|
{
|
||||||
IAEItemStack what = (IAEItemStack) input.copy();
|
IAEItemStack what = (IAEItemStack) input.copy();
|
||||||
IAEItemStack is = waitingFor.findPrecise( what );
|
IAEItemStack is = waitingFor.findPrecise( what );
|
||||||
@@ -281,7 +281,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
if ( finalOutput.equals( what ) )
|
if ( finalOutput.equals( what ) )
|
||||||
{
|
{
|
||||||
if ( myLastLink != null )
|
if ( myLastLink != null )
|
||||||
return ((CraftingLink) myLastLink).injectItems( (IAEItemStack) what, type );
|
return ((CraftingLink) myLastLink).injectItems( (IAEItemStack) what.copy(), type );
|
||||||
|
|
||||||
return what; // ignore it.
|
return what; // ignore it.
|
||||||
}
|
}
|
||||||
@@ -289,17 +289,23 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IAEItemStack leftOver = what.copy();
|
||||||
|
leftOver.decStackSize( is.getStackSize() );
|
||||||
|
|
||||||
|
IAEItemStack used = what.copy();
|
||||||
|
used.setStackSize( is.getStackSize() );
|
||||||
|
|
||||||
if ( finalOutput.equals( what ) )
|
if ( finalOutput.equals( what ) )
|
||||||
{
|
{
|
||||||
if ( myLastLink != null )
|
if ( myLastLink != null )
|
||||||
return ((CraftingLink) myLastLink).injectItems( (IAEItemStack) what, type );
|
{
|
||||||
|
leftOver.add( ((CraftingLink) myLastLink).injectItems( (IAEItemStack) used.copy(), type ) );
|
||||||
|
return leftOver;
|
||||||
|
}
|
||||||
|
|
||||||
return what; // ignore it.
|
return what; // ignore it.
|
||||||
}
|
}
|
||||||
|
|
||||||
IAEItemStack leftOver = what.copy();
|
|
||||||
leftOver.decStackSize( is.getStackSize() );
|
|
||||||
|
|
||||||
return leftOver;
|
return leftOver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,12 +351,18 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
|
|
||||||
is.setStackSize( 0 );
|
is.setStackSize( 0 );
|
||||||
|
|
||||||
if ( finalOutput.equals( input ) )
|
if ( finalOutput.equals( insert ) )
|
||||||
{
|
{
|
||||||
finalOutput.decStackSize( input.getStackSize() );
|
finalOutput.decStackSize( insert.getStackSize() );
|
||||||
if ( finalOutput.getStackSize() <= 0 )
|
if ( finalOutput.getStackSize() <= 0 )
|
||||||
completeJob();
|
completeJob();
|
||||||
|
|
||||||
|
if ( myLastLink != null )
|
||||||
|
{
|
||||||
|
what.add( ((CraftingLink) myLastLink).injectItems( (IAEItemStack) insert.copy(), type ) );
|
||||||
|
return what;
|
||||||
|
}
|
||||||
|
|
||||||
if ( myLastLink != null )
|
if ( myLastLink != null )
|
||||||
return ((CraftingLink) myLastLink).injectItems( (IAEItemStack) input, type );
|
return ((CraftingLink) myLastLink).injectItems( (IAEItemStack) input, type );
|
||||||
|
|
||||||
@@ -450,6 +462,9 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
|
|
||||||
public void updateCraftingLogic(IGrid grid, IEnergyGrid eg, CraftingGridCache cc)
|
public void updateCraftingLogic(IGrid grid, IEnergyGrid eg, CraftingGridCache cc)
|
||||||
{
|
{
|
||||||
|
if ( !getCore().isActive() )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( myLastLink != null )
|
if ( myLastLink != null )
|
||||||
{
|
{
|
||||||
if ( myLastLink.isCanceled() )
|
if ( myLastLink.isCanceled() )
|
||||||
@@ -475,10 +490,15 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
int remainingOperations = accelerator + 1 + 90;
|
int remainingOperations = accelerator + 1 + 90;
|
||||||
boolean didsomething = false;
|
boolean didsomething = false;
|
||||||
|
|
||||||
for (Entry<ICraftingPatternDetails, TaskProgress> e : tasks.entrySet())
|
Iterator<Entry<ICraftingPatternDetails, TaskProgress>> i = tasks.entrySet().iterator();
|
||||||
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
|
Entry<ICraftingPatternDetails, TaskProgress> e = i.next();
|
||||||
if ( e.getValue().value <= 0 )
|
if ( e.getValue().value <= 0 )
|
||||||
|
{
|
||||||
|
i.remove();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ICraftingPatternDetails details = e.getKey();
|
ICraftingPatternDetails details = e.getKey();
|
||||||
if ( canCraft( details, details.getCondencedInputs() ) )
|
if ( canCraft( details, details.getCondencedInputs() ) )
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public class PartExportBus extends PartSharedItemBus implements IGridTickable, I
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( proxy.isActive() )
|
if ( d != null && proxy.isActive() )
|
||||||
{
|
{
|
||||||
IEnergyGrid energy = proxy.getEnergy();
|
IEnergyGrid energy = proxy.getEnergy();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user