Fixed Bug: #0562 - Inventory desync while dismantle storage cells

Fixed a bug where disassembling storage cells might put items in the players armor slots.
This commit is contained in:
AlgorithmX2 2014-06-25 21:57:49 -05:00
parent 9b65cc210d
commit c7692d1be6

View file

@ -190,20 +190,23 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( stack, StorageChannel.ITEMS );
if ( inv != null && pinv.getCurrentItem() == stack )
{
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( pinv, ForgeDirection.UNKNOWN );
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() );
if ( list.isEmpty() && ia != null )
{
pinv.setInventorySlotContents( pinv.currentItem, null );
ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) );
ItemStack extraB = ia.addItems( component.stack( 1 ) );
ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) );
if ( extraA != null )
player.dropPlayerItemWithRandomChoice( extraA, false );
if ( extraB != null )
player.dropPlayerItemWithRandomChoice( extraB, false );
if ( player.inventoryContainer != null )
player.inventoryContainer.detectAndSendChanges();
return true;
}
}