Solved Help Recipe+Durability

Discussion in 'Plugin Development' started by noraver, Mar 30, 2013.

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

    noraver

    ran into a little sang wondering if anyone could help

    Code:
           
    createLeatherArmourRecipes("Leather", Material.LEATHER, Color.WHITE, (short)400);
     
    }
     
    private void createLeatherArmourRecipes(String name, Material mat, Color color, Short durability) {
    createLeatherPiece("Helm", new String[] {"  ", "*%*", "* *"}, Material.LEATHER_HELMET, name, mat, color, durability);
    }
    private void createLeatherPiece(String suffix, String[] shape, Material item, String name, Material mat, Color color, Short durability) {
    ItemStack is = new ItemStack(item, 1);
    LeatherArmorMeta im = (LeatherArmorMeta)is.getItemMeta();
    im.setDisplayName(name+" "+suffix);
    im.setColor(color);
    is.setItemMeta(im);
    is.setDurability(durability);
    im trying to changed the durability of the leather armor that is made higher then Diamond Armor
    each time i made the armor they all are 1 shots and broken all the code works fine just that durability im having problems with

    p.s. anyone know how to remove the words dyed from dyed armor
     
  2. Offline

    molenzwiebel

    The durability in this case is the damage, for example 1 durability is 1 use. If you want more than the standard durability, use a negative number. (e.g. -400)
     
  3. Offline

    noraver

    molenzwiebel
    i tryed (short)-400) but it just put the durability to 0
     
  4. Offline

    molenzwiebel

    It looks like it is at zero, but it should not take damage (at least not visible). Otherwise, bukkit rejects negative damages. (Trust me, it is possible) To see the damage, press both F3 and H at the same time
     
  5. Offline

    noraver

    molenzwiebel
    tested it on a
    Iron Sword A = 250 hits
    Dura-2000 Iron Sword B = 250 hits

    Leather Helm A = 55 hits
    Dura-2500 Leather Helm B = 55 hits


    Leather Boots A = 64 hits
    Dura-2500 Leather Boots B = 64 hits



    Leather Leggings A = 75 hits
    Dura-2500 Leather Leggings B = 75 hits



    Leather Chest A = 80 hits
    Dura-2500 Leather Chest B = 80 hits

    No Change found in any of them =\
     
Thread Status:
Not open for further replies.

Share This Page