Notch Apple

Discussion in 'Plugin Development' started by xELI7E_SNIPEZx, Sep 28, 2013.

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

    xELI7E_SNIPEZx

    Whats the code to add a notch apple.. GOLDEN_APPLE is a normal one..
     
  2. Offline

    sheigutn


    ItemStack (final int type, final int amount, final short damage)
    so: new ItemStack(Material.GOLDEN_APPLE.getTypeId(), <your_amount>, (short) 1);
     
  3. Offline

    xELI7E_SNIPEZx

    The method getTypeId() is undefined for the type Material
     
  4. Offline

    sheigutn

    xELI7E_SNIPEZx Oh sry, it's getId(), getTypeId() is for ItemStacks
     
  5. Offline

    billman555555

    xELI7E_SNIPEZx
    Dont use getTypeId.
    Use this:
    Code:java
    1. ItemStack NotchApple = new ItemStack(Material.GOLDEN_APPLE, <your amount>, (short)1));


    sheigutn
    As i said above, dont bother with getTypeId(), because of how 1.7 is structured Int is no longer used/depreciated.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  6. Offline

    sheigutn

    billman555555

    Quote from jd.bukkit.org ItemStack.java @Deprecated
    80
    public ItemStack(final int type, final int amount, final short damage) {

    81​
    this.type = type;

    82​
    this.amount = amount;

    83​
    this.durability = damage;

    84​
    }

    85​

    93
    public ItemStack(final Material type, final int amount, final short damage) {

    94​
    this(type.getId(), amount, damage);

    95​
    }

    So it's completely the same^^
     
  7. sheigutn billman555555 is correct. Avoid to use getId() as it is marked as deprecated, like the constructor for ItemStack you use, and you will get problems when 1.7 is released
     
  8. Offline

    xELI7E_SNIPEZx

    i know thanks, i worked it out..
     
Thread Status:
Not open for further replies.

Share This Page