ItemStacks

Discussion in 'Plugin Development' started by Infernus, Mar 16, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Infernus

    Hey! Quick question here: is there any way to get 64 of an item in a itemstack?? I have tried adding a second for loop..

    PHP:
    for(int i 0Integer.parseInt(args[2]); i++) {
                            for(
    int x 064x++) {
                                
    p.getInventory().addItem(new ItemStack(Material.getMaterial(Integer.parseInt(args[1]))));
                            }
                        }
    Would appreciate ! :)
     
  2. Offline

    Sammy

    Why don't you just setAmount(64) with the ItemStack ?

    for example: [​IMG]

    Code:
     ItemStack Stack= new ItemStack(352);
                Stack.setAmount(64);
     
  3. Offline

    Infernus

    Aha, thanks for that, will add that tomorow!
     
  4. Offline

    clash

    There are additional ItemStack constructors that take amounts as well.
    Code:
    ItemStack stack = new ItemStack(352, 64);
     
  5. Offline

    Infernus

    Thanks for that, that's even more useful. :)
     
  6. Offline

    Sammy

    A few revisions ago putting the ID and amount on the same function wouldn't work, nice to see that it works now :)
     
Thread Status:
Not open for further replies.

Share This Page