Search in sources :

Example 1 with IngredientStack

use of crafttweaker.api.item.IngredientStack in project ImmersiveEngineering by BluSunrize.

the class CraftTweakerHelper method toIEIngredientStack.

public static blusunrize.immersiveengineering.api.crafting.IngredientStack toIEIngredientStack(IIngredient iStack) {
    if (iStack == null)
        return null;
    else {
        if (iStack instanceof IOreDictEntry)
            return new blusunrize.immersiveengineering.api.crafting.IngredientStack(((IOreDictEntry) iStack).getName());
        else if (iStack instanceof IItemStack)
            return new blusunrize.immersiveengineering.api.crafting.IngredientStack(toStack((IItemStack) iStack));
        else if (iStack instanceof IngredientStack) {
            IIngredient ingr = ReflectionHelper.getPrivateValue(IngredientStack.class, (IngredientStack) iStack, "ingredient");
            blusunrize.immersiveengineering.api.crafting.IngredientStack ingrStack = toIEIngredientStack(ingr);
            ingrStack.inputSize = iStack.getAmount();
            return ingrStack;
        } else
            return null;
    }
}
Also used : IIngredient(crafttweaker.api.item.IIngredient) IItemStack(crafttweaker.api.item.IItemStack) IOreDictEntry(crafttweaker.api.oredict.IOreDictEntry) IngredientStack(crafttweaker.api.item.IngredientStack)

Example 2 with IngredientStack

use of crafttweaker.api.item.IngredientStack in project ImmersiveEngineering by BluSunrize.

the class CraftTweakerHelper method toObject.

public static Object toObject(IIngredient iStack) {
    if (iStack == null)
        return null;
    else {
        if (iStack instanceof IOreDictEntry)
            return ((IOreDictEntry) iStack).getName();
        else if (iStack instanceof IItemStack)
            return toStack((IItemStack) iStack);
        else if (iStack instanceof IngredientStack) {
            IIngredient ingr = ReflectionHelper.getPrivateValue(IngredientStack.class, (IngredientStack) iStack, "ingredient");
            Object o = toObject(ingr);
            if (o instanceof String)
                return new blusunrize.immersiveengineering.api.crafting.IngredientStack((String) o, iStack.getAmount());
            else
                return o;
        } else
            return null;
    }
}
Also used : IIngredient(crafttweaker.api.item.IIngredient) IItemStack(crafttweaker.api.item.IItemStack) IOreDictEntry(crafttweaker.api.oredict.IOreDictEntry) IngredientStack(crafttweaker.api.item.IngredientStack)

Aggregations

IIngredient (crafttweaker.api.item.IIngredient)2 IItemStack (crafttweaker.api.item.IItemStack)2 IngredientStack (crafttweaker.api.item.IngredientStack)2 IOreDictEntry (crafttweaker.api.oredict.IOreDictEntry)2