本文整理汇总了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
}
示例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;
}
示例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);
}
}