[Resource] (Full Bar) Red & Orange Item Durability

Discussion in 'Resources' started by DrJava, Jan 11, 2014.

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

    DrJava

    Hey, you!
    Ever wanted to make an item durability bar full red or orange? Well, now you can!

    Here's an example:
    [​IMG][​IMG]

    Here's the function:
    Code:java
    1. public ItemStack ColouredDura(ItemStack a, boolean b){
    2. a.setDurability((short) (b ? 1000 : Material.getMaterial(a.getTypeId()).getMaxDurability()*2));
    3. return a;
    4. }


    What this does it sets the item's durability to a negative value. If b is true, we will colour the item's durability red; if it's not, we will make it orange.

    I would just like to say that this is only for looks; the item will break after the player uses the item.
     
    DSH105, Windy Day, GregMC and 2 others like this.
  2. Offline

    ccrama

    Pretty cool workaround! Just don't know where it would be useful, maybe in menus or GUIs of some kind?
     
    DrJava likes this.
  3. Offline

    DrJava

    I'm now going to use it for my server :p
     
  4. Offline

    SoThatsIt

    how are you planning to use this? :p just out of curiosity xD

    maybe a way of toggling a players difficulty? xD like red for pvp + mobs, orange for mobs and green for no mobs/pvp. other than that im struggling to think of uses, but you never know maybe ill come up with some obscure thing that this will be perfect for :)
     
  5. Offline

    DrJava

    I am a dev on a Bungee server; using it for server selection ;) Anyway, I might make a method to allow this item to have durability while having the full red bar.
     
  6. Offline

    Scullyking

    Pretty nifty :)
     
    DrJava likes this.
  7. Offline

    DrJava

    Sorry for the late reply, but thanks!
     
Thread Status:
Not open for further replies.

Share This Page