Search in sources :

Example 6 with Element

use of minechem.item.element.Element in project Minechem by iopleke.

the class ChemicalTurtlePeripheral method synthesisRecipeToMap.

private HashMap<String, Object> synthesisRecipeToMap(SynthesisRecipe recipe) {
    HashMap<String, Object> result = new HashMap<String, Object>();
    result.put("output", stackToMap(recipe.getOutput()));
    result.put("shaped", recipe.isShaped());
    result.put("energyCost", recipe.energyCost());
    HashMap<Number, Object> inputs = new HashMap<Number, Object>();
    PotionChemical[] recipeInputs = recipe.isShaped() ? recipe.getShapedRecipe() : recipe.getShapelessRecipe();
    int i = 1;
    for (PotionChemical chemical : recipeInputs) {
        if (chemical != null) {
            HashMap<String, Object> input = new HashMap<String, Object>();
            if (chemical instanceof Element) {
                input.put("element", ((Element) chemical).element.getLongName());
                input.put("quantity", chemical.amount);
            } else if (chemical instanceof Molecule) {
                input.put("element", ((Molecule) chemical).molecule.name());
                input.put("quantity", chemical.amount);
            }
            inputs.put(i++, input);
        }
    }
    result.put("ingredients", inputs);
    return result;
}
Also used : Molecule(minechem.item.molecule.Molecule) HashMap(java.util.HashMap) Element(minechem.item.element.Element) PotionChemical(minechem.potion.PotionChemical)

Example 7 with Element

use of minechem.item.element.Element in project Minechem by iopleke.

the class MinechemBucketHandler method registerBucketDecomposerRecipe.

private void registerBucketDecomposerRecipe(ItemStack itemStack, MinechemChemicalType type) {
    ArrayList<PotionChemical> tubes = new ArrayList<PotionChemical>();
    tubes.add(new Element(ElementEnum.Fe, 48));
    if (type instanceof ElementEnum) {
        tubes.add(new Element((ElementEnum) type, 8));
    } else if (type instanceof MoleculeEnum) {
        tubes.add(new Molecule((MoleculeEnum) type, 8));
    }
    DecomposerRecipe.add(new DecomposerRecipe(itemStack, tubes));
}
Also used : ElementEnum(minechem.item.element.ElementEnum) Molecule(minechem.item.molecule.Molecule) Element(minechem.item.element.Element) ArrayList(java.util.ArrayList) PotionChemical(minechem.potion.PotionChemical) MoleculeEnum(minechem.item.molecule.MoleculeEnum) DecomposerRecipe(minechem.tileentity.decomposer.DecomposerRecipe)

Aggregations

Element (minechem.item.element.Element)7 PotionChemical (minechem.potion.PotionChemical)7 Molecule (minechem.item.molecule.Molecule)6 DecomposerRecipe (minechem.tileentity.decomposer.DecomposerRecipe)4 MoleculeEnum (minechem.item.molecule.MoleculeEnum)3 ItemStack (net.minecraft.item.ItemStack)3 ElementEnum (minechem.item.element.ElementEnum)2 ElementItem (minechem.item.element.ElementItem)2 DecomposerRecipeChance (minechem.tileentity.decomposer.DecomposerRecipeChance)2 DecomposerRecipeSelect (minechem.tileentity.decomposer.DecomposerRecipeSelect)2 SynthesisRecipe (minechem.tileentity.synthesis.SynthesisRecipe)2 Item (net.minecraft.item.Item)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ItemBlueprint (minechem.item.blueprint.ItemBlueprint)1 MinechemBlueprint (minechem.item.blueprint.MinechemBlueprint)1 MinechemBucketItem (minechem.item.bucket.MinechemBucketItem)1 MoleculeItem (minechem.item.molecule.MoleculeItem)1 DecomposerFluidRecipe (minechem.tileentity.decomposer.DecomposerFluidRecipe)1 DecomposerFluidRecipeSelect (minechem.tileentity.decomposer.DecomposerFluidRecipeSelect)1