當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。