Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Colored leather armor on servers

Comments in 'Plugin Development' started by Kvetinac97, Jan 27, 2016.

  1. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Hi. As we all know, in 0.14.0, the developers added option to color armor with dyes in colored water in cauldrons. There are many combinations of colors we can mix, so it isn't stored in damage value, but somewhere in compound tag...

    My question is: How to add this compound tag to the item and what are color data for base colors? (red, blue, green, yellow, orange, pink...)

    I want to give items to players, so I want code like that:
    PHP:
    $item Item::get(Item::LEATHER_TUNIC01);
    $item->setCompoundTag(???);
    $player->getInventory()->addItem($item);
  2. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    So still nobody knows how? :/
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I really didn't understand the question.
    If you want add a armor with a color, just modify the metadata, they are not "special" items.
  4. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    metadata = id, meta (like 5:1 for birch wood planks)

    special = something in customtag
  5. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    I don't have android so I can't test this, but you could try this:
    PHP:
    $item Item::get(Item::LEATHER_TUNIC01);
    $tag NBT::parseJSON("{display:{color:\"COLORHERE\"}}");
    $item->setNamedTag($tag);
    $player->getInventory()->addItem($item);
    Replace COLORHERE with a decimal color value (
    RGB to hexadecimal: http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php

    Hexadecimal to decimal: http://www.statman.info/conversions/hexadecimal.html
    )
  6. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    i'll test it
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Lol it gives me 99+ brick stairs and 99+ mashroom blocks, and gives me uncolored leather.
  8. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Yep ;) Doesn't work :(
  9. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i tried this too but doesn't work :/ i tried both Color and color
    PHP:
    public function setCustomColor($color){
            if(!
    $this->hasCompoundTag()){
                
    $tag = new Compound("", []);
            }else{
                
    $tag $this->getNamedTag();
            }

            if(isset(
    $tag->display) and $tag->display instanceof Compound){
                
    $tag->display->color = new Int("color"$color);
            }else{
                
    $tag->display = new Compound("display", [
                    
    "color" => new Int("color"$color)
                ]);
            }
            return 
    $this;
        }
  10. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    I've tried with String and Enum, not workin.
  11. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Quote from minecraftforum.net:

    The specific chunk dealing with color is:

    tag:{display:{color:3491355}}

    You can copy/paste this into any of the last four slots of the equipment tag (the first one if for what he's holding, which is usually a weapon. If he were HOLDING a piece of colored leather armor, then it MIGHT work in the first slot as well.

    Here are the color values to use after the colon of color:

    White: 14540253
    Orange: 14384446
    Purple: 11751612
    Light Blue: 7047881
    Yellow: 11642407
    Lime: 4304440
    Pink: 13665433
    Gray: 4210752
    Light Gray: 10133921
    Cyan: 3042953
    Purple: 8273333
    Blue: 3029133
    Brown: 5190175
    Green: 3491355
    Red: 9843760
    Black: 1644054

    Thanks to Extreme_Squid for figuring these out, and for Jailpod for the post on colored armor I found elsewhere.

    So the armor items have a special color value you can add with a command.
    PocketKiller likes this.
  12. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    And how about this, using RGB?
    Found it on the website too.
    Code:
    Red /give [player] 298 1 0 color:255,0,0
    Green /give [player] 298 1 0 color:0,255,0
    blue /give [player] 298 1 0 color:0,0,255
    
  13. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    No, dont works too, "Cant analyze NBT, illegal offset"
  14. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    doesnt work
  15. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    I know :/
  16. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Maybe it is a mcpe bug
  17. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    tried /give steve leather_tunic 1 {display:{color:3491355}} :/
  18. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    It would be awesome if @Intyre add the working code for leather armor to Github
  19. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    That looks like Essentials for Bukkit/Spigot.
    PocketKiller, Muqsit and PEMapModder like this.
  20. MichaelM04
    Offline

    MichaelM04 Active Member Plugin Developer

    Joined:
    Nov 12, 2015
    Posts:
    213
    Plugins:
    1
    Minecraft User:
    Michael
    This is "my" opinion but I don't think anything is going to happen without @shoghicp

Share This Page

Advertisement