use of minechem.potion.PotionChemical in project Minechem by iopleke.
the class DecomposerNEIRecipeHandler method loadCraftingRecipes.
@Override
public void loadCraftingRecipes(ItemStack result) {
// can yield it.
if (!Compare.isStackAChemical(result)) {
return;
}
// Add all decomposer recipes that can yield the result.
PotionChemical resultChemical = MinechemUtil.itemStackToChemical(result);
if (resultChemical == null) {
return;
}
for (DecomposerRecipe dr : DecomposerRecipe.recipes.values()) {
if (dr.outputContains(resultChemical)) {
registerDecomposerRecipe(dr);
}
}
arecipes = sortList(arecipes);
}
use of minechem.potion.PotionChemical in project Minechem by iopleke.
the class Chemicals method removeMoleculeEffects.
@ZenMethod
public static void removeMoleculeEffects(IIngredient ingredient) {
PotionChemical chemical = InputHelper.getChemical(ingredient);
if (!(chemical instanceof Molecule)) {
throw new IllegalArgumentException("Ingredient is not a molecule");
}
MineTweakerAPI.apply(new RemoveEffectsAction(((Molecule) chemical).molecule));
}
use of minechem.potion.PotionChemical in project Minechem by iopleke.
the class Chemicals method addMolecule.
@ZenMethod
public static void addMolecule(String name, int id, String roomState, IIngredient[] chemicals) {
ChemicalRoomStateEnum state = InputHelper.getRoomState(roomState);
if (MoleculeEnum.getByName(name) != null || MoleculeEnum.getById(id) != null) {
throw new IllegalArgumentException(name + " is already registered as a molecule");
}
ArrayList<PotionChemical> chem = InputHelper.getChemicals(chemicals);
PotionChemical[] chemical = chem.toArray(new PotionChemical[chem.size()]);
MineTweakerAPI.apply(new AddMoleculeAction(name, id, state, chemical));
}
use of minechem.potion.PotionChemical in project Minechem by iopleke.
the class Chemicals method addEffect.
private static void addEffect(IIngredient ingredient, PharmacologyEffect effect) {
PotionChemical chemical = InputHelper.getChemical(ingredient);
if (!(chemical instanceof Molecule)) {
throw new IllegalArgumentException("Ingredient is not a molecule");
}
MineTweakerAPI.apply(new AddMoleculeEffectAction(((Molecule) chemical).molecule, effect));
}
use of minechem.potion.PotionChemical in project Minechem by iopleke.
the class DecomposerRecipeSuper method getOutput.
@Override
public ArrayList<PotionChemical> getOutput() {
ArrayList<PotionChemical> result = super.getOutput();
for (MapKey currentKey : this.recipes.keySet()) {
DecomposerRecipe current = DecomposerRecipe.get(currentKey);
if (current != null) {
Double i = this.recipes.get(currentKey);
LogHelper.debug("getOutput :" + currentKey + " chance: " + i);
while (i >= 1) {
ArrayList<PotionChemical> partialResult = current.getOutput();
if (partialResult != null && partialResult.size() > 0) {
result.addAll(partialResult);
}
i--;
}
if (random.nextDouble() < i) {
ArrayList<PotionChemical> partialResult = current.getOutput();
if (partialResult != null) {
result.addAll(partialResult);
}
}
}
}
return result;
}
Aggregations