make ItemSlots copy-able
This commit is contained in:
@@ -55,6 +55,8 @@ class ItemHandlerIterator implements Iterator<ItemSlot>
|
|||||||
this.itemSlot.setExtractable( !this.itemHandler.extractItem( this.slot, 1, true ).isEmpty() );
|
this.itemSlot.setExtractable( !this.itemHandler.extractItem( this.slot, 1, true ).isEmpty() );
|
||||||
this.itemSlot.setItemStack( this.itemHandler.getStackInSlot( this.slot ) );
|
this.itemSlot.setItemStack( this.itemHandler.getStackInSlot( this.slot ) );
|
||||||
this.itemSlot.setSlot( this.slot );
|
this.itemSlot.setSlot( this.slot );
|
||||||
|
this.itemSlot.setSlotLimit( this.itemHandler.getSlotLimit( this.slot ) );
|
||||||
|
this.itemSlot.setItemHandler( this.itemHandler );
|
||||||
this.slot++;
|
this.slot++;
|
||||||
return this.itemSlot;
|
return this.itemSlot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
|
||||||
public class ItemSlot
|
public class ItemSlot
|
||||||
@@ -34,6 +35,25 @@ public class ItemSlot
|
|||||||
private IAEItemStack aeItemStack;
|
private IAEItemStack aeItemStack;
|
||||||
private ItemStack itemStack;
|
private ItemStack itemStack;
|
||||||
|
|
||||||
|
public void setItemHandler( IItemHandler itemHandler )
|
||||||
|
{
|
||||||
|
this.itemHandler = itemHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IItemHandler itemHandler;
|
||||||
|
|
||||||
|
public int getSlotLimit()
|
||||||
|
{
|
||||||
|
return slotLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSlotLimit( int slotLimit )
|
||||||
|
{
|
||||||
|
this.slotLimit = slotLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int slotLimit;
|
||||||
|
|
||||||
public ItemStack getItemStack()
|
public ItemStack getItemStack()
|
||||||
{
|
{
|
||||||
return this.itemStack
|
return this.itemStack
|
||||||
@@ -77,4 +97,19 @@ public class ItemSlot
|
|||||||
{
|
{
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemSlot copy()
|
||||||
|
{
|
||||||
|
ItemSlot copy = new ItemSlot();
|
||||||
|
copy.setSlot( this.slot );
|
||||||
|
copy.setSlotLimit( this.slotLimit );
|
||||||
|
copy.setItemStack( this.getItemStack() );
|
||||||
|
copy.setExtractable( this.isExtractable );
|
||||||
|
copy.setItemHandler( this.itemHandler );
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack insertItem( ItemStack sourceItemStack){
|
||||||
|
return this.itemHandler.insertItem( this.slot, sourceItemStack , true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user