Fixes #2530: Use ItemListIgnoreCrafting to ignore craftable items.

Wraps the internal inventory into an ItemListIgnoreCrafting to hide
craftable items from it. As the ItemLists will always create a copy of the
actual stack before changing them, it will not affect any itemstack stored
elsewhere.
This commit is contained in:
yueh 2016-10-29 17:52:34 +02:00
parent 3c7d91b73e
commit a9c5019554
1 changed files with 4 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import appeng.api.storage.IMEMonitor;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.util.inv.ItemListIgnoreCrafting;
public class MECraftingInventory implements IMEInventory<IAEItemStack>
@ -48,7 +49,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
public MECraftingInventory()
{
this.localCache = AEApi.instance().storage().createItemList();
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
this.extractedCache = null;
this.injectedCache = null;
this.missingCache = null;
@ -93,7 +94,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
this.injectedCache = null;
}
this.localCache = this.target.getAvailableItems( AEApi.instance().storage().createItemList() );
this.localCache = this.target.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() ) );
this.par = parent;
}
@ -132,7 +133,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
this.injectedCache = null;
}
this.localCache = AEApi.instance().storage().createItemList();
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
for( final IAEItemStack is : target.getStorageList() )
{
this.localCache.add( target.extractItems( is, Actionable.SIMULATE, src ) );