當前位置: 首頁>>代碼示例>>Java>>正文


Java PotionEffect.getIsAmbient方法代碼示例

本文整理匯總了Java中net.minecraft.potion.PotionEffect.getIsAmbient方法的典型用法代碼示例。如果您正苦於以下問題:Java PotionEffect.getIsAmbient方法的具體用法?Java PotionEffect.getIsAmbient怎麽用?Java PotionEffect.getIsAmbient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.potion.PotionEffect的用法示例。


在下文中一共展示了PotionEffect.getIsAmbient方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onItemUse

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@SubscribeEvent
public void onItemUse(LivingEntityUseItemEvent event)
{
    EntityLivingBase living = event.getEntityLiving();
    ItemStack stack = event.getItem();
    PotionEffect effect = living.getActivePotionEffect(this);

    if(ItemUtil.matchesOreDict(stack,"torch") && effect != null)
    {
        //TODO: Blow a cloud of fire out
        if(effect.getDuration() > 10)
        {
            PotionEffect reducedEffect = new PotionEffect(this, effect.getDuration() - 5, effect.getAmplifier(), effect.getIsAmbient(), effect.doesShowParticles());
            reducedEffect.setCurativeItems(effect.getCurativeItems());
            living.addPotionEffect(reducedEffect);
        }
        else
        {
            living.removePotionEffect(this);
        }
    }
}
 
開發者ID:DaedalusGame,項目名稱:Soot,代碼行數:23,代碼來源:PotionFireLung.java

示例2: areAllPotionsAmbient

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
 * Returns true if all of the potion effects in the specified collection are ambient.
 */
public static boolean areAllPotionsAmbient(Collection<PotionEffect> potionEffects)
{
    for (PotionEffect potioneffect : potionEffects)
    {
        if (!potioneffect.getIsAmbient())
        {
            return false;
        }
    }

    return true;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:EntityLivingBase.java

示例3: SPacketEntityEffect

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public SPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
    this.entityId = entityIdIn;
    this.effectId = (byte)(Potion.getIdFromPotion(effect.getPotion()) & 255);
    this.amplifier = (byte)(effect.getAmplifier() & 255);

    if (effect.getDuration() > 32767)
    {
        this.duration = 32767;
    }
    else
    {
        this.duration = effect.getDuration();
    }

    this.flags = 0;

    if (effect.getIsAmbient())
    {
        this.flags = (byte)(this.flags | 1);
    }

    if (effect.doesShowParticles())
    {
        this.flags = (byte)(this.flags | 2);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:28,代碼來源:SPacketEntityEffect.java

示例4: renderPotionEffects

import net.minecraft.potion.PotionEffect; //導入方法依賴的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.PotionEffect.getIsAmbient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。