Switch to new IItemHandler (#3669)

This commit is contained in:
fscan
2018-10-04 20:39:06 +02:00
committed by yueh
parent e21c59b326
commit d88f550eb0
14 changed files with 34 additions and 158 deletions
@@ -24,8 +24,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import appeng.util.inv.IInternalItemHandler;
public class ItemHandlerUtil
{
@@ -66,37 +64,6 @@ public class ItemHandlerUtil
return true;
}
public static void markDirty( final IItemHandler inv, final int slot )
{
if( inv instanceof IInternalItemHandler )
{
( (IInternalItemHandler) inv ).markDirty( slot );
}
}
public static boolean isItemValidForSlot( final IItemHandler inv, int slot, ItemStack stack )
{
if( stack.isEmpty() )
{
return false;
}
if( inv instanceof IInternalItemHandler )
{
return ( (IInternalItemHandler) inv ).isItemValidForSlot( slot, stack );
}
// empty slot
ItemStack currentStack = inv.getStackInSlot( slot );
setStackInSlot( inv, slot, ItemStack.EMPTY );
// test insert
ItemStack remainder = inv.insertItem( slot, stack, true );
// restore slot
setStackInSlot( inv, slot, currentStack );
return remainder.isEmpty() || remainder.getCount() < stack.getCount();
}
public static void copy( final IItemHandler from, final IItemHandler to, boolean deepCopy )
{
for( int i = 0; i < Math.min( from.getSlots(), to.getSlots() ); ++i )