Java 类net.minecraftforge.fml.common.registry.VillagerRegistry 实例源码

项目:VillagerTrades    文件:VillagerRegistryHelper.java   
public static List<Map.Entry<Integer, String>> getProfessionIdsAndNamesSortedById()
{
    List<Map.Entry<Integer, String>> professions = new ArrayList<Map.Entry<Integer, String>>();

    for (VillagerRegistry.VillagerProfession profession : ForgeRegistries.VILLAGER_PROFESSIONS.getValues())
    {
        @SuppressWarnings("deprecation")
        int id = VillagerRegistry.getId(profession);
        String name = profession.getRegistryName().toString();
        professions.add(new AbstractMap.SimpleEntry<Integer, String>(id, name));
    }

    Collections.sort(professions, new Comparator<Map.Entry<Integer, String>>()
    {
        @Override
        public int compare(Map.Entry<Integer, String> o1, Map.Entry<Integer, String> o2)
        {
            return o1.getKey() - o2.getKey();
        }
    });

    return professions;

}
项目:Gravestone-mod-Extended    文件:ZombieVillagerCorpseHelper.java   
public static List<ItemStack> getDefaultCorpses() {
    List<ItemStack> list = new ArrayList<>();

    list.add(createCorpse(0, 1)); // Farmer - farmer
    list.add(createCorpse(0, 2)); // Farmer - fisherman
    list.add(createCorpse(0, 3)); // Farmer - shepherd
    list.add(createCorpse(0, 4)); // Farmer - fletcher
    list.add(createCorpse(1, 1)); // Librarian - librarian
    list.add(createCorpse(1, 2)); // Librarian - cartographer
    list.add(createCorpse(2, 1)); // Priest - cleric
    list.add(createCorpse(3, 1)); // Smith - armor
    list.add(createCorpse(3, 2)); // Smith - weapon
    list.add(createCorpse(3, 3)); // Smith - tool
    list.add(createCorpse(4, 1)); // Butcher - butcher
    list.add(createCorpse(4, 2)); // Butcher - leather
    list.add(createCorpse(5, 1)); // Nitwit - nitwit

    List<VillagerRegistry.VillagerProfession> villagers = ForgeRegistries.VILLAGER_PROFESSIONS.getValues();
    for (VillagerRegistry.VillagerProfession villagerProfession : villagers) {
        list.add(createCorpse(VillagerRegistry.getId(villagerProfession), villagerProfession.getRandomCareer(RANDOM)));
    }

    return list;
}
项目:Gravestone-mod-Extended    文件:VillagerCorpseHelper.java   
public static List<ItemStack> getDefaultCorpses() {
    List<ItemStack> list = new ArrayList<>();

    list.add(getDefaultVillagerCorpse(0, 1)); // Farmer - farmer
    list.add(getDefaultVillagerCorpse(0, 2)); // Farmer - fisherman
    list.add(getDefaultVillagerCorpse(0, 3)); // Farmer - shepherd
    list.add(getDefaultVillagerCorpse(0, 4)); // Farmer - fletcher
    list.add(getDefaultVillagerCorpse(1, 1)); // Librarian - librarian
    list.add(getDefaultVillagerCorpse(1, 2)); // Librarian - cartographer
    list.add(getDefaultVillagerCorpse(2, 1)); // Priest - cleric
    list.add(getDefaultVillagerCorpse(3, 1)); // Smith - armor
    list.add(getDefaultVillagerCorpse(3, 2)); // Smith - weapon
    list.add(getDefaultVillagerCorpse(3, 3)); // Smith - tool
    list.add(getDefaultVillagerCorpse(4, 1)); // Butcher - butcher
    list.add(getDefaultVillagerCorpse(4, 2)); // Butcher - leather
    list.add(getDefaultVillagerCorpse(5, 1)); // Nitwit - nitwit

    List<VillagerRegistry.VillagerProfession> villagers = ForgeRegistries.VILLAGER_PROFESSIONS.getValues();
    for (VillagerRegistry.VillagerProfession villagerProfession : villagers) {
        list.add(getDefaultVillagerCorpse(VillagerRegistry.getId(villagerProfession), villagerProfession.getRandomCareer(RANDOM)));
    }

    return list;
}
项目:Gravestone-mod-Extended    文件:VillagerCorpseHelper.java   
private static String getNotVanillaVillagerProfession(int type) {
        VillagerRegistry.VillagerProfession profession = VillagerRegistry.getById(type);
        String professionName = profession.getRegistryName().getResourceDomain() + ":" + profession.getRegistryName().getResourcePath();

        if (professionName.equals(VillagersHandler.UNDERTAKER_NAME)) {
            return "item.corpse.villager_type.undertaker";
        } else if (Compatibility.forestryInstalled && professionName.equals(CompatibilityForestry.getApicultureVillagerID())) {
            return "item.corpse.villager_type.beekeeper";
        } else if (Compatibility.forestryInstalled && professionName.equals(CompatibilityForestry.getArboricultureVillagerID())) {
            return "item.corpse.villager_type.lumberjack";
        }
//        else if (type == 10) {
//            return "item.corpse.villager_type.brewer";
//        } else if (type == 206) {
//            return "item.corpse.villager_type.thaumaturge";
//        }
        return "item.corpse.villager_type.unknown";
    }
项目:Gravestone-mod-Extended    文件:VillagersHandler.java   
public static void registerVillagers() {
    undertakerProfession = new VillagerRegistry.VillagerProfession(UNDERTAKER_NAME, Resources.UNDERTAKER, Resources.UNDERTAKER_ZOMBIE);
    IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
    villagerProfessions.register(undertakerProfession);

    undertakerCareer = new VillagerRegistry.VillagerCareer(undertakerProfession, UNDERTAKER_NAME);
    undertakerCareer.addTrade(1,
            new EntityVillager.ListItemForEmeralds(new ItemStack(Items.SKULL, 1), new EntityVillager.PriceInfo(5, 10)),// skeleton
            new EntityVillager.ListItemForEmeralds(new ItemStack(Items.SKULL, 1, 2), new EntityVillager.PriceInfo(5, 10))// zombie
    );
    undertakerCareer.addTrade(2,
            new EntityVillager.ListItemForEmeralds(new ItemStack(Items.SKULL, 1, 3), new EntityVillager.PriceInfo(10, 20)),// steve
            new EntityVillager.ListItemForEmeralds(new ItemStack(Items.SKULL, 1, 4), new EntityVillager.PriceInfo(15, 25))// creeper
    );
    undertakerCareer.addTrade(3, new EntityVillager.ListItemForEmeralds(new ItemStack(Items.SKULL, 1, 1), new EntityVillager.PriceInfo(25, 35)));// wither
}
项目:Gravestone-mod-Extended    文件:GSStructures.java   
public static void registration() {
    // register memorials
    if (ExtendedConfig.generateVillageMemorials) {
        VillageHandlerMemorial villageMemorialHandler = new VillageHandlerMemorial();
        VillagerRegistry.instance().registerVillageCreationHandler(villageMemorialHandler);
    }

    // register Undertaker
    if (ExtendedConfig.generateUndertaker) {
        VillageHandlerGSUndertaker villageUndertakerHandler = new VillageHandlerGSUndertaker();
        VillagerRegistry.instance().registerVillageCreationHandler(villageUndertakerHandler);
    }

    // structure generator
    GameRegistry.registerWorldGenerator(new GraveStoneWorldGenerator(), 50);
}
项目:Toms-Mod    文件:VillageInit.java   
public static void init() {
    if (CoreInit.isInit()) {
        CoreInit.log.info("Loading Villager Handler");
        VillagerRegistry.instance().registerVillageCreationHandler(new VillageHouseScientist.VillageManager());
        professionScientist = new VillagerRegistry.VillagerProfession(CoreInit.modid + ":vScientist", "tomsmod:textures/models/villager_scientist.png", "textures/entity/zombie_villager/zombie_librarian.png");
        VillagerRegistry.instance().register(professionScientist);
        MapGenStructureIO.registerStructureComponent(VillageHouseScientist.class, Configs.Modid + ":vh_scientist");
        VillagerRegistry.VillagerCareer career1 = new VillagerRegistry.VillagerCareer(professionScientist, Configs.Modid + ":vScientist1");
        career1.addTrade(1, new CircuitRecipe(CraftingMaterial.ELECTRIC_MOTOR, 0.25F, 3));
        career1.addTrade(2, new CircuitRecipe(CraftingMaterial.BASIC_CIRCUIT, 1), new CircuitRecipe(CraftingMaterial.NORMAL_CIRCUIT, 2), new CircuitRecipe(CraftingMaterial.ADVANCED_CIRCUIT, 5));
        career1.addTrade(3, new EliteBlueprintRecipe());
        career1.addTrade(4, new CircuitRecipe(CraftingMaterial.ELITE_CIRCUIT, 12));
        career1.addTrade(5, new AdvFluixReactorBlueprintRecipe());
        career1.addTrade(6, new CircuitRecipe(CraftingMaterial.QUANTUM_CIRCUIT, 35));
    } else {
        CoreInit.log.fatal("Somebody tries to corrupt the villager handler!");
        throw new RuntimeException("Somebody tries to corrupt the villager handler!");
    }
}
项目:UniversalCoins    文件:UniversalCoins.java   
@EventHandler
public void init(FMLInitializationEvent event) {
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

    // worldgen
    if (bankGenWeight > 0) {
        VillageGenBank villageHandler = new VillageGenBank();
        VillagerRegistry.instance().registerVillageCreationHandler(villageHandler);
    }
    if (shopGenWeight > 0) {
        VillageGenShop villageHandler2 = new VillageGenShop();
        VillagerRegistry.instance().registerVillageCreationHandler(villageHandler2);
    }
    if (tradeGenWeight > 0) {
        VillageGenTrade villageHandler3 = new VillageGenTrade();
        VillagerRegistry.instance().registerVillageCreationHandler(villageHandler3);
    }
}
项目:Aura-Cascade    文件:CommonProxy.java   
public void preInit(FMLPreInitializationEvent event) {
    Config.init(event);
    ModCreativeTab.INSTANCE = new ModCreativeTab();
    AngelsteelToolHelper.initMaterials();
    registry = new BlockRegistry();
    registry.preInit();
    EnchantEventHandler.init();
    networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(ConstantMod.modId);
    networkWrapper.registerMessage(PacketBurst.class, PacketBurst.class, 0, Side.CLIENT);

    networkWrapper.registerMessage(PacketFairyUpdate.class, PacketFairyUpdate.class, 1, Side.CLIENT);
    networkWrapper.registerMessage(PacketFairyRequestUpdate.class, PacketFairyRequestUpdate.class, 2, Side.SERVER);
    networkWrapper.registerMessage(PacketAngelJump.PacketAngelJumpHandler.class, PacketAngelJump.class, 4, Side.SERVER);
    networkWrapper.registerMessage(PacketSyncQuestData.PacketSyncQuestDataHandler.class, PacketSyncQuestData.class, 5, Side.CLIENT);


    if (Config.villageGeneration) {
        VillagerRegistry.instance().registerVillageCreationHandler(new AuraHutHandler());
    }
    MapGenStructureIO.registerStructureComponent(ComponentAuraHut.class, "aura:auraHut");
}
项目:McMod-CubicVillager    文件:TileEntityVillager.java   
public TileEntityVillager(World world)
{
    this.world = world;
    EntityVillager dummyVillager = new EntityVillager(world);
    VillagerRegistry.setRandomProfession(dummyVillager, dummyVillager.getRNG());

    this.profession = dummyVillager.getProfessionForge().getRegistryName().toString();
    this.career = dummyVillager.careerId;
    this.love = dummyVillager.careerLevel;
    this.tradeList = ((IMerchant)dummyVillager).getRecipes(null);

    for(int i = 0; i < 3; i++)
        this.tradeInventory[i] = ItemStack.EMPTY;
    for(int i = 0; i < 8; i++)
        this.inventory[i] = ItemStack.EMPTY;
}
项目:harshencastle    文件:HandlerVillagerSpawn.java   
@SubscribeEvent
public void onChunkPopulated(PopulateChunkEvent.Post event)
{
    EntityVillager villager = new EntityVillager(event.getWorld(), VillagerRegistry.getId(HarshenVillagers.VALOR));
    BlockPos pos = event.getWorld().getTopSolidOrLiquidBlock(new BlockPos(event.getChunkX() * 16 + event.getRand().nextInt(16), 0, event.getChunkZ() * 16 + event.getRand().nextInt(16)));
    villager.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), villager.rotationYaw, villager.rotationPitch);
    if(event.isHasVillageGenerated())
        if(event.getRand().nextFloat() < 0.1f)
            event.getWorld().spawnEntity(villager);
}
项目:BetterThanWeagles    文件:VillagerStructures.java   
@Override
protected VillagerRegistry.VillagerProfession chooseForgeProfession(int count, VillagerRegistry.VillagerProfession prof)
{
    if (count == 0)
    {
        return ModVillagers.professionKrog;
    }
    else
    {
        return ModVillagers.professionTorg;
    }
}
项目:BetterThanWeagles    文件:CommonProxy.java   
@SubscribeEvent
public static void registerVillagers(RegistryEvent.Register<VillagerRegistry.VillagerProfession> event)
{
    VillagerRegistry.instance().registerVillageCreationHandler(new VillagerStructures.CaveHandler());
    MapGenStructureIO.registerStructureComponent(VillagerStructures.Cave.class, "btweagles:caveStructure");

    event.getRegistry().register(ModVillagers.professionKrog);
    event.getRegistry().register(ModVillagers.professionTorg);
}
项目:VillagerTrades    文件:VillagerRegistryHelper.java   
public VillagerRegistry.VillagerCareer getCareer(String name)
{
    for (VillagerRegistry.VillagerCareer career : this.getCareers())
    {
        if (career.getName().equals(name)) return career;
    }
    return null;
}
项目:Dailies    文件:CommonProxy.java   
public void preInit(FMLPreInitializationEvent e) {
    CapabilityDailiesHandler.register();
    DailiesPacketHandler.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(DailiesMod.instance, new DailiesGuiHandler());
    MapGenStructureIO.registerStructureComponent(BaileysShopVillagePiece.class, "baileyshop");
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerBailey());
}
项目:InspiringWorld    文件:InspiringMagic.java   
private void addVillagerTrade() {
    VillagerRegistry.instance().getRegistry().getValue(new ResourceLocation("priest")).getCareer(2).addTrade(2,
        new EntityVillager.ITradeList() {
            @Override
            public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
                //TODO add trading item.
            }
        });
}
项目:Gravestone-mod-Extended    文件:CorpseRendererHelper.java   
private static void bindVillagerTexture(int profession) {
    switch (profession) {
        case 0:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_FARMER);
            break;
        case 1:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_LIBRARIAN);
            break;
        case 2:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_PRIEST);
            break;
        case 3:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_SMITH);
            break;
        case 4:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_BUTCHER);
            break;
        default:
            ResourceLocation skin = Resources.VILLAGER;
            if (MODDED_VILLAGERS.containsKey(profession)) {
                skin = MODDED_VILLAGERS.get(profession);
            } else {
                VillagerRegistry.VillagerProfession villager = VillagerRegistry.getById(profession);
                if (villager != null) {
                    skin = villager.getSkin();
                }
                MODDED_VILLAGERS.put(profession, skin);
            }

            Minecraft.getMinecraft().renderEngine.bindTexture(skin);
            break;
    }
}
项目:SimpleCorn    文件:MasterRegistrar.java   
public static void callRegistry(FMLPreInitializationEvent e) {
    register(e, ObjectList.getItemList());
    register(e, ObjectList.getBlockList());
    Recipes.register();
    if(e.getSide() == Side.CLIENT){
            RenderingRegistry.registerEntityRenderingHandler(MyEntityFireworkRocket.class, RenderFireworkEntity.INSTANCE);
    }
    EntityRegistry.registerModEntity(new ResourceLocation("simplecorn:entitypopfirework"),MyEntityFireworkRocket.class, "entitypopfirework", 132, Corn.instance, 64, 3, true);

    MapGenStructureIO.registerStructureComponent(ComponentCornField.class, "Vicf");
    VillagerRegistry.instance().registerVillageCreationHandler(new CornWorldGen());
    RecipeSorter.register("simplecorn:fireworks", MyRecipeFireworks.class, Category.SHAPELESS, "after:minecraft:fireworks");
}
项目:Sophisticated-wolves    文件:VillagersHandler.java   
public static void registerVillagers() {
    petsSellerProfession = new VillagerRegistry.VillagerProfession(PETS_SELLER_NAME, Resources.PETS_SELLER, Resources.PETS_SELLER_ZOMBIE);
    IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
    villagerProfessions.register(petsSellerProfession);

    petsSellerCareer = new VillagerRegistry.VillagerCareer(petsSellerProfession, PETS_SELLER_NAME);
    petsSellerCareer.addTrade(1,
            new EntityVillager.ListItemForEmeralds(new ItemStack(SWItems.DOG_TAG), new EntityVillager.PriceInfo(1, 2)),
            new EntityVillager.ListItemForEmeralds(new ItemStack(SWItems.DOG_TREAT), new EntityVillager.PriceInfo(1, 3))
    );
    petsSellerCareer.addTrade(2,
            new EntityVillager.ListItemForEmeralds(new ItemStack(SWBlocks.DOG_BOWL), new EntityVillager.PriceInfo(5, 10)),
            new EntityVillager.ListItemForEmeralds(new ItemStack(SWItems.PET_CARRIER), new EntityVillager.PriceInfo(6, 12))
    );
    petsSellerCareer.addTrade(3,
            (merchant, recipeList, random) -> {
                recipeList.add(getMerchantRecipe(EntityChicken.class, random, 13, 15));
            },
            (merchant, recipeList, random) -> {
                recipeList.add(getMerchantRecipe(EntityRabbit.class, random, 15, 20));
            },
            (merchant, recipeList, random) -> {
                recipeList.add(getMerchantRecipe(EntityWolf.class, random, 20, 25));
            }
    );
    petsSellerCareer.addTrade(4,
            (merchant, recipeList, random) -> {
                recipeList.add(getMerchantRecipe(EntityParrot.class, random, 20, 25));
            },
            (merchant, recipeList, random) -> {
                recipeList.add(getMerchantRecipe(EntityOcelot.class, random, 30, 40));
            },
            (merchant, recipeList, random) -> {
                recipeList.add(getMerchantRecipe(EntitySophisticatedWolf.class, random, 30, 40));
            }
    );
}
项目:VillagerTrades    文件:VillagerRegistryHelper.java   
public List<VillagerRegistry.VillagerCareer> getCareers()
{
    return ReflectionHelper.getFieldValue(professionCareersField, this.profession);
}
项目:VillagerTrades    文件:VillagerRegistryHelper.java   
public VTTVillagerProfession(VillagerRegistry.VillagerProfession profession)
{
    this.profession = profession;
}
项目:VillagerTrades    文件:VillagerRegistryHelper.java   
public VTTVillagerCareer(VillagerRegistry.VillagerCareer career)
{
    this.career = career;
}
项目:VillagerTrades    文件:VillagerRegistryHelper.java   
public static VillagerRegistry.VillagerProfession getProfession(String value)
{
    return ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation(value));
}
项目:ToroQuest    文件:VillageHandlerGuardTower2.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceGuardTower2.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerGuardTower2());
}
项目:ToroQuest    文件:VillageHandlerBarracks.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceBarracks.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerBarracks());
}
项目:ToroQuest    文件:VillageHandlerCabin.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceCabin.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerCabin());
}
项目:ToroQuest    文件:VillageHandlerGuardTower.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceGuardTower.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerGuardTower());
}
项目:ToroQuest    文件:VillageHandlerShop.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceShop.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerShop());
}
项目:ToroQuest    文件:VillageHandlerTrophy.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceTrophy.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerTrophy());
}
项目:ToroQuest    文件:VillageHandlerKeep.java   
public static void init() {
    MapGenStructureIO.registerStructureComponent(VillagePieceKeep.class, NAME);
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerKeep());
}
项目:Toms-Mod    文件:VillageHouseScientist.java   
@Override
protected VillagerProfession chooseForgeProfession(int count, net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) {
    return count == 0 ? VillagerRegistry.instance().getRegistry().getValue(new ResourceLocation("minecraft:librarian")) : CoreInit.professionScientist;
}
项目:InfinityLib    文件:InfinityMod.java   
@SubscribeEvent
public final void registerVillagerProfessions(RegistryEvent.Register<VillagerRegistry.VillagerProfession> event) {
    InfinityLib.proxy.registerVillagerProfessions(this, event.getRegistry());
}
项目:InfinityLib    文件:IProxy.java   
default void registerVillagerProfessions(InfinityMod mod, IForgeRegistry<VillagerRegistry.VillagerProfession> registry) {
    ReflectionHelper.forEachIn(mod.getModVillagerProfessionRegistry(), VillagerRegistry.VillagerProfession.class,
            profession -> register(mod, registry, profession, profession.toString()));
}
项目:Restructured    文件:SchematicStructureCreationHandler.java   
public SchematicStructureCreationHandler() {
    VillagerRegistry.instance().registerVillageCreationHandler(this);
}
项目:Sophisticated-wolves    文件:SWStructures.java   
public static void registration() {
    if (SWConfiguration.enablePetsSeller) {
        VillageHandlerPetsSeller villageUndertakerHandler = new VillageHandlerPetsSeller();
        VillagerRegistry.instance().registerVillageCreationHandler(villageUndertakerHandler);
    }
}
项目:Sophisticated-wolves    文件:ComponentVillagePetsSeller.java   
@Override
protected VillagerRegistry.VillagerProfession chooseForgeProfession(int count, net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) {
    return VillagersHandler.petsSellerProfession;
}
项目:McMod-CubicVillager    文件:VillagerData.java   
/**
 * 村人をデータ化する。
 * @param villager 村人
 * @param tag      書き込み先のNBT
 */
public static void villagerToTag(EntityVillager villager, NBTTagCompound tag)
{
    MerchantRecipeList recipes = villager.getRecipes(null);
    if((recipes != null) && (recipes.size() == 0))
    {
        tag.setBoolean("ntr", true);
    }
    else
    {
        tag.setBoolean("ntr", false);

        if(recipes != null)
        {
            for(Object recipe : recipes)
            {
                // 使用可能回数を初期化する。
                ((MerchantRecipe)recipe).toolUses = 0;
            }
            NBTTagCompound tagVillager = recipes.getRecipiesAsTags();
            tag.setTag("trd", tagVillager);
        }
    }

    // 職業
    VillagerRegistry.VillagerProfession prof = villager.getProfessionForge();
    ResourceLocation regName = prof.getRegistryName();
    tag.setString("prf", regName.toString());

    // 副職業とレベル
    tag.setInteger("car", villager.careerId);
    tag.setInteger("lov", villager.careerLevel);

    // 名前
    String name = villager.getCustomNameTag();
    if((name != null) && (name.length() > 0))
    {
        tag.setString("nam", name);
    }

    // インベントリ
    NBTTagList items = new NBTTagList();
    tag.setTag("inv", items);
    InventoryBasic villagerInventory = villager.getVillagerInventory();
    VillagerData.inventoryToTag(villagerInventory, items);
}
项目:BaseMetals    文件:VillagerTradeHelper.java   
/**
 * Inserts one or more trades to the defaul villager trade table using dark magic (aka java reflection).
 * @param profession Villager profession
 * @param careerID Villager career ID (1-3)
 * @param tradeLevel Level of trade (1+)
 * @param trades Trades to add to the given level
 */
public static void insertTrades(ResourceLocation profession, int careerID, int tradeLevel, EntityVillager.ITradeList... trades) {
    for(EntityVillager.ITradeList trade : trades) {
        VillagerRegistry.instance().getRegistry().getValue(profession).getCareer(careerID-1).addTrade(tradeLevel, trade);
    }
}