OSDN Git Service

文字化け用
[chemicraft/chemicraft.git] / common / chemicraft / ChemiCraftCraftingManager.java
1 package chemicraft;
2
3 import java.util.ArrayList;
4
5 import net.minecraft.src.IInventory;
6 import net.minecraft.src.ItemStack;
7
8 public class ChemiCraftCraftingManager {
9
10         public ItemStack[] getDecompositionResults(IInventory par1IInventory){
11                 ((InventoryDecomposition)par1IInventory).setFlag(false);
12                 ItemStack[] results = null;
13                 for(int i1 = 0;i1 < ChemiCraftAPI.instance.getDecompositionMaterial().size();i1++){
14                         ArrayList<Integer> materialID = new ArrayList<Integer>();
15                         ArrayList<Integer> materialDamage = new ArrayList<Integer>();
16                         results  = new ItemStack[ChemiCraftAPI.instance.getDecompositionResult().get(i1).length];
17
18                         materialID.add(ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).itemID);
19                         materialDamage.add(ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).getItemDamage());
20                         if(par1IInventory.getStackInSlot(16) == null){ this.clearResults(par1IInventory, 16); return new ItemStack[16];}
21                         if(materialID.get(0) != par1IInventory.getStackInSlot(16).itemID){ this.clearResults(par1IInventory, 16); return new ItemStack[16];}
22                         if(materialDamage.get(0) != par1IInventory.getStackInSlot(16).getItemDamage()){ this.clearResults(par1IInventory, 16); return new ItemStack[16];}
23
24                         for(int i = 0;i < ChemiCraftAPI.instance.getDecompositionResult().get(i1).length;i++){
25
26                                 results[i] = new ItemStack(
27                                                 ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].itemID,
28                                                 ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].stackSize,
29                                                 ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].getItemDamage()
30                                                 );
31                         }
32                 }
33                 return results;
34         }
35
36
37
38         private void clearResults(IInventory par1IInventory, int par2){
39                 ((InventoryDecomposition)par1IInventory).setFlag(false);
40                 for(int i = 0;i < par2;i++){
41                         par1IInventory.setInventorySlotContents(i, null);
42                 }
43         }
44
45 }