Water Bottle ItemStack

Discussion in 'Plugin Development' started by xGeorgeee, Jan 24, 2019.

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

    xGeorgeee

    Hello guys, i have a problem with itemstack, i wanna an itemstack with water bottle but nothing works correctly. I have tried:
    ItemStack bottle = new ItemStack(Material.POTION, 1, (byte)0);
    ItemStack bottle = new ItemStack(Material.POTION, 1);

    Thanks for help :)
     
  2. Offline

    KarimAKL

    What do you mean? What happens?
     
  3. Offline

    xGeorgeee

    It means that when i right click on water with glass bottle, a Uncraftable Potion appears in my inventory, but i want water bottle
     
  4. Offline

    KarimAKL

  5. Offline

    xGeorgeee

    @KarimAKL Simple code:
    if(p.getInventory().getItemInMainHand().getType().equals(Material.GLASS_BOTTLE)) {
    ItemStack bottle = new ItemStack(373, 1);
    p.getInventory().addItem(bottle);
    p.sendMessage("§aNapełniono butelkę wodą...");
    }
     
  6. Offline

    KarimAKL

    @xGeorgeee
    1. You can use [ Code]Code here[ /Code] or [ Syntax=Java]Code here[ /Syntax] (without the spaces at the start)
    2. You said you had tried the code from the OP aswell for the second line of that code, right? If so i don't get why it wouldn't work, sorry but i can't help you here.
     
  7. Offline

    xGeorgeee

    @KarimAKL
    1. oh thanks, im new on forum
    2. Yes i have tried
    Code:
    ItemStack bottle = new ItemStack(Material.POTION, 1, (byte)0);
    ItemStack bottle = new ItemStack(Material.POTION, 1);
    And i try to make something else but nothing works :(
     
Thread Status:
Not open for further replies.

Share This Page