EntityInventory inventory = entity.get(EntityInventory.class);
if (inventory != null) {
final ItemStack held, boots, legs, chest, helm;
held = inventory.getHeldItem();
if (held != null) {
messages.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.HELD_SLOT, held));
}
boots = inventory.getArmor().getBoots();
if (boots != null) {
messages.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.BOOTS_SLOT, boots));
}
legs = inventory.getArmor().getLeggings();
if (legs != null) {
messages.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.LEGGINGS_SLOT, legs));
}
chest = inventory.getArmor().getChestPlate();
if (chest != null) {
messages.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.CHESTPLATE_SLOT, chest));
}
helm = inventory.getArmor().getHelmet();
if (helm != null) {
messages.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.HELMET_SLOT, helm));
}
}
return messages;
}