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


Java ItemStack.getTooltip方法代码示例

本文整理汇总了Java中net.minecraft.item.ItemStack.getTooltip方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.getTooltip方法的具体用法?Java ItemStack.getTooltip怎么用?Java ItemStack.getTooltip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.item.ItemStack的用法示例。


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

示例1: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
protected void renderToolTip(ItemStack stack, int x, int y) {
	List<String> list = stack.getTooltip(EasyMappings.player(), mc.gameSettings.advancedItemTooltips);

	for (int i = 0; i < list.size(); ++i) {
		if (i == 0) {
			list.set(i, stack.getRarity().rarityColor + list.get(i));
		}
		else {
			list.set(i, TextFormatting.GRAY + list.get(i));
		}
	}
	Slot s = getSlotAtPos(x, y);
	if (s != null && s instanceof SlotDankNull && s.getHasStack() && s.getStack().getCount() > 1000) {
		list.add(1, TextFormatting.GRAY + "" + TextFormatting.ITALIC + "Count: " + s.getStack().getCount());
	}

	net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);
	GuiUtils.drawToolTipWithBorderColor(this, list, x, y, DankNullUtils.getColor(DankNullUtils.getDankNull(player).getItemDamage(), true), DankNullUtils.getColor(DankNullUtils.getDankNull(player).getItemDamage(), false));
	net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:22,代码来源:GuiDankNull.java

示例2: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y)
{
    List<String> list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);

    for (int i = 0; i < list.size(); ++i)
    {
        if (i == 0)
        {
            list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
        }
        else
        {
            list.set(i, EnumChatFormatting.GRAY + (String)list.get(i));
        }
    }

    this.drawHoveringText(list, x, y);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:GuiScreen.java

示例3: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void renderToolTip(ItemStack stack, int x, int y) {
    Minecraft mc = Minecraft.getMinecraft();
    List<String> list = stack.getTooltip(MinecraftTools.getPlayer(mc), mc.gameSettings.advancedItemTooltips);

    for (int i = 0; i < list.size(); ++i) {
        if (i == 0) {
            list.set(i, stack.getRarity().rarityColor + list.get(i));
        } else {
            list.set(i, TextFormatting.GRAY + list.get(i));
        }
    }

    FontRenderer font = stack.getItem().getFontRenderer(stack);
    net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);
    FontRenderer font1 = (font == null ? mc.fontRenderer : font);
    net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, x, y, 600, 500, -1, font1);
    net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
}
 
开发者ID:McJty,项目名称:Lector,代码行数:19,代码来源:RenderElementItem.java

示例4: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y)
{
    List<String> list = stack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips);

    for (int i = 0; i < list.size(); ++i)
    {
        if (i == 0)
        {
            list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
        }
        else
        {
            list.set(i, TextFormatting.GRAY + (String)list.get(i));
        }
    }

    this.drawHoveringText(list, x, y);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:GuiScreen.java

示例5: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y)
{
    List<String> list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);

    for (int i = 0; i < list.size(); ++i)
    {
        if (i == 0)
        {
            list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
        }
        else
        {
            list.set(i, TextFormatting.GRAY + (String)list.get(i));
        }
    }

    FontRenderer font = stack.getItem().getFontRenderer(stack);
    net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);
    this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
    net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:GuiScreen.java

示例6: updateFilteredItems

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative)
{
    if (CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex] == CreativeTabs.SEARCH) // FORGE: Only add enchanted books to the regular search
    for (Enchantment enchantment : Enchantment.REGISTRY)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.ENCHANTED_BOOK.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }
    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase();

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips))
        {
            if (TextFormatting.getTextWithoutFormattingCodes(s).toLowerCase().contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:37,代码来源:GuiContainerCreative.java

示例7: SearchEntry

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public SearchEntry(ItemStack stack){
    this.stack = stack;
    List<String> t = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
    tooltip = StringUtils.join(t, "\n").toLowerCase();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:6,代码来源:GuiSearcher.java

示例8: updateCreativeSearch

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    for (Item item : Item.itemRegistry)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }

    for (Enchantment enchantment : Enchantment.enchantmentsBookList)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }

    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase();

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips))
        {
            if (EnumChatFormatting.getTextWithoutFormattingCodes(s).toLowerCase().contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:48,代码来源:GuiContainerCreative.java

示例9: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y)
{
    if (selectedTabIndex == CreativeTabs.tabAllSearch.getTabIndex())
    {
        List<String> list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
        CreativeTabs creativetabs = stack.getItem().getCreativeTab();

        if (creativetabs == null && stack.getItem() == Items.enchanted_book)
        {
            Map<Integer, Integer> map = EnchantmentHelper.getEnchantments(stack);

            if (map.size() == 1)
            {
                Enchantment enchantment = Enchantment.getEnchantmentById(((Integer)map.keySet().iterator().next()).intValue());

                for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray)
                {
                    if (creativetabs1.hasRelevantEnchantmentType(enchantment.type))
                    {
                        creativetabs = creativetabs1;
                        break;
                    }
                }
            }
        }

        if (creativetabs != null)
        {
            list.add(1, "" + EnumChatFormatting.BOLD + EnumChatFormatting.BLUE + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
        }

        for (int i = 0; i < list.size(); ++i)
        {
            if (i == 0)
            {
                list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
            }
            else
            {
                list.set(i, EnumChatFormatting.GRAY + (String)list.get(i));
            }
        }

        this.drawHoveringText(list, x, y);
    }
    else
    {
        super.renderToolTip(stack, x, y);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:51,代码来源:GuiContainerCreative.java

示例10: updateCreativeSearch

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }

    for (Enchantment enchantment : Enchantment.REGISTRY)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.ENCHANTED_BOOK.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }

    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase(Locale.ROOT);

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips))
        {
            if (TextFormatting.getTextWithoutFormattingCodes(s).toLowerCase(Locale.ROOT).contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:48,代码来源:GuiContainerCreative.java

示例11: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y)
{
    if (selectedTabIndex == CreativeTabs.SEARCH.getTabIndex())
    {
        List<String> list = stack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips);
        CreativeTabs creativetabs = stack.getItem().getCreativeTab();

        if (creativetabs == null && stack.getItem() == Items.ENCHANTED_BOOK)
        {
            Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack);

            if (map.size() == 1)
            {
                Enchantment enchantment = (Enchantment)map.keySet().iterator().next();

                for (CreativeTabs creativetabs1 : CreativeTabs.CREATIVE_TAB_ARRAY)
                {
                    if (creativetabs1.hasRelevantEnchantmentType(enchantment.type))
                    {
                        creativetabs = creativetabs1;
                        break;
                    }
                }
            }
        }

        if (creativetabs != null)
        {
            list.add(1, "" + TextFormatting.BOLD + TextFormatting.BLUE + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
        }

        for (int i = 0; i < list.size(); ++i)
        {
            if (i == 0)
            {
                list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
            }
            else
            {
                list.set(i, TextFormatting.GRAY + (String)list.get(i));
            }
        }

        this.drawHoveringText(list, x, y);
    }
    else
    {
        super.renderToolTip(stack, x, y);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:51,代码来源:GuiContainerCreative.java

示例12: renderToolTip

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderToolTip(ItemStack stack, int x, int y)
{
    if (selectedTabIndex == CreativeTabs.SEARCH.getTabIndex())
    {
        List<String> list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
        CreativeTabs creativetabs = stack.getItem().getCreativeTab();

        if (creativetabs == null && stack.getItem() == Items.ENCHANTED_BOOK)
        {
            Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack);

            if (map.size() == 1)
            {
                Enchantment enchantment = (Enchantment)map.keySet().iterator().next();

                for (CreativeTabs creativetabs1 : CreativeTabs.CREATIVE_TAB_ARRAY)
                {
                    if (creativetabs1.hasRelevantEnchantmentType(enchantment.type))
                    {
                        creativetabs = creativetabs1;
                        break;
                    }
                }
            }
        }

        if (creativetabs != null)
        {
            list.add(1, "" + TextFormatting.BOLD + TextFormatting.BLUE + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
        }

        for (int i = 0; i < list.size(); ++i)
        {
            if (i == 0)
            {
                list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
            }
            else
            {
                list.set(i, TextFormatting.GRAY + (String)list.get(i));
            }
        }

        net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);
        this.drawHoveringText(list, x, y);
        net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
    }
    else
    {
        super.renderToolTip(stack, x, y);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:53,代码来源:GuiContainerCreative.java


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