diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2016-04-11 19:44:54 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2016-04-11 19:44:54 +0300 |
| commit | 05c78126859231a68e199dc34613689bd0978e2f (patch) | |
| tree | 050bea104a18c72905095d29f31bec2935a27a24 /ihl/processing/chemistry/ApparatusProcessableInvSlot.java | |
Initial commit
Diffstat (limited to 'ihl/processing/chemistry/ApparatusProcessableInvSlot.java')
| -rw-r--r-- | ihl/processing/chemistry/ApparatusProcessableInvSlot.java | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java new file mode 100644 index 0000000..f0b69b3 --- /dev/null +++ b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java @@ -0,0 +1,67 @@ +package ihl.processing.chemistry;
+
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class ApparatusProcessableInvSlot extends InvSlot {
+
+ public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1,
+ int oldStartIndex1, Access access1, int count, int stackSizeLimit1) {
+ super(base1, name1, oldStartIndex1, access1, count);
+ this.setStackSizeLimit(stackSizeLimit1);
+ }
+
+ public List<ItemStack> getItemStackList()
+ {
+ List<ItemStack> list = new ArrayList();
+ for(int i=0; i<this.size(); i++)
+ {
+ if(get(i)!=null)
+ {
+ list.add(get(i));
+ }
+ }
+ return list;
+ }
+
+ public ItemStack getItemStack(Item item) {
+ for(int i=0; i<this.size(); i++)
+ {
+ if(get(i)!=null && get(i).getItem()==item)
+ {
+ return get(i);
+ }
+ }
+ return null;
+ }
+
+ public void replaceItemStack(ItemStack stack1)
+ {
+ for(int i=0; i<this.size(); i++)
+ {
+ if(this.get(i)!=null && this.get(i).getItem()==stack1.getItem())
+ {
+ this.put(i,stack1);
+ }
+ }
+ }
+
+ public void consume(int i, int stackSize1)
+ {
+ if(this.get(i)==null)return;
+ if(this.get(i).stackSize==stackSize1)
+ {
+ this.put(i, null);
+ }
+ else
+ {
+ this.get(i).stackSize-=stackSize1;
+ }
+ }
+
+}
|
