diff --git a/container/implementations/ContainerCraftingCPU.java b/container/implementations/ContainerCraftingCPU.java index a0697a329..70424ae17 100644 --- a/container/implementations/ContainerCraftingCPU.java +++ b/container/implementations/ContainerCraftingCPU.java @@ -102,7 +102,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH @Override public void detectAndSendChanges() { - if ( Platform.isServer() ) + if ( Platform.isServer() && !list.isEmpty() ) { try { @@ -117,13 +117,20 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH c.appendItem( monitor.getItemStack( out, CraftingItemList.PENDING ) ); } + list.resetStatus(); + for (Object g : this.crafters) { if ( g instanceof EntityPlayer ) { - NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g ); - NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g ); - NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g ); + if ( !a.isEmpty() ) + NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g ); + + if ( !b.isEmpty() ) + NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g ); + + if ( !c.isEmpty() ) + NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g ); } } } diff --git a/me/cluster/implementations/CraftingCPUCluster.java b/me/cluster/implementations/CraftingCPUCluster.java index ae4d7836b..d4be11f62 100644 --- a/me/cluster/implementations/CraftingCPUCluster.java +++ b/me/cluster/implementations/CraftingCPUCluster.java @@ -98,6 +98,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU protected void postChange(IAEItemStack diff, BaseActionSource src) { Iterator, Object>> i = getListeners(); + + // protect integrity + if ( i.hasNext() ) + diff = diff.copy(); + while (i.hasNext()) { Entry, Object> o = i.next(); @@ -272,6 +277,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU if ( is != null && is.getStackSize() > 0 ) { waiting = false; + postChange( (IAEItemStack) input, src ); if ( is.getStackSize() >= input.getStackSize() ) { @@ -400,6 +406,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU if ( myLastLink != null ) myLastLink.cancel(); + IItemList list; + getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL ); + for (IAEItemStack g : list) + postChange( g, machineSrc ); + isComplete = true; myLastLink = null; tasks.clear(); @@ -486,6 +497,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU if ( is != null && details.isValidItemForSlot( x, is, getWorld() ) ) { + postChange( input[x], machineSrc ); ic.setInventorySlotContents( x, is ); found = true; break; @@ -499,6 +511,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU if ( is != null ) { + postChange( input[x], machineSrc ); ic.setInventorySlotContents( x, is ); found = true; continue; @@ -531,7 +544,10 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU remainingOperations--; for (IAEItemStack out : details.getCondencedOutputs()) + { + postChange( out, machineSrc ); waitingFor.add( out.copy() ); + } if ( details.isCraftable() ) { @@ -542,7 +558,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU { ItemStack output = Platform.getContainerItem( ic.getStackInSlot( x ) ); if ( output != null ) - waitingFor.add( AEItemStack.create( output ) ); + { + IAEItemStack cItem = AEItemStack.create( output ); + postChange( cItem, machineSrc ); + waitingFor.add( AEItemStack.create( cItem ) ); + } } } @@ -592,7 +612,10 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU is = inventory.extractItems( is.copy(), Actionable.MODULATE, machineSrc ); if ( is != null ) + { + postChange( is, machineSrc ); is = ii.injectItems( is, Actionable.MODULATE, machineSrc ); + } if ( is != null ) inventory.injectItems( is, Actionable.MODULATE, machineSrc ); @@ -643,6 +666,11 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU submitLink( myLastLink ); submitLink( whatLink ); + IItemList list; + getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL ); + for (IAEItemStack ge : list) + postChange( ge, machineSrc ); + return whatLink; } catch (CraftBranchFailure e)