diff options
Diffstat (limited to 'ihl/processing/chemistry/ApparatusProcessableInvSlot.java')
| -rw-r--r-- | ihl/processing/chemistry/ApparatusProcessableInvSlot.java | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java index 3698160..84a931b 100644 --- a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java +++ b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java @@ -1,5 +1,6 @@ package ihl.processing.chemistry;
+import ic2.api.recipe.IRecipeInput;
import ic2.core.block.TileEntityInventory;
import ic2.core.block.invslot.InvSlot;
import java.util.ArrayList;
@@ -10,57 +11,48 @@ import net.minecraft.item.ItemStack; public class ApparatusProcessableInvSlot extends InvSlot {
- public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1,
- int oldStartIndex1, Access access1, int count, int stackSizeLimit1) {
+ 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()
- {
+
+ public List<ItemStack> getItemStackList() {
List<ItemStack> list = new ArrayList<ItemStack>();
- for(int i=0; i<this.size(); i++)
- {
- if(get(i)!=null)
- {
+ 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)
- {
+ 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 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;
+ public void consume(IRecipeInput iRecipeInput) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && iRecipeInput.matches(this.get(i))) {
+ this.get(i).stackSize -= iRecipeInput.getAmount();
+ if (this.get(i).stackSize <= 0) {
+ this.put(i, null);
+ return;
+ }
+ }
}
}
|
