How to trigger a procedure after trading with a villager?

Started by Bill_Clinton on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to trigger a procedure after trading with a villager?

I'm creating a mod where you build an army, and part of this is Voluntary Soldiers and Conscripts. The basic idea is unemployed villagers can start working at a job block to become the Recruit Profession. From here, you initiate a trade with them, which upon completion turns them into Infantry, which is a separate mob (it would spawn the infantry and despawn the villager)

I got the job block, the recruit profession, villagers turn into the recruit profession, but I cant find out a way to get the villager to turn into the Infantry. 

Is there a way that I can make the trade itself turn them into another mob?

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Additionally, I found a…
Sun, 09/08/2024 - 21:07

Additionally, I found a piece of code that CAN change vanilla villager professions into the mob, through this text:
((Villager) entity).getVillagerData().getProfession() == VillagerProfession.PROFESSIONNAME

however, this doesnt translate onto modded professions.