Revert "Skip un-extractable slots."

This reverts commit e2e6f6e83f.
This commit is contained in:
Salomão
2021-02-21 23:08:16 -03:00
parent 7a45e1faf4
commit 95d25ddf47
2 changed files with 3 additions and 28 deletions
@@ -26,9 +26,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
@@ -270,12 +268,10 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
{
private IAEItemStack[] cachedAeStacks = new IAEItemStack[0];
private final IItemHandler itemHandler;
private ArrayList<Integer> skipSlots;
public InventoryCache( IItemHandler itemHandler )
{
this.itemHandler = itemHandler;
this.skipSlots = new ArrayList<>(this.itemHandler.getSlots());
}
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
@@ -293,22 +289,14 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
if( slots > this.cachedAeStacks.length )
{
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
this.skipSlots = new ArrayList<>(this.itemHandler.getSlots());
}
for( int slot = 0; slot < slots; slot++ )
{
if (skipSlots.contains( slot ))
continue;
// Save the old stuff
final IAEItemStack oldAeIS = this.cachedAeStacks[slot];
ItemStack newIS = this.itemHandler.getStackInSlot( slot );
if (!newIS.isEmpty()) {
if (this.itemHandler.extractItem( slot,1,true ).isEmpty()){
newIS = ItemStack.EMPTY;
skipSlots.add( slot );
}
}
final ItemStack newIS = this.itemHandler.getStackInSlot( slot );
this.handlePossibleSlotChanges( slot, oldAeIS, newIS, changes );
}