how to dye leather Armour

Discussion in 'Plugin Development' started by StickyMan, Nov 29, 2012.

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

    StickyMan

    how to dye leather Armour
    Code:
     ItemStack SonicHelmet = new ItemStack(Material.LEATHER_HELMET);
    thanks
    itai
     
  2. Offline

    Rprrr

  3. Offline

    StickyMan

    didn't understand how to change the color
    it need to buy easier isn't it
     
  4. Offline

    Rprrr

    StickyMan
    Just paste all under "Changing color of armor:" in a class.
    Then, use this..
    Code:
    public static ItemStack setColor(ItemStack item, int colorR, int colorG, int colorB) {
    .. to set a colour.
     
  5. Offline

    StickyMan

    Code:
            if (commandLabel.equalsIgnoreCase("Dye")) {
     
            }
    i want that in that command it will give a dyed lether to the player
     
  6. Offline

    fireblast709

    get the ItemStack you want to colour, and let the player use /Dye red green blue. Then use Integer.parseInt(args[x]) to parse the argument to an integer and use the link Rprrr gave you to color it
     
  7. Offline

    StickyMan

    but i want it will automatic colored
     
  8. Offline

    fireblast709

    then you should have a preset colour somewhere and use that
     
  9. Offline

    StickyMan

    this small fuction become so hard (i mean long code for nothing)
    bukkit need to do less code for it ( :confused: )
     
  10. Offline

    fireblast709

    so what is actually the use of the command dye. If you can specify it a bit more, I might be more of a help :3
     
  11. Offline

    StickyMan

    i am building kits
    and this kit need to be that the helmet, chest-plate and leggings will be collared blue
    and i need to place them on the player
    i know how to place them on the player
    it just the dyed lether
     
  12. Offline

    StickyMan

  13. Offline

    Cammy_the_block

    bump*
     
    devilquak likes this.
  14. Offline

    stirante

    Copy only this function:
    Code:
        public static ItemStack setArmorColor(ItemStack item, int color) {]
            CraftItemStack craftStack = null;
            net.minecraft.server.ItemStack itemStack = null;
            if (item instanceof CraftItemStack) {
                craftStack = (CraftItemStack) item;
                itemStack = craftStack.getHandle();
            }
            else if (item instanceof ItemStack) {
                craftStack = new CraftItemStack(item);
                itemStack = craftStack.getHandle();
            }
            NBTTagCompound tag = itemStack.tag;
            if (tag == null) {
                tag = new NBTTagCompound();
                tag.setCompound("display", new NBTTagCompound());
                itemStack.tag = tag;
            }
            
            tag = itemStack.tag.getCompound("display");
            tag.setInt("color", color);
            itemStack.tag.setCompound("display", tag);
            return craftStack;
        }
    
    And to color item to blue type:
    helmet = setArmorColor(helmet, 0x0000FF);
     
  15. I bet at some point this will reach the bukkit API, it just needs time. Bukkit coders can't code with the speed of light, you know? If you want things to be done faster go fork bukkit, code it for yourself and do a pull request back to upstream. That's how open source software normally works.

    Also: "so hard"? All you have to do is to copy&paste code and then use ONE, exactly ONE function, so ONE line of code to color the armor. If that's to much I don't know... Even if the API would have it you would have to call ONE function...
     
    Codex Arcanum and stirante like this.
Thread Status:
Not open for further replies.

Share This Page