[1.12] [Recipies] How to add quantity of IC2 Items to output?

  • ItemStack example

    Code
    public static final ItemStack stonedust =  IC2Items.getItem("dust", "stone");

    custom recipe method

    Code
    private static void addAdvCentrifugeRecipe(IRecipeInput input, ItemStack output, ItemStack output2, ItemStack output3, NBTTagCompound nbt) 
         {
             ic2.api.recipe.Recipes.centrifuge.addRecipe(input,(NBTTagCompound)nbt, false, new ItemStack[] {output,output2,output3});
        
         }

    invoke method

    Code
    addAdvCentrifugeRecipe(input.forOreDict("gravel"), new ItemStack(sand,3), flint.splitStack(2), stonedust.splitStack(2), nbt);

    splitStack not works with IC2 Items. Any ideas? Help please!


    Any ideas?

    • Official Post

    You're getting a stack size of 1 from IC2Items#getItem, so splitStack will only ever return a stack size of 1. You're probably better copying the stack then doing setCount on it to get the size you want.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

    • Official Post

    I presume that worked fine then?

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

    • Official Post

    Something like this should work

    Java
    IRecipeInput input = Recipes.inputFactory.forOreDict("gravel");
    ItemStack outputA = new ItemStack(Blocks.SAND, 3);
    ItemStack outputB = new ItemStack(Items.FLINT, 5);
    ItemStack outputC = IC2Items.getItem("dust", "stone");
    outputC.setCount(3); //3 Stone dust output
    Recipes.centrifuge.addRecipe(input, Arrays.asList(outputA, outputB, outputC), null, false);

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

    • Official Post

    Great to see you got it all working

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.