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


Java Potion.shouldRenderHUD方法代码示例

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


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

示例1: renderPotionEffects

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
protected void renderPotionEffects(ScaledResolution resolution)
{
    Collection<PotionEffect> collection = this.mc.thePlayer.getActivePotionEffects();

    if (!collection.isEmpty())
    {
        this.mc.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND);
        GlStateManager.enableBlend();
        int i = 0;
        int j = 0;

        for (PotionEffect potioneffect : Ordering.natural().reverse().sortedCopy(collection))
        {
            Potion potion = potioneffect.getPotion();

            if (!potion.shouldRenderHUD(potioneffect)) continue;
            // Rebind in case previous renderHUDEffect changed texture
            this.mc.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND);
            if (potioneffect.doesShowParticles())
            {
                int k = resolution.getScaledWidth();
                int l = 1;
                int i1 = potion.getStatusIconIndex();

                if (potion.isBeneficial())
                {
                    ++i;
                    k = k - 25 * i;
                }
                else
                {
                    ++j;
                    k = k - 25 * j;
                    l += 26;
                }

                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                float f = 1.0F;

                if (potioneffect.getIsAmbient())
                {
                    this.drawTexturedModalRect(k, l, 165, 166, 24, 24);
                }
                else
                {
                    this.drawTexturedModalRect(k, l, 141, 166, 24, 24);

                    if (potioneffect.getDuration() <= 200)
                    {
                        int j1 = 10 - potioneffect.getDuration() / 20;
                        f = MathHelper.clamp_float((float)potioneffect.getDuration() / 10.0F / 5.0F * 0.5F, 0.0F, 0.5F) + MathHelper.cos((float)potioneffect.getDuration() * (float)Math.PI / 5.0F) * MathHelper.clamp_float((float)j1 / 10.0F * 0.25F, 0.0F, 0.25F);
                    }
                }

                GlStateManager.color(1.0F, 1.0F, 1.0F, f);
                // FORGE - Move status icon check down from above so renderHUDEffect will still be called without a status icon
                if (potion.hasStatusIcon())
                this.drawTexturedModalRect(k + 3, l + 3, i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
                potion.renderHUDEffect(k, l, potioneffect, mc, f);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:64,代码来源:GuiIngame.java


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