Skip to content

Commit

Permalink
Fix new equip options for NPCs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 7, 2016
1 parent e55e448 commit 5d92767
Showing 1 changed file with 26 additions and 0 deletions.
Expand Up @@ -145,6 +145,32 @@ else if (entity.isCitizensNPC()) {
if (equipment.get("offhand") != null) {
trait.set(5, equipment.get("offhand").getItemStack());
}

if (npc.isSpawned()) {
LivingEntity livingEntity = npc.getLivingEntity();

// TODO: Citizens API for this blob?

if (livingEntity.getType() == EntityType.HORSE) {
if (equipment.get("saddle") != null) {
((Horse) livingEntity).getInventory().setSaddle(equipment.get("saddle").getItemStack());
}
if (equipment.get("horse_armor") != null) {
((Horse) livingEntity).getInventory().setArmor(equipment.get("horse_armor").getItemStack());
}
}
else if (livingEntity.getType() == EntityType.PIG) {
if (equipment.get("saddle") != null) {
dItem saddle = equipment.get("saddle");
if (saddle.getItemStack().getType() == Material.SADDLE) {
((Pig) livingEntity).setSaddle(true);
}
else {
((Pig) livingEntity).setSaddle(false);
}
}
}
}
}

}
Expand Down

0 comments on commit 5d92767

Please sign in to comment.