Search in sources :

Example 1 with MapKey

use of minechem.utils.MapKey in project Minechem by iopleke.

the class ChemicalTurtlePeripheral method keyListToStacks.

private ArrayList<ItemStack> keyListToStacks(List<MapKey> keys) {
    ArrayList<ItemStack> result = new ArrayList<ItemStack>();
    for (MapKey key : keys) {
        if (key != null) {
            ItemStack add = null;
            DecomposerRecipe decomp = DecomposerRecipe.get(key);
            if (decomp != null) {
                add = decomp.getInput();
            } else {
                SynthesisRecipe synth = SynthesisRecipe.get(key);
                if (synth != null) {
                    add = synth.getOutput();
                }
            }
            if (add != null) {
                result.add(add);
            }
        }
    }
    return result;
}
Also used : MapKey(minechem.utils.MapKey) SynthesisRecipe(minechem.tileentity.synthesis.SynthesisRecipe) ArrayList(java.util.ArrayList) DecomposerRecipe(minechem.tileentity.decomposer.DecomposerRecipe) ItemStack(net.minecraft.item.ItemStack)

Example 2 with MapKey

use of minechem.utils.MapKey in project Minechem by iopleke.

the class ChemicalTurtlePeripheral method addStackToKnown.

protected boolean addStackToKnown(ItemStack add) {
    MapKey addString = MapKey.getKey(add);
    for (MapKey key : known) {
        if (key.equals(addString)) {
            return false;
        }
    }
    known.add(addString);
    return true;
}
Also used : MapKey(minechem.utils.MapKey)

Example 3 with MapKey

use of minechem.utils.MapKey in project Minechem by iopleke.

the class DecomposerRecipe method addChemicals.

public void addChemicals(PotionChemical... chemicals) {
    for (PotionChemical potionChemical : chemicals) {
        PotionChemical current = this.output.get(new MapKey(potionChemical));
        if (current != null) {
            current.amount += potionChemical.amount;
            continue;
        }
        this.output.put(new MapKey(potionChemical), potionChemical.copy());
    }
}
Also used : MapKey(minechem.utils.MapKey) PotionChemical(minechem.potion.PotionChemical)

Example 4 with MapKey

use of minechem.utils.MapKey in project Minechem by iopleke.

the class DecomposerRecipeHandler method resetRecursiveRecipes.

public static void resetRecursiveRecipes() {
    for (MapKey key : DecomposerRecipe.recipes.keySet()) {
        if (DecomposerRecipe.get(key) instanceof DecomposerRecipeSuper) {
            DecomposerRecipe.remove(key);
        }
    }
    Recipe.init();
    recursiveRecipes();
}
Also used : MapKey(minechem.utils.MapKey)

Example 5 with MapKey

use of minechem.utils.MapKey in project Minechem by iopleke.

the class DecomposerRecipeSuper method outputContains.

@Override
public boolean outputContains(PotionChemical potionChemical) {
    boolean contains;
    contains = super.outputContains(potionChemical);
    if (!contains) {
        for (MapKey key : recipes.keySet()) {
            DecomposerRecipe dr = DecomposerRecipe.get(key);
            LogHelper.debug("outputContains: " + key);
            if (dr == null) {
                continue;
            }
            contains = dr.outputContains(potionChemical);
            if (contains) {
                break;
            }
        }
    }
    return contains;
}
Also used : MapKey(minechem.utils.MapKey)

Aggregations

MapKey (minechem.utils.MapKey)9 PotionChemical (minechem.potion.PotionChemical)4 ArrayList (java.util.ArrayList)2 DecomposerRecipe (minechem.tileentity.decomposer.DecomposerRecipe)2 SynthesisRecipe (minechem.tileentity.synthesis.SynthesisRecipe)2 ItemStack (net.minecraft.item.ItemStack)2 ILuaContext (dan200.computercraft.api.lua.ILuaContext)1 LuaException (dan200.computercraft.api.lua.LuaException)1 IComputerAccess (dan200.computercraft.api.peripheral.IComputerAccess)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 LuaMethod (minechem.computercraft.lua.LuaMethod)1 MoleculeEnum (minechem.item.molecule.MoleculeEnum)1 DecomposerTileEntity (minechem.tileentity.decomposer.DecomposerTileEntity)1 MicroscopeTileEntity (minechem.tileentity.microscope.MicroscopeTileEntity)1 SynthesisTileEntity (minechem.tileentity.synthesis.SynthesisTileEntity)1 Recipe (minechem.utils.Recipe)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1