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


Java PotionEffect.getPotion方法代碼示例

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


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

示例1: applyEffects

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public void applyEffects(EntityLivingBase target, EntityLivingBase source, EntityLivingBase indirectsource) {
    for (CaskPotionEffect effect : effects)
    {
        PotionEffect potioneffect = effect.potionEffect;
        PotionEffect currentStack = target.getActivePotionEffect(potioneffect.getPotion());
        if (potioneffect.getPotion().isInstant())
        {
            potioneffect.getPotion().affectEntity(source, indirectsource, target, potioneffect.getAmplifier(), 1.0D);
        }
        else
        {
            int amplifier = currentStack.getAmplifier();
            int duration = currentStack.getDuration();
            if(currentStack != null)
            {
                amplifier = Math.min(amplifier + currentStack.getAmplifier() + 1,effect.maxStack);
                if(amplifier != currentStack.getAmplifier())
                    duration += currentStack.getDuration();
            }
            PotionEffect newStack = new PotionEffect(potioneffect.getPotion(),duration,amplifier,false,false); //TODO: curative item?? alchemical hangover cure???
            target.addPotionEffect(newStack);
        }
    }
}
 
開發者ID:DaedalusGame,項目名稱:Soot,代碼行數:25,代碼來源:CaskManager.java

示例2: handleBounty

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@SubscribeEvent
public void handleBounty(LootingLevelEvent event) {
	EntityLivingBase target = event.getEntityLiving();
	EntityLivingBase attacker = target.getAttackingEntity();
	if (attacker instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) attacker;
		Collection<PotionEffect> potions = player.getActivePotionEffects();
		for (PotionEffect potion : potions) {
			if (potion.getPotion() instanceof PotionHunt) {
				PotionHunt huntPotion = (PotionHunt) potion.getPotion();
				if (huntPotion.appliesTo(target)) {
					event.setLootingLevel(event.getLootingLevel() + 2);

					return;
				}
			}
		}
	}
}
 
開發者ID:TeamMelodium,項目名稱:Melodium,代碼行數:20,代碼來源:SongHunt.java

示例3: updateActivePotionEffects

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
protected void updateActivePotionEffects()
{
    boolean hasVisibleEffect = false;
    for(PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) {
        Potion potion = potioneffect.getPotion();
        if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; }
    }
    if (this.mc.thePlayer.getActivePotionEffects().isEmpty() || !hasVisibleEffect)
    {
        this.guiLeft = (this.width - this.xSize) / 2;
        this.hasActivePotionEffects = false;
    }
    else
    {
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) this.guiLeft = (this.width - this.xSize) / 2; else
        this.guiLeft = 160 + (this.width - this.xSize - 200) / 2;
        this.hasActivePotionEffects = true;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:InventoryEffectRenderer.java

示例4: copyBrew

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
private Object copyBrew(Object brew) {
	if (brew instanceof PotionEffect) {
		PotionEffect potion = (PotionEffect) brew;
		return new PotionEffect(potion.getPotion(), potion.getDuration(), potion.getAmplifier());
	}
	return ((BrewEffect) brew).copy();
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:8,代碼來源:TileCauldron.java

示例5: hasEffect

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public static boolean hasEffect(ItemStack stack, Potion potion)
{
	for(PotionEffect effect : PotionUtils.getEffectsFromStack(stack))
		if(effect.getPotion() == potion)
			return true;
		
	return false;
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12-OF,代碼行數:9,代碼來源:InventoryUtils.java

示例6: isPotionApplicable

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
    if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
    {
        Potion potion = potioneffectIn.getPotion();

        if (potion == MobEffects.REGENERATION || potion == MobEffects.POISON)
        {
            return false;
        }
    }

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

示例7: onChangedPotionEffect

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
protected void onChangedPotionEffect(PotionEffect id, boolean p_70695_2_)
{
    this.potionsNeedUpdate = true;

    if (p_70695_2_ && !this.world.isRemote)
    {
        Potion potion = id.getPotion();
        potion.removeAttributesModifiersFromEntity(this, this.getAttributeMap(), id.getAmplifier());
        potion.applyAttributesModifiersToEntity(this, this.getAttributeMap(), id.getAmplifier());
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:12,代碼來源:EntityLivingBase.java

示例8: onChangedPotionEffect

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
protected void onChangedPotionEffect(PotionEffect id, boolean p_70695_2_)
{
    this.potionsNeedUpdate = true;

    if (p_70695_2_ && !this.worldObj.isRemote)
    {
        Potion potion = id.getPotion();
        potion.removeAttributesModifiersFromEntity(this, this.getAttributeMap(), id.getAmplifier());
        potion.applyAttributesModifiersToEntity(this, this.getAttributeMap(), id.getAmplifier());
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:12,代碼來源:EntityLivingBase.java

示例9: 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

示例10: renderXDolfOverlay

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public void renderXDolfOverlay() {

		if(Wrapper.getMinecraft().gameSettings.showDebugInfo || hideGui || Wrapper.getMinecraft().currentScreen instanceof GuiChat) return;
		
		int width = Client.gameResolution.getScaledWidth();
		int height = Client.gameResolution.getScaledHeight();

		Fonts.roboto18.drawStringWithShadow("Xdolf", 2, 0, 0x55FF55);
		int count = 0;
		try {
			for(Module mod: Hacks.display) {
				int x2 = width - (Fonts.roboto18.getStringWidth(mod.getName()));
				int y = (10 * count);
				Fonts.roboto18.drawStringWithShadow(mod.getName(), x2 - 2, y, 0xffffff);
				count++;
			}
		} catch (Exception ex) {}


		Collection<PotionEffect> var4 = Wrapper.getPlayer().getActivePotionEffects();

		if (!var4.isEmpty()) {
			final ResourceLocation var5 = new ResourceLocation("textures/gui/container/inventory.png");
			int var6 = -23;
			int count2 = 0;

			for (PotionEffect potioneffect : Ordering.natural().sortedCopy(var4)) {
				count2++;
				Potion var9 = potioneffect.getPotion();
				Wrapper.getMinecraft().renderEngine.bindTexture(var5);

				String s1 = I18n.format(var9.getName(), new Object[0]);

				if (potioneffect.getAmplifier() == 1) {
					s1 = s1 + " II";
				} else if (potioneffect.getAmplifier() == 2) {
					s1 = s1 + " III";
				} else if (potioneffect.getAmplifier() == 3) {
					s1 = s1 + " IV";
				}

				String var11 = Potion.getPotionDurationString(potioneffect, 1.0F);
				int var14 = width -Fonts.roboto18.getStringWidth(s1) - 2 - 20;
				int var16 = width - (Fonts.roboto18.getStringWidth(var11) / 2) - 4 - 20;

				if (var9.hasStatusIcon()) {
					int var10 = var9.getStatusIconIndex();
					this.drawTexturedModalRect(width - 20, height - (count2 * 20), 0 + var10 % 8 * 18,
							198 + var10 / 8 * 18, 18, 18);
				}

				Fonts.roboto18.drawStringWithShadow(s1, var14, height - (count2 * 20),
						16777215);
				var14 = width - Fonts.roboto18.getStringWidth(var11) - 2;
				Fonts.roboto18.drawStringWithShadow(var11, (var16) - 8,
						height + 10 - (count2 * 20), 8355711);
			}
		}
		
		for(XdolfWindow window: XdolfGuiClick.windowList) {
			if(!(Wrapper.getMinecraft().currentScreen instanceof XdolfGuiClick)) {
				if(window.isPinned()) {
					window.draw(0, 0);
				}
			}
		}
	}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:68,代碼來源:XDolfOverlay.java

示例11: func_190543_a

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
private void func_190543_a(RayTraceResult p_190543_1_, List<PotionEffect> p_190543_2_)
{
    AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D);
    List<EntityLivingBase> list = this.world.<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);

    if (!list.isEmpty())
    {
        for (EntityLivingBase entitylivingbase : list)
        {
            if (entitylivingbase.canBeHitWithPotion())
            {
                double d0 = this.getDistanceSqToEntity(entitylivingbase);

                if (d0 < 16.0D)
                {
                    double d1 = 1.0D - Math.sqrt(d0) / 4.0D;

                    if (entitylivingbase == p_190543_1_.entityHit)
                    {
                        d1 = 1.0D;
                    }

                    for (PotionEffect potioneffect : p_190543_2_)
                    {
                        Potion potion = potioneffect.getPotion();

                        if (potion.isInstant())
                        {
                            potion.affectEntity(this, this.getThrower(), entitylivingbase, potioneffect.getAmplifier(), d1);
                        }
                        else
                        {
                            int i = (int)(d1 * (double)potioneffect.getDuration() + 0.5D);

                            if (i > 20)
                            {
                                entitylivingbase.addPotionEffect(new PotionEffect(potion, i, potioneffect.getAmplifier(), potioneffect.getIsAmbient(), potioneffect.doesShowParticles()));
                            }
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:46,代碼來源:EntityPotion.java

示例12: isPotionApplicable

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
    return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:5,代碼來源:EntitySpider.java

示例13: drawActivePotionEffects

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
 * Display the potion effects list
 */
private void drawActivePotionEffects()
{
    int i = this.guiLeft - 124;
    int j = this.guiTop;
    int k = 166;
    Collection<PotionEffect> collection = this.mc.player.getActivePotionEffects();

    if (!collection.isEmpty())
    {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableLighting();
        int l = 33;

        if (collection.size() > 5)
        {
            l = 132 / (collection.size() - 1);
        }

        for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection))
        {
            Potion potion = potioneffect.getPotion();
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            this.mc.getTextureManager().bindTexture(INVENTORY_BACKGROUND);
            this.drawTexturedModalRect(i, j, 0, 166, 140, 32);

            if (potion.hasStatusIcon())
            {
                int i1 = potion.getStatusIconIndex();
                this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
            }

            String s1 = I18n.format(potion.getName(), new Object[0]);

            if (potioneffect.getAmplifier() == 1)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.2", new Object[0]);
            }
            else if (potioneffect.getAmplifier() == 2)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.3", new Object[0]);
            }
            else if (potioneffect.getAmplifier() == 3)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.4", new Object[0]);
            }

            this.fontRendererObj.drawStringWithShadow(s1, (float)(i + 10 + 18), (float)(j + 6), 16777215);
            String s = Potion.getPotionDurationString(potioneffect, 1.0F);
            this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711);
            j += l;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:57,代碼來源:InventoryEffectRenderer.java

示例14: isPotionApplicable

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public boolean isPotionApplicable(PotionEffect potioneffectIn)
  {
return potioneffectIn.getPotion() == TF2weapons.stun;
  }
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:5,代碼來源:EntityBuilding.java

示例15: onFinishedPotionEffect

import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
protected void onFinishedPotionEffect(PotionEffect effect)
  {
super.onFinishedPotionEffect(effect);
if(effect.getPotion()==TF2weapons.charging)
	this.moveAttack.setDodge(true, false);
  }
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:7,代碼來源:EntityDemoman.java


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