当前位置: 首页>>代码示例>>Java>>正文


Java VillagerRegistry类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.registry.VillagerRegistry的典型用法代码示例。如果您正苦于以下问题:Java VillagerRegistry类的具体用法?Java VillagerRegistry怎么用?Java VillagerRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VillagerRegistry类属于net.minecraftforge.fml.common.registry包,在下文中一共展示了VillagerRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getProfessionIdsAndNamesSortedById

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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;

}
 
开发者ID:crazysnailboy,项目名称:VillagerTrades,代码行数:25,代码来源:VillagerRegistryHelper.java

示例2: getDefaultCorpses

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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;
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:25,代码来源:ZombieVillagerCorpseHelper.java

示例3: getDefaultCorpses

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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;
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:25,代码来源:VillagerCorpseHelper.java

示例4: getNotVanillaVillagerProfession

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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";
    }
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:19,代码来源:VillagerCorpseHelper.java

示例5: registerVillagers

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:17,代码来源:VillagersHandler.java

示例6: registration

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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);
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:17,代码来源:GSStructures.java

示例7: init

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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!");
	}
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:20,代码来源:VillageInit.java

示例8: init

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:notabadminer,项目名称:UniversalCoins,代码行数:19,代码来源:UniversalCoins.java

示例9: preInit

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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");
}
 
开发者ID:AdlyTempleton,项目名称:Aura-Cascade,代码行数:22,代码来源:CommonProxy.java

示例10: TileEntityVillager

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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;
}
 
开发者ID:a1lic,项目名称:McMod-CubicVillager,代码行数:17,代码来源:TileEntityVillager.java

示例11: onChunkPopulated

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
@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);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:11,代码来源:HandlerVillagerSpawn.java

示例12: chooseForgeProfession

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
@Override
protected VillagerRegistry.VillagerProfession chooseForgeProfession(int count, VillagerRegistry.VillagerProfession prof)
{
	if (count == 0)
	{
		return ModVillagers.professionKrog;
	}
	else
	{
		return ModVillagers.professionTorg;
	}
}
 
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:13,代码来源:VillagerStructures.java

示例13: registerVillagers

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
@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);
}
 
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:10,代码来源:CommonProxy.java

示例14: getCareer

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
public VillagerRegistry.VillagerCareer getCareer(String name)
{
	for (VillagerRegistry.VillagerCareer career : this.getCareers())
	{
		if (career.getName().equals(name)) return career;
	}
	return null;
}
 
开发者ID:crazysnailboy,项目名称:VillagerTrades,代码行数:9,代码来源:VillagerRegistryHelper.java

示例15: preInit

import net.minecraftforge.fml.common.registry.VillagerRegistry; //导入依赖的package包/类
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());
}
 
开发者ID:ToroCraft,项目名称:Dailies,代码行数:8,代码来源:CommonProxy.java


注:本文中的net.minecraftforge.fml.common.registry.VillagerRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。