當前位置: 首頁>>代碼示例>>Java>>正文


Java TooltipFlags類代碼示例

本文整理匯總了Java中net.minecraft.client.util.ITooltipFlag.TooltipFlags的典型用法代碼示例。如果您正苦於以下問題:Java TooltipFlags類的具體用法?Java TooltipFlags怎麽用?Java TooltipFlags使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TooltipFlags類屬於net.minecraft.client.util.ITooltipFlag包,在下文中一共展示了TooltipFlags類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawItemTooltip

import net.minecraft.client.util.ITooltipFlag.TooltipFlags; //導入依賴的package包/類
private void drawItemTooltip(int x, int y, ItemStack stack, boolean warn)
{
	if (stack == null)
	{
		return;
	}

	List<String> lines = new ArrayList<>();

	boolean adv = Minecraft.getMinecraft().gameSettings.advancedItemTooltips;
	int id = Item.getIdFromItem(stack.getItem());
	lines.addAll(stack.getTooltip(container.getOpeningPlayer(), adv ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL));
	lines.set(0, lines.get(0) + " " + id);

	if (warn)
	{
		lines.add(ChatUtil.RED + I18n.format("container.craftingdouble.warning"));
	}

	drawHoveringText(lines, x, y); //Draw tooltip
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:22,代碼來源:GuiDoubleWorkbench.java

示例2: itemDisplayNameMultiline

import net.minecraft.client.util.ITooltipFlag.TooltipFlags; //導入依賴的package包/類
/**
 * Extra lines are often used for more information. For example enchantments, potion effects and mob spawner contents.
 *
 * @param itemstack       The item to get the name for.
 * @param gui             An instance of the currentscreen passed to tooltip handlers. If null, only gui inspecific handlers should respond
 * @param includeHandlers If true tooltip handlers will add to the item tip
 * @return A list of Strings representing the text to be displayed on each line of the tool tip.
 */
public static List<String> itemDisplayNameMultiline(ItemStack itemstack, GuiContainer gui, boolean includeHandlers) {
    List<String> namelist = null;
    try {
        namelist = itemstack.getTooltip(Minecraft.getMinecraft().player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL);
    } catch (Throwable ignored) {
    }

    if (namelist == null) {
        namelist = new ArrayList<>();
    }

    if (namelist.size() == 0) {
        namelist.add("Unnamed");
    }

    if (namelist.get(0) == null || namelist.get(0).equals("")) {
        namelist.set(0, "Unnamed");
    }

    if (includeHandlers) {
        for (IContainerTooltipHandler handler : NEIClientEventHandler.tooltipHandlers) {
            handler.handleItemDisplayName(gui, itemstack, namelist);
        }
    }

    namelist.set(0, itemstack.getRarity().rarityColor.toString() + namelist.get(0));
    for (int i = 1; i < namelist.size(); i++) {
        namelist.set(i, "\u00a77" + namelist.get(i));
    }

    return namelist;
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:41,代碼來源:GuiHelper.java

示例3: drawPage

import net.minecraft.client.util.ITooltipFlag.TooltipFlags; //導入依賴的package包/類
private void drawPage(NecronomiconRitual ritual, int x, int y){
	int k = (width - guiWidth) / 2;
	byte b0 = 2;
	String title = ritual.getLocalizedName();
	fontRenderer.drawSplitString(title, k + 20, b0 + 16, 116, 0xC40000);

	if(ritual.requiresSacrifice())
		fontRenderer.drawSplitString(localize(NecronomiconText.LABEL_SACRIFICE), k + 138, 164, 107, 0xC40000);
	writeText(1, localize(NecronomiconText.LABEL_REQUIRED_ENERGY) + ": " + ritual.getReqEnergy() + " PE", 125);
	writeText(2, localize(NecronomiconText.LABEL_LOCATION) + ": " + getDimension(ritual.getDimension()));
	if(!ritual.getDescription().startsWith("ac.ritual."))
		writeText(2, ritual.getDescription(), 48);
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	mc.renderEngine.bindTexture(NecronomiconResources.RITUAL);
	drawTexturedModalRect(k, b0, 0, 0, 256, 256);
	if(ritual.getSacrifice() != null){
		mc.renderEngine.bindTexture(NecronomiconResources.RITUAL_INFUSION);
		drawTexturedModalRect(k, b0, 0, 0, 256, 256);
	} if(ritual instanceof NecronomiconCreationRitual){
		mc.renderEngine.bindTexture(NecronomiconResources.RITUAL_CREATION);
		drawTexturedModalRect(k, b0, 0, 0, 256, 256);
	}

	tooltipStack = null;

	ItemStack[] offerings = new ItemStack[8];
	if(ritual.getOfferings().length < 8)
		for(int i = 0; i < ritual.getOfferings().length; i++)
			offerings[i] = APIUtils.convertToStack(ritual.getOfferings()[i]);
	else offerings = getStacks(ritual.getOfferings());

	//north
	renderItem(k + 58, b0 + 30, offerings[0], x, y);
	//north-east
	renderItem(k + 84, b0 + 40, offerings[1], x, y);
	//east
	renderItem(k + 94, b0 + 66, offerings[2], x, y);
	//south-east
	renderItem(k + 84, b0 + 92, offerings[3], x, y);
	//south
	renderItem(k + 58, b0 + 103, offerings[4], x, y);
	//south-west
	renderItem(k + 32, b0 + 92, offerings[5], x, y);
	//west
	renderItem(k + 22, b0 + 66, offerings[6], x, y);
	//north-west
	renderItem(k + 32, b0 + 40, offerings[7], x, y);
	//center
	renderItem(k + 58, b0 + 66, APIUtils.convertToStack(ritual.getSacrifice()), x, y);

	if(ritual instanceof NecronomiconCreationRitual)
		renderItem(k + 58, b0 + 139, ((NecronomiconCreationRitual) ritual).getItem(), x, y);

	if(tooltipStack != null)
	{
		List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().player, TooltipFlags.NORMAL);
		List<String> parsedTooltip = new ArrayList();
		boolean first = true;

		for(String s : tooltipData)
		{
			String s_ = s;
			if(!first)
				s_ = TextFormatting.GRAY + s;
			parsedTooltip.add(s_);
			first = false;
		}
		GuiRenderHelper.renderTooltip(x, y, parsedTooltip);
	}
}
 
開發者ID:Shinoow,項目名稱:AbyssalCraft,代碼行數:71,代碼來源:GuiNecronomiconRitualEntry.java


注:本文中的net.minecraft.client.util.ITooltipFlag.TooltipFlags類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。