Search in sources :

Example 1 with IMixinVillagerProfession

use of org.spongepowered.mod.interfaces.IMixinVillagerProfession in project SpongeForge by SpongePowered.

the class MixinVillagerRegistry method register.

/**
 * @author gabizou - July 1st, 2017
 * @reason Rewrite the register method to join Sponge's villager registrations with forge's.
 * For some auspiciouos reason, when trying to write a redirect, the redirect will fail...
 *
 * @param prof The profession being registered
 * @param id The id being registered
 */
@Overwrite
private void register(VillagerRegistry.VillagerProfession prof, int id) {
    this.REGISTRY.register(id, ((IMixinVillagerProfession) prof).getName(), prof);
    final int professionId = this.REGISTRY.getIDForObject(prof);
    final IMixinVillagerProfession mixinProfession = (IMixinVillagerProfession) prof;
    final SpongeProfession spongeProfession = new SpongeProfession(professionId, mixinProfession.getId(), mixinProfession.getProfessionName());
    final SpongeProfession registeredProfession = SpongeForgeVillagerRegistry.validateProfession(prof, spongeProfession);
    ProfessionRegistryModule.getInstance().registerAdditionalCatalog(registeredProfession);
}
Also used : SpongeProfession(org.spongepowered.common.entity.SpongeProfession) IMixinVillagerProfession(org.spongepowered.mod.interfaces.IMixinVillagerProfession) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Aggregations

Overwrite (org.spongepowered.asm.mixin.Overwrite)1 SpongeProfession (org.spongepowered.common.entity.SpongeProfession)1 IMixinVillagerProfession (org.spongepowered.mod.interfaces.IMixinVillagerProfession)1