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


Java PageIRecipe类代码示例

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


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

示例1: buildPages

import amerifrance.guideapi.page.PageIRecipe; //导入依赖的package包/类
private void buildPages() {
  List<GuideItem> items = GuideRegistry.getItems();
  Comparator<GuideItem> comparator = new Comparator<GuideItem>() {
    @Override
    public int compare(final GuideItem first, final GuideItem second) {
      return first.title.compareTo(second.title);
    }
  };
  Collections.sort(items, comparator);
  for (GuideItem item : items) {
    List<IPage> pages = new ArrayList<IPage>();
    for (GuidePage p : item.pages) {
      if (p.text != null) {
        for (IPage textPage : PageHelper.pagesForLongText(p.text, MAX_PAGE_LENGTH)) {
          pages.add(textPage);
        }
      }
      if (p.recipe != null) {
        pages.add(new PageIRecipe(p.recipe));
      }
      if (p.brewRecipe != null) {
        pages.add(new PageBrewingRecipe(p.brewRecipe));
      }
    }
    if (item.cat == null) {
      item.cat = GuideCategory.WORLD;
    }
    addEntry(item.cat, pages, item.title, new ItemStack(item.icon));
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:31,代码来源:CyclicGuideBook.java

示例2: buildEntries

import amerifrance.guideapi.page.PageIRecipe; //导入依赖的package包/类
public static Map<ResourceLocation, EntryAbstract> buildEntries(){
	Map<ResourceLocation, EntryAbstract> entries = new LinkedHashMap<>();
	
	EntryAbstract blank = new EntryItemStack(WizardryRegistry.inscription.getUnlocalizedName()+".name", new ItemStack(WizardryRegistry.inscription));
	blank.addPage(new PageItemStack(ENTRY_KEY+"blank.description", WizardryRegistry.inscription));
	for(IRecipe r:Utils.getRecipesForOutput(new ItemStack(WizardryRegistry.inscription))){
		blank.addPage(new PageIRecipe(r));
	}
	entries.put(new ResourceLocation(ENTRY_KEY+"blank"),blank);
	
	for(String id:DustRegistry.getInscIDs()){
		Inscription insc = DustRegistry.getInscriptionByID(id);
		
		EntryAbstract insEntry = new EntryItemStack(insc.getName(),DustRegistry.getStackForInscription(id));
		insEntry.addPage(new PageText(insc.getShortDesc()));
		
		StringBuilder text = new StringBuilder();
		//sacrifice
		text.append(RunesOfWizardry.proxy.translate(References.Lang.SACRIFICE)+"\n");
		ItemStack[] items = insc.getChargeItems();
		if(items!=null){
			for(ItemStack s:items){
				text.append("-"+(s.getCount()>=0? (s.getCount()<10?" ":"")+s.getCount()+"x " : RunesOfWizardry.proxy.translate(References.Lang.ANY_AMOUNT)+" ")+s.getDisplayName()+"\n");
			}
		}
		//extra sacrifice info
		String extraInfo = insc.getExtraChargeInfo();
		if(extraInfo!=null){
			text.append("  "+RunesOfWizardry.proxy.translate(extraInfo)+"\n");
		}else if(items==null){
			text.append("  "+RunesOfWizardry.proxy.translate(References.Lang.NOTHING)+"\n");
		}
		
		insEntry.addPageList(PageHelper.pagesForLongText(text.toString(),100));
		
		//TODO pattern + requirements
		insEntry.addPage(new PageText(RunesOfWizardry.proxy.translate(ENTRY_KEY+"see_rune", RunesOfWizardry.proxy.translate(insc.getName()))));
		
		entries.put(new ResourceLocation(insc.getName()), insEntry);
	}
	
	return entries;
}
 
开发者ID:Xilef11,项目名称:Runes-of-Wizardry,代码行数:44,代码来源:CategoryInscriptions.java


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