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


Java HoverEvent.getAction方法代码示例

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


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

示例1: drawScreen

import net.minecraft.event.HoverEvent; //导入方法依赖的package包/类
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();
    super.drawScreen(mouseX, mouseY, partialTicks);

    if (!orderPressed || isSure)
    {
        for (TextFieldDetails field : this.fields)
        {
            if (loginMode)
            {
                if (field.getId() < 2)
                {
                    field.drawTextBox();
                }
            }
            else
            {
                field.drawTextBox();
            }
        }

        if (loginMode)
        {
            if (loggingIn)
            {
                this.drawCenteredString(fontRendererObj, Util.localize("details.login"), this.width / 2, (this.height / 2) - 20, 0xFFFFFF);
            }
            else if (!loggingInError.isEmpty())
            {
                this.drawCenteredString(fontRendererObj, Util.localize("details.loginerror") + loggingInError, this.width / 2, (this.height / 2) - 20, 0xFFFFFF);
            }
            else if (loggedIn)
            {
                this.drawCenteredString(fontRendererObj, Util.localize("details.loginsuccess"), this.width / 2, (this.height / 2) - 20, 0xFFFFFF);
            }
            else
            {
                this.drawCenteredString(fontRendererObj, Util.localize("details.accountexists"), this.width / 2, (this.height / 2) - 20, 0xFFFFFF);
            }
        }
    }
    else
    {
        int info2Start = (this.height / 2) - 50;

        this.drawCenteredString(fontRendererObj, Util.localize("order.info1"), this.width / 2, (this.height / 2) - 60, 0xFFFFFF);
        this.drawCenteredString(fontRendererObj, info2.getFormattedText(), this.width / 2, (this.height / 2) - 50, 0xFFFFFF);
        this.drawCenteredString(fontRendererObj, Util.localize("order.info3"), this.width / 2, (this.height / 2) - 30, 0xFFFFFF);
        this.drawCenteredString(fontRendererObj, Util.localize("order.info4"), this.width / 2, (this.height / 2) - 20, 0xFFFFFF);

        if (mouseY >= info2Start && mouseY <= info2Start + fontRendererObj.FONT_HEIGHT)
        {
            IChatComponent component = getComponent(mouseX, mouseY);

            if (component != null)
            {
                HoverEvent event = component.getChatStyle().getChatHoverEvent();
                if (event != null)
                    if (event.getAction() == HoverEvent.Action.SHOW_TEXT)
                        this.func_146283_a(Splitter.on("\n").splitToList(event.getValue().getFormattedText()), mouseX, mouseY);
            }
        }
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:67,代码来源:GuiPersonalDetails.java

示例2: drawScreen

import net.minecraft.event.HoverEvent; //导入方法依赖的package包/类
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    this.inputField.drawTextBox();
    IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().func_146236_a(Mouse.getX(), Mouse.getY());

    if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null)
    {
        HoverEvent hoverevent = ichatcomponent.getChatStyle().getChatHoverEvent();

        if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM)
        {
            ItemStack itemstack = null;

            try
            {
                NBTBase nbtbase = JsonToNBT.func_150315_a(hoverevent.getValue().getUnformattedText());

                if (nbtbase != null && nbtbase instanceof NBTTagCompound)
                {
                    itemstack = ItemStack.loadItemStackFromNBT((NBTTagCompound)nbtbase);
                }
            }
            catch (NBTException nbtexception)
            {
                ;
            }

            if (itemstack != null)
            {
                this.renderToolTip(itemstack, p_73863_1_, p_73863_2_);
            }
            else
            {
                this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Item!", p_73863_1_, p_73863_2_);
            }
        }
        else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT)
        {
            this.func_146283_a(Splitter.on("\n").splitToList(hoverevent.getValue().getFormattedText()), p_73863_1_, p_73863_2_);
        }
        else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT)
        {
            StatBase statbase = StatList.func_151177_a(hoverevent.getValue().getUnformattedText());

            if (statbase != null)
            {
                IChatComponent ichatcomponent1 = statbase.func_150951_e();
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"), new Object[0]);
                chatcomponenttranslation.getChatStyle().setItalic(Boolean.valueOf(true));
                String s = statbase instanceof Achievement ? ((Achievement)statbase).getDescription() : null;
                ArrayList arraylist = Lists.newArrayList(new String[] {ichatcomponent1.getFormattedText(), chatcomponenttranslation.getFormattedText()});

                if (s != null)
                {
                    arraylist.addAll(this.fontRendererObj.listFormattedStringToWidth(s, 150));
                }

                this.func_146283_a(arraylist, p_73863_1_, p_73863_2_);
            }
            else
            {
                this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid statistic/achievement!", p_73863_1_, p_73863_2_);
            }
        }

        GL11.glDisable(GL11.GL_LIGHTING);
    }

    super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
 
开发者ID:jackey8616,项目名称:Age-of-Kingdom,代码行数:75,代码来源:GuiAokChat.java

示例3: drawScreen

import net.minecraft.event.HoverEvent; //导入方法依赖的package包/类
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int par1, int par2, float par3)
{
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    this.field_146415_a.drawTextBox();
    IChatComponent var4 = this.mc.ingameGUI.getChatGUI().func_146236_a(Mouse.getX(), Mouse.getY());

    if (var4 != null && var4.getChatStyle().getChatHoverEvent() != null)
    {
        HoverEvent var5 = var4.getChatStyle().getChatHoverEvent();

        if (var5.getAction() == HoverEvent.Action.SHOW_ITEM)
        {
            ItemStack var6 = null;

            try
            {
                NBTBase var7 = JsonToNBT.func_150315_a(var5.getValue().getUnformattedText());

                if (var7 != null && var7 instanceof NBTTagCompound)
                {
                    var6 = ItemStack.loadItemStackFromNBT((NBTTagCompound)var7);
                }
            }
            catch (NBTException var11)
            {
                ;
            }

            if (var6 != null)
            {
                this.func_146285_a(var6, par1, par2);
            }
            else
            {
                this.func_146279_a(EnumChatFormatting.RED + "Invalid Item!", par1, par2);
            }
        }
        else if (var5.getAction() == HoverEvent.Action.SHOW_TEXT)
        {
            this.func_146279_a(var5.getValue().getFormattedText(), par1, par2);
        }
        else if (var5.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT)
        {
            StatBase var13 = StatList.func_151177_a(var5.getValue().getUnformattedText());

            if (var13 != null)
            {
                IChatComponent var12 = var13.func_150951_e();
                ChatComponentTranslation var8 = new ChatComponentTranslation("stats.tooltip.type." + (var13.isAchievement() ? "achievement" : "statistic"), new Object[0]);
                var8.getChatStyle().setItalic(Boolean.valueOf(true));
                String var9 = var13 instanceof Achievement ? ((Achievement)var13).getDescription() : null;
                ArrayList var10 = Lists.newArrayList(new String[] {var12.getFormattedText(), var8.getFormattedText()});

                if (var9 != null)
                {
                    var10.addAll(this.fontRendererObj.listFormattedStringToWidth(var9, 150));
                }

                this.func_146283_a(var10, par1, par2);
            }
            else
            {
                this.func_146279_a(EnumChatFormatting.RED + "Invalid statistic/achievement!", par1, par2);
            }
        }

        GL11.glDisable(GL11.GL_LIGHTING);
    }

    super.drawScreen(par1, par2, par3);
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:75,代码来源:GuiChat.java

示例4: drawScreen

import net.minecraft.event.HoverEvent; //导入方法依赖的package包/类
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    this.inputField.drawTextBox();
    IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().func_146236_a(Mouse.getX(), Mouse.getY());

    if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null)
    {
        HoverEvent hoverevent = ichatcomponent.getChatStyle().getChatHoverEvent();

        if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM)
        {
            ItemStack itemstack = null;

            try
            {
                NBTBase nbtbase = JsonToNBT.func_150315_a(hoverevent.getValue().getUnformattedText());

                if (nbtbase != null && nbtbase instanceof NBTTagCompound)
                {
                    itemstack = ItemStack.loadItemStackFromNBT((NBTTagCompound)nbtbase);
                }
            }
            catch (NBTException nbtexception)
            {
                ;
            }

            if (itemstack != null)
            {
                this.renderToolTip(itemstack, p_73863_1_, p_73863_2_);
            }
            else
            {
                this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Item!", p_73863_1_, p_73863_2_);
            }
        }
        else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT)
        {
            this.func_146283_a(Splitter.on("\n").splitToList(hoverevent.getValue().getFormattedText()), p_73863_1_, p_73863_2_);
        }
        else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT)
        {
            StatBase statbase = StatList.func_151177_a(hoverevent.getValue().getUnformattedText());

            if (statbase != null)
            {
                IChatComponent ichatcomponent1 = statbase.func_150951_e();
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"), new Object[0]);
                chatcomponenttranslation.getChatStyle().setItalic(Boolean.valueOf(true));
                String s = statbase instanceof Achievement ? ((Achievement)statbase).getDescription() : null;
                ArrayList arraylist = Lists.newArrayList(new String[] {ichatcomponent1.getFormattedText(), chatcomponenttranslation.getFormattedText()});

                if (s != null)
                {
                    arraylist.addAll(this.fontRendererObj.listFormattedStringToWidth(s, 150));
                }

                this.func_146283_a(arraylist, p_73863_1_, p_73863_2_);
            }
            else
            {
                this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid statistic/achievement!", p_73863_1_, p_73863_2_);
            }
        }

        GL11.glDisable(GL11.GL_LIGHTING);
    }

    super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:72,代码来源:GuiChat.java

示例5: drawScreen

import net.minecraft.event.HoverEvent; //导入方法依赖的package包/类
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int par1, int par2, float par3)
{
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    inputField.drawTextBox();
    IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().func_146236_a(Mouse.getX(), Mouse.getY());

    if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null)
    {
        HoverEvent hoverevent = ichatcomponent.getChatStyle().getChatHoverEvent();

        if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM)
        {
            ItemStack itemstack = null;

            try
            {
                NBTBase nbtbase = JsonToNBT.func_150315_a(hoverevent.getValue().getUnformattedText());

                if (nbtbase != null && nbtbase instanceof NBTTagCompound)
                {
                    itemstack = ItemStack.loadItemStackFromNBT((NBTTagCompound)nbtbase);
                }
            }
            catch (NBTException nbtexception)
            {
                ;
            }

            if (itemstack != null)
            {
                this.renderToolTip(itemstack, par1, par2);
            }
            else
            {
                this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Item!", par1, par2);
            }
        }
        else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT)
        {
            this.drawCreativeTabHoveringText(hoverevent.getValue().getFormattedText(), par1, par2);
        }
        else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT)
        {
            StatBase statbase = StatList.func_151177_a(hoverevent.getValue().getUnformattedText());

            if (statbase != null)
            {
                IChatComponent ichatcomponent1 = statbase.func_150951_e();
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"), new Object[0]);
                chatcomponenttranslation.getChatStyle().setItalic(Boolean.valueOf(true));
                String s = statbase instanceof Achievement ? ((Achievement)statbase).getDescription() : null;
                ArrayList<String> arraylist = Lists.newArrayList(new String[] {ichatcomponent1.getFormattedText(), chatcomponenttranslation.getFormattedText()});

                if (s != null)
                {
                    arraylist.addAll(this.fontRendererObj.listFormattedStringToWidth(s, 150));
                }

                this.func_146283_a(arraylist, par1, par2);
            }
            else
            {
                this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid statistic/achievement!", par1, par2);
            }
        }

        GL11.glDisable(GL11.GL_LIGHTING);
    }
    
    GuiChatHandler.drawScreenHandler();
    
    super.drawScreen(par1, par2, par3);
}
 
开发者ID:Shamboozle,项目名称:ChatSymbols,代码行数:77,代码来源:GuiChatReplace.java


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