Search in sources :

Example 1 with IMixinVillagerCareer

use of org.spongepowered.mod.interfaces.IMixinVillagerCareer 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());
    }
}
Also used : IMixinVillagerCareer(org.spongepowered.mod.interfaces.IMixinVillagerCareer) SpongeProfession(org.spongepowered.common.entity.SpongeProfession) Profession(org.spongepowered.api.data.type.Profession) SpongeTranslation(org.spongepowered.common.text.translation.SpongeTranslation) VillagerRegistry(net.minecraftforge.fml.common.registry.VillagerRegistry) SpongeCareer(org.spongepowered.common.entity.SpongeCareer) Career(org.spongepowered.api.data.type.Career) SpongeCareer(org.spongepowered.common.entity.SpongeCareer) IMixinVillagerCareer(org.spongepowered.mod.interfaces.IMixinVillagerCareer)

Aggregations

VillagerRegistry (net.minecraftforge.fml.common.registry.VillagerRegistry)1 Career (org.spongepowered.api.data.type.Career)1 Profession (org.spongepowered.api.data.type.Profession)1 SpongeCareer (org.spongepowered.common.entity.SpongeCareer)1 SpongeProfession (org.spongepowered.common.entity.SpongeProfession)1 SpongeTranslation (org.spongepowered.common.text.translation.SpongeTranslation)1 IMixinVillagerCareer (org.spongepowered.mod.interfaces.IMixinVillagerCareer)1