fix blocking mode somehow voiding items
This commit is contained in:
@@ -561,6 +561,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||||
}
|
}
|
||||||
catch( final GridAccessException e )
|
catch( final GridAccessException e )
|
||||||
@@ -808,17 +809,18 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||||
|
|
||||||
final Iterator<ItemStack> i = this.waitingToSendFacing.get( s ).iterator();
|
final Iterator<ItemStack> i = this.waitingToSendFacing.get( s ).iterator();
|
||||||
while ( i.hasNext() )
|
while ( i.hasNext() )
|
||||||
{
|
{
|
||||||
ItemStack whatToSend = i.next();
|
ItemStack whatToSend = i.next();
|
||||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
|
||||||
if( ad != null )
|
if( ad != null )
|
||||||
{
|
{
|
||||||
final ItemStack result = ad.addItems( whatToSend );
|
final ItemStack result = ad.addItems( whatToSend );
|
||||||
if( !result.isEmpty() )
|
if( !result.isEmpty() )
|
||||||
{
|
{
|
||||||
whatToSend.setCount( whatToSend.getCount() - ( whatToSend.getCount() - result.getCount() ) );
|
whatToSend.setCount( result.getCount() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+14
-8
@@ -115,7 +115,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
|||||||
private IEnergyGrid energyGrid;
|
private IEnergyGrid energyGrid;
|
||||||
int i;
|
int i;
|
||||||
private boolean updateList = false;
|
private boolean updateList = false;
|
||||||
private boolean updatePatterns = true;
|
private boolean updatePatterns = false;
|
||||||
|
|
||||||
public CraftingGridCache( final IGrid grid )
|
public CraftingGridCache( final IGrid grid )
|
||||||
{
|
{
|
||||||
@@ -415,14 +415,20 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
|||||||
if( !updatePatterns )
|
if( !updatePatterns )
|
||||||
{
|
{
|
||||||
List<IAEItemStack> newCraftables = new ArrayList<>();
|
List<IAEItemStack> newCraftables = new ArrayList<>();
|
||||||
for( IAEItemStack stack : api.getOutputs() )
|
|
||||||
|
ObjectSet<ICraftingPatternDetails> b = new ObjectRBTreeSet<>( COMPARATOR );
|
||||||
|
ImmutableList<ICraftingPatternDetails> a = this.craftableItems.get( api.getCondensedOutputs()[0] );
|
||||||
|
if( a != null )
|
||||||
{
|
{
|
||||||
ImmutableList<ICraftingPatternDetails> a = this.craftableItems.get( stack );
|
b.addAll( this.craftableItems.get( api.getOutputs()[0] ) );
|
||||||
if( a == null || a.get( 0 ).getPriority() < api.getPriority() )
|
}
|
||||||
{
|
b.add( api );
|
||||||
this.craftableItems.put( stack, ImmutableList.of( api ) );
|
|
||||||
newCraftables.add( stack.copy().reset().setCraftable( true ) );
|
for( IAEItemStack stack : api.getCondensedOutputs() )
|
||||||
}
|
{
|
||||||
|
IAEItemStack i = stack.copy().reset().setCraftable( true );
|
||||||
|
this.craftableItems.put( i, ImmutableList.copyOf( b ) );
|
||||||
|
newCraftables.add( i );
|
||||||
}
|
}
|
||||||
this.storageGrid.postCraftablesChanges( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), newCraftables, new BaseActionSource() );
|
this.storageGrid.postCraftablesChanges( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), newCraftables, new BaseActionSource() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,6 +232,10 @@ public class AdaptorItemHandler extends InventoryAdaptor
|
|||||||
|
|
||||||
for( int slot = 0; slot < this.itemHandler.getSlots(); slot++ )
|
for( int slot = 0; slot < this.itemHandler.getSlots(); slot++ )
|
||||||
{
|
{
|
||||||
|
if( !simulate )
|
||||||
|
{
|
||||||
|
itemsToAdd = itemsToAdd.copy();
|
||||||
|
}
|
||||||
itemsToAdd = this.itemHandler.insertItem( slot, itemsToAdd, simulate );
|
itemsToAdd = this.itemHandler.insertItem( slot, itemsToAdd, simulate );
|
||||||
|
|
||||||
if( itemsToAdd.isEmpty() )
|
if( itemsToAdd.isEmpty() )
|
||||||
|
|||||||
@@ -163,23 +163,26 @@ public class AdaptorItemRepository extends InventoryAdaptor
|
|||||||
return this.addItems( toBeAdded, false );
|
return this.addItems( toBeAdded, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemStack addItems( final ItemStack itemsToAdd, final boolean simulate )
|
protected ItemStack addItems( ItemStack itemsToAdd, final boolean simulate )
|
||||||
{
|
{
|
||||||
if( itemsToAdd.isEmpty() )
|
if( itemsToAdd.isEmpty() )
|
||||||
{
|
{
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack left = itemsToAdd.copy();
|
if( !simulate )
|
||||||
|
{
|
||||||
|
itemsToAdd = itemsToAdd.copy();
|
||||||
|
}
|
||||||
|
|
||||||
left = this.itemRepository.insertItem( left, simulate );
|
itemsToAdd = this.itemRepository.insertItem( itemsToAdd, simulate );
|
||||||
|
|
||||||
if( left.isEmpty() )
|
if( itemsToAdd.isEmpty() )
|
||||||
{
|
{
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return left;
|
return itemsToAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,11 +37,10 @@ public class BlockingItemHandler extends BlockingInventoryAdaptor
|
|||||||
for( int slot = 0; slot < slots; slot++ )
|
for( int slot = 0; slot < slots; slot++ )
|
||||||
{
|
{
|
||||||
ItemStack is = this.itemHandler.getStackInSlot( slot );
|
ItemStack is = this.itemHandler.getStackInSlot( slot );
|
||||||
if( is.isEmpty() || !isBlockableItem( is ) )
|
if( !is.isEmpty() && isBlockableItem( is ) )
|
||||||
{
|
{
|
||||||
continue;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user