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

  • ItemStack example

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

    custom recipe method

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

    invoke method

    Code
    1. 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?

  • 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.

  • 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.

  • Something like this should work

    Java
    1. IRecipeInput input = Recipes.inputFactory.forOreDict("gravel");
    2. ItemStack outputA = new ItemStack(Blocks.SAND, 3);
    3. ItemStack outputB = new ItemStack(Items.FLINT, 5);
    4. ItemStack outputC = IC2Items.getItem("dust", "stone");
    5. outputC.setCount(3); //3 Stone dust output
    6. 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.

  • 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.