本文整理匯總了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);
}
}