I created a new VillagerProfession with its name, texture, and zombie texture, and I registered it at the VillagerRegistry. Then I also created a career for the profession. Randomly spawning my villager by using the normal villager spawn egg works just fine.
I thought by defining the zombie villager texture, everything for the corresponding zombie villager would also work. But I cant spawn the zombie villager by zombie spawn eggs, and also can not convert my villager into zombie villager. They just turn into normal zombies.
I dug a bit through the source code, and I am kind of confused how this should even work. There is a method EntityZombie.setZombieType(ZombieType) , but marked as deprecated. This method calls VillagerRegistry.onSetProfession(EntityZombie, ZombieType, int) which is not deprecated. But for custom villager types it then seems to call EntityZombie.setVillagerType(VillagerProfession).
Then there is this EntityZombie.setVillagerType(VillagerProfession) which is not deprecated, and calls VillagerRegistry.onSetProfession(EntityZombie, VillagerProfession) which is marked as deprecated again. But the onSetProfession method only works for vanilla types.
So, how do I get my ZombieVillager spawn naturally, and also convert correctly from villager to ZombieVillager (and reverse)?