if(entity instanceof EntityVillager) {
EntityVillager villager = (EntityVillager)entity;
if(villager.getProfession() != Config.villagerMechanicID) {
villager.setProfession(Config.villagerMechanicID);
NBTTagCompound tag = new NBTTagCompound();
villager.writeEntityToNBT(tag);
if(tag.hasKey("Offers")) {//reset the trade list
tag.removeTag("Offers");
villager.readEntityFromNBT(tag);
}
}