protected String handleVariables(String text, MOGuideEntry entry) { return text.replace( "$itemName", formatVariableReplace( "$itemName", ((entry.getStackIcons().length > 0 && entry.getStackIcons()[0] != null) ? entry.getStackIcons()[0].getDisplayName() : entry.getDisplayName()))); }
@Override public void onClick(GuiDataPad guiDataPad) { MOGuideEntry entry; if (guideEntryName != null) { entry = MatterOverdriveGuide.findGuide(guideEntryName); } else { entry = MatterOverdriveGuide.findGuide(stack.getUnlocalizedName()); } if (entry != null) { ((GuiDataPad) gui).getGuideDescription().OpenGuide(entry.getId(), page, true); } }
protected TextChunk handleShortCode(Map<String, String> shortcodeMap) { if (shortcodeMap.get("type").equalsIgnoreCase("block") || shortcodeMap.get("type").equalsIgnoreCase("item")) { ItemStack stack = shortCodeToStack(shortcodeMap); if (stack != null) { String guideName = shortcodeMap.containsKey("guide") ? shortcodeMap.get("guide") : null; int guidePage = shortcodeMap.containsKey("page") ? Integer.parseInt(shortcodeMap.get("page")) : 0; return new ItemstackTextLinkChunk( EnumChatFormatting.GREEN + stack.getDisplayName() + EnumChatFormatting.RESET, getFontRenderer(), stack, guideName, guidePage); } } else if (shortcodeMap.get("type").equalsIgnoreCase("rf")) { if (shortcodeMap.containsKey("itemType")) shortcodeMap.put("type", shortcodeMap.get("itemType")); ItemStack stack = shortCodeToStack(shortcodeMap); if (stack != null && stack.getItem() != null && stack.getItem() instanceof IEnergyContainerItem) { return new TextChunk( ((IEnergyContainerItem) stack.getItem()).getMaxEnergyStored(stack) + MOEnergyHelper.ENERGY_UNIT, getFontRenderer()); } } else if (shortcodeMap.get("type").equalsIgnoreCase("guide")) { MOGuideEntry entry = MatterOverdriveGuide.findGuide(shortcodeMap.get("name")); if (entry != null) { int page = shortcodeMap.containsKey("page") ? Integer.parseInt(shortcodeMap.get("page")) : 0; return new GuideTextLinkChunk( EnumChatFormatting.YELLOW + entry.getDisplayName() + EnumChatFormatting.RESET, getFontRenderer(), entry, page); } } return null; }
protected TextChunk handleShortCode(Map<String, String> shortcodeMap) { if (shortcodeMap.get("type").equalsIgnoreCase("block") || shortcodeMap.get("type").equalsIgnoreCase("item")) { ItemStack stack = shortCodeToStack(shortcodeMap); if (stack != null) { return new ItemstackTextLinkChunk( EnumChatFormatting.GREEN + stack.getDisplayName() + EnumChatFormatting.RESET, getFontRenderer(), stack); } } else if (shortcodeMap.get("type").equalsIgnoreCase("guide")) { MOGuideEntry entry = MatterOverdriveGuide.findGuide(shortcodeMap.get("name")); if (entry != null) { return new GuideTextLinkChunk( EnumChatFormatting.YELLOW + entry.getDisplayName() + EnumChatFormatting.RESET, getFontRenderer(), entry); } } return null; }
@Override public void onClick(GuiDataPad guiDataPad) { ((GuiDataPad) gui).getGuideDescription().OpenGuide(entry.getId(), page, true); }