本文整理汇总了Java中net.minecraft.creativetab.CreativeTabs.hasRelevantEnchantmentType方法的典型用法代码示例。如果您正苦于以下问题:Java CreativeTabs.hasRelevantEnchantmentType方法的具体用法?Java CreativeTabs.hasRelevantEnchantmentType怎么用?Java CreativeTabs.hasRelevantEnchantmentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.creativetab.CreativeTabs
的用法示例。
在下文中一共展示了CreativeTabs.hasRelevantEnchantmentType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderToolTip
import net.minecraft.creativetab.CreativeTabs; //导入方法依赖的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);
}
}
示例2: renderToolTip
import net.minecraft.creativetab.CreativeTabs; //导入方法依赖的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);
}
}
示例3: renderToolTip
import net.minecraft.creativetab.CreativeTabs; //导入方法依赖的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);
}
}