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_TUNIC, 0, 1);$item->setCompoundTag(???);$player->getInventory()->addItem($item);
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.
I don't have android so I can't test this, but you could try this: PHP: $item = Item::get(Item::LEATHER_TUNIC, 0, 1);$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 )
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; }
Quote from minecraftforum.net: Spoiler 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.
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