Re-do Blocking mode logic

This commit is contained in:
Salomão
2020-10-21 03:56:06 -03:00
parent 3b544c2486
commit 12bf337238
5 changed files with 35 additions and 2 deletions
@@ -69,6 +69,8 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
public abstract ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination );
public abstract boolean canRemoveAllExceptCircuits();
// return what was extracted.
public abstract ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination );
@@ -21,6 +21,7 @@ package appeng.util.inv;
import java.util.Iterator;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -31,6 +32,7 @@ import appeng.util.Platform;
public class AdaptorItemHandler extends InventoryAdaptor
{
final static ItemStack integratedCircuit = new ItemStack((Item.getByNameOrId("gregtech:meta_item_1")),1,32766); // Gregtech Community Edition Integrated Circuit
protected final IItemHandler itemHandler;
public AdaptorItemHandler( IItemHandler itemHandler )
@@ -264,4 +266,18 @@ public class AdaptorItemHandler extends InventoryAdaptor
{
return new ItemHandlerIterator( this.itemHandler );
}
@Override
public boolean canRemoveAllExceptCircuits()
{
int slots = this.itemHandler.getSlots();
for( int slot = 0; slot < slots; slot++ )
{
ItemStack is = this.itemHandler.getStackInSlot( slot );
if ( is.isEmpty() || is.isItemEqual(integratedCircuit)) continue;
return false;
}
return true;
}
}
@@ -225,4 +225,10 @@ public class AdaptorList extends InventoryAdaptor
{
return new StackToSlotIterator( this.i.iterator() );
}
@Override
public boolean canRemoveAllExceptCircuits() {
return false;
}
}
@@ -203,4 +203,10 @@ public class IMEAdaptor extends InventoryAdaptor
{
this.maxSlots = maxSlots;
}
@Override
public boolean canRemoveAllExceptCircuits() {
return false;
}
}