use of org.spongepowered.api.data.type.Profession in project SpongeForge by SpongePowered.
the class SpongeForgeVillagerRegistry method registerForgeCareer.
public static void registerForgeCareer(VillagerRegistry.VillagerCareer career) {
final VillagerRegistry.VillagerProfession villagerProfession = ((IMixinVillagerCareer) career).getProfession();
final Optional<Profession> spongeProfession = getProfession(villagerProfession);
spongeProfession.ifPresent(profession -> {
Career suggestedCareer = new SpongeCareer(((IMixinVillagerCareer) career).getId(), career.getName(), profession, new SpongeTranslation("entity.Villager." + career.getName()));
SpongeCareer registeredCareer = validateCareer(career, suggestedCareer);
CareerRegistryModule.getInstance().registerCareer(registeredCareer);
});
if (!spongeProfession.isPresent()) {
SpongeImpl.getLogger().debug("Delaying registration of career {} until its profession {} is registered with Forge.", career.getName(), villagerProfession.getRegistryName());
}
}
Aggregations