Hi, i want to give player random dyed leather armor when the players kill mobs array = [ 'thepig', 'milkman' ] But, i want the dyed leather armor only drops when the mobs has a name included on array and how to give color to leather armor? is it possible? ===EDIT=== Curent Proggres PHP: public function pl(Player $pl) : Player{ return $pl;}public function onkill(EntityDamageByEntityEvent $event){ $entityName = $event->getEntity()->getNameTag(); $arr = [ 'milkman' => [ 'id' => 276, 'damage' => 0, 'count' => 1 ], 'pigman' => [ 'id' => 286, 'damage' => 0, 'count' => 1 ] ]; foreach ($arr as $r) { if(isset($arr[$entityName])) { if($event->getDamager() instanceof Player) { $player = $this->pl($event->getDamager()); $player->getInventory()->addItem(Item::get($r[$entityName]['id'], $r[$entityName]['id'], $r[$entityName]['id'])); } } }} So How to give the dyed leather armor?
show some previous attempts of you trying to code this first , and then am sure someone with bother to help.
PHP: public function pl(Player $pl) : Player{ return $pl;}public function onkill(EntityDamageByEntityEvent $event){ $entityName = $event->getEntity()->getNameTag(); $arr = [ 'milkman' => [ 'id' => 276, 'damage' => 0, 'count' => 1 ], 'pigman' => [ 'id' => 286, 'damage' => 0, 'count' => 1 ] ]; foreach ($arr as $r) { if($entityName == $arr) { if($event->getDamager() instanceof Player) { $player = $this->pl($event->getDamager()); $player->getInventory()->addItem(Item::get($r[$entityName]['id'], $r[$entityName]['id'], $r[$entityName]['id'])); } } }} i can't get it worked
i have no idea what your code says tbh , but dyed leather armor is determine using an items damage like spawners. i don't really know sorry if am wrong , its 1:19AM
PHP: $nbt = new CompoundTag("", []);$nbt->customColor = new IntTag("customColor", Color::getColorCode());$leatherTierArmor->setCompoundTag($nbt); I hope thats work as well , btw Color:: it should be as variable, you cant called it there because its not static (i didnt test that code).