/**
+ * 素材製作台の効果添付素材のリスト
+ */
+ private ArrayList<ItemStack[]> materialEffectMaterials = new ArrayList<ItemStack[]>();
+
+
+
+ /**
+ * 素材製作台の素材のリスト
+ */
+ private ArrayList<ItemStack[]> materialMaterials = new ArrayList<ItemStack[]>();
+
+
+
+ /**
+ * 素材製作台の結果のリスト
+ */
+ private ArrayList<ItemStack> materialResult = new ArrayList<ItemStack>();
+
+
+
+ /**
+ * 素材製作台の効果のキーリスト
+ */
+ private ArrayList<String[]> materialEffectKey = new ArrayList<String[]>();
+
+
+
+ /**
+ * 素材製作台の効果のリスト
+ */
+ private ArrayList<Object[]> materialEffectValue = new ArrayList<Object[]>();
+
+
+
+ /**
* ChemiCraftの化学作業台類のレシピのマネージャー
*/
private ChemiCraftCraftingManager chemiCraftCraftingManager = new ChemiCraftCraftingManager();
System.err.println("ChemiCraft内でエラー:addChemicalCombinationRecipeの引数materialの要素数が16を超えています。" + "Material:" + material + " Result:" + result);
}
}
+
+
+
+ public void addMaterialRecipe(ItemStack[] materials, ItemStack[] effectMaterials,ItemStack result, String[] key, Object[] value){
+ if(materials.length <= 9){
+ if(effectMaterials.length <= 3){
+ materialMaterials.add(materials);
+ materialResult.add(result);
+ materialEffectKey.add(key);
+ materialEffectValue.add(value);
+ }else{
+ System.err.println("ChemiCraft内でエラー:addMaterialRecipeの引数effectMaterialsの要素数が3を超えています。" + "Material:" + materials + " Result:" + result + " key" + key + " value:" + value);
+ }
+ }else{
+ System.err.println("ChemiCraft内でエラー:addMaterialRecipeの引数materialsの要素数が9を超えています。" + "Material:" + materials + " Result:" + result + " key" + key + " value:" + value);
+ }
+ }
//以下システム関連//////////////////////////////////////////////////////
public ArrayList<ICompoundHandler> getCompoundHandler(){
public class ChemiCraftCraftingManager {
public ItemStack[] getDecompositionResults(IInventory par1IInventory){
+ //Setting to Flag.
((InventoryDecomposition)par1IInventory).setFlag(false);
+
+ //variable of results.
ItemStack[] results = null;
+
+ //Just loop of amount of added recipe.
for(int i1 = 0;i1 < ChemiCraftAPI.instance.getDecompositionMaterial().size();i1++){
+ //Recipe the match?
boolean match = true;
- ArrayList<Integer> materialID = new ArrayList<Integer>();
- ArrayList<Integer> materialDamage = new ArrayList<Integer>();
+ //Reset the results.
results = new ItemStack[ChemiCraftAPI.instance.getDecompositionResult().get(i1).length];
+ //Recipe ID & Damage.
+ //Material ID & Damage.
+ int materialID = par1IInventory.getStackInSlot(16).itemID;
+ int materialDamage = par1IInventory.getStackInSlot(16).getItemDamage();
+ int recipeID = ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).itemID;
+ int recipeDamage = ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).getItemDamage();
- materialID.add(ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).itemID);
- materialDamage.add(ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).getItemDamage());
+ //Check of null of the Material Slot.
if(par1IInventory.getStackInSlot(16) == null){ this.clearResults(par1IInventory, 16); return new ItemStack[16];}
- if(materialID.get(0) != par1IInventory.getStackInSlot(16).itemID){ match = false;}
- if(materialDamage.get(0) != par1IInventory.getStackInSlot(16).getItemDamage()){ match = false;}
+ //ID check.
+ if(materialID != recipeID){ match = false;}
+ //Damage check.
+ if(materialDamage != recipeDamage){ match = false;}
+ //if "match == true"
if(match){
+ //Just loop of recipe size of recipe index i1.
for(int i = 0;i < ChemiCraftAPI.instance.getDecompositionResult().get(i1).length;i++){
+ //Assignment to the results.
results[i] = new ItemStack(
ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].itemID,
ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].stackSize,
ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].getItemDamage()
);
}
+ //return the results.
return results;
}
}
+ //return the null.
return null;
}
public ItemStack getChemicalCombinationResult(IInventory par1IInventory){
+ //Setting to flag.
((InventoryChemicalCombination) par1IInventory).setFlag(false);
+
+ //variable of result.
ItemStack result = null;
+
+ //Just loop of amount of added recipe.
for(int i = 0;i < ChemiCraftAPI.instance.getChemicalCombinationMaterial().size();i++){
+
+ //Recipe the match?
boolean match = true;
+ //materialID & recipeID
ArrayList<Integer> materialID = new ArrayList<Integer>();
ArrayList<Integer> materialDamage = new ArrayList<Integer>();
ArrayList<Integer> recipeID = new ArrayList<Integer>();
ArrayList<Integer> recipeDamage = new ArrayList<Integer>();
+
+ //Just loop of recipe size of recipe index i.
for(int j = 0;j < ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i).length;j++){
- materialID.add(ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i)[j].itemID);
- materialDamage.add(ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i)[j].getItemDamage());
+ //Adding the recipe ID & Damage.
+ recipeID.add(ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i)[j].itemID);
+ recipeDamage.add(ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i)[j].getItemDamage());
}
+ //Just loop of 16.
for(int j = 0;j < 16;j++){
+ //Null check
if(par1IInventory.getStackInSlot(j) != null){
- recipeID.add(par1IInventory.getStackInSlot(j).itemID);
- recipeDamage.add(par1IInventory.getStackInSlot(j).getItemDamage());
+ //Adding the materialID & Damage.
+ materialID.add(par1IInventory.getStackInSlot(j).itemID);
+ materialDamage.add(par1IInventory.getStackInSlot(j).getItemDamage());
}
}
+
+ //trimToSize & sorting.
materialID.trimToSize();
materialDamage.trimToSize();
recipeID.trimToSize();
Collections.sort(materialDamage);
Collections.sort(recipeID);
Collections.sort(recipeDamage);
+
+ //Size check.
if(materialID.size() != recipeID.size()){ match = false;}
+ //Just loop of materialID.size().
for(int j = 0;j < materialID.size();j++){
- if(recipeID.size() <= j){match = false; break;}
+ //ID check.
if(materialID.get(j) != recipeID.get(j)){ match = false;}
+ //Damage check.
if(materialDamage.get(j) != recipeDamage.get(j)){ match = false;}
}
+ //if "match == true"
if(match){
+ //Assignment to the result.
result =
new ItemStack(
ChemiCraftAPI.instance.getChemicalCombinationResult().get(i).itemID,
ChemiCraftAPI.instance.getChemicalCombinationResult().get(i).stackSize,
ChemiCraftAPI.instance.getChemicalCombinationResult().get(i).getItemDamage()
);
+ //return the result.
return result;
}
}
+ //return the null.
return null;
}