当前位置: 首页>>代码示例>>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;未经允许,请勿转载。