Java Code Examples for net.minecraft.potion.PotionEffect.getAmplifier()

The following are Jave code examples for showing how to use getAmplifier() of the net.minecraft.potion.PotionEffect class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Soot   File: CaskManager.java   Source Code and License Vote up 6 votes
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);
        }
    }
}
 
Example 2
Project: Soot   File: PotionFireLung.java   Source Code and License Vote up 6 votes
@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);
        }
    }
}
 
Example 3
Project: DecompiledMinecraft   File: EntityLivingBase.java   Source Code and License Vote up 6 votes
public void fall(float distance, float damageMultiplier)
{
    super.fall(distance, damageMultiplier);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier);

    if (i > 0)
    {
        this.playSound(this.getFallSoundString(i), 1.0F, 1.0F);
        this.attackEntityFrom(DamageSource.fall, (float)i);
        int j = MathHelper.floor_double(this.posX);
        int k = MathHelper.floor_double(this.posY - 0.20000000298023224D);
        int l = MathHelper.floor_double(this.posZ);
        Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock();

        if (block.getMaterial() != Material.air)
        {
            Block.SoundType block$soundtype = block.stepSound;
            this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
        }
    }
}
 
Example 4
Project: DecompiledMinecraft   File: EntityLivingBase.java   Source Code and License Vote up 6 votes
public void fall(float distance, float damageMultiplier)
{
    super.fall(distance, damageMultiplier);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier);

    if (i > 0)
    {
        this.playSound(this.getFallSoundString(i), 1.0F, 1.0F);
        this.attackEntityFrom(DamageSource.fall, (float)i);
        int j = MathHelper.floor_double(this.posX);
        int k = MathHelper.floor_double(this.posY - 0.20000000298023224D);
        int l = MathHelper.floor_double(this.posZ);
        Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock();

        if (block.getMaterial() != Material.air)
        {
            Block.SoundType block$soundtype = block.stepSound;
            this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
        }
    }
}
 
Example 5
Project: DecompiledMinecraft   File: S1DPacketEntityEffect.java   Source Code and License Vote up 6 votes
public S1DPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
    this.entityId = entityIdIn;
    this.effectId = (byte)(effect.getPotionID() & 255);
    this.amplifier = (byte)(effect.getAmplifier() & 255);

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

    this.hideParticles = (byte)(effect.getIsShowParticles() ? 1 : 0);
}
 
Example 6
Project: BaseClient   File: EntityLivingBase.java   Source Code and License Vote up 6 votes
public void fall(float distance, float damageMultiplier)
{
    super.fall(distance, damageMultiplier);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier);

    if (i > 0)
    {
        this.playSound(this.getFallSoundString(i), 1.0F, 1.0F);
        this.attackEntityFrom(DamageSource.fall, (float)i);
        int j = MathHelper.floor_double(this.posX);
        int k = MathHelper.floor_double(this.posY - 0.20000000298023224D);
        int l = MathHelper.floor_double(this.posZ);
        Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock();

        if (block.getMaterial() != Material.air)
        {
            Block.SoundType block$soundtype = block.stepSound;
            this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
        }
    }
}
 
Example 7
Project: BaseClient   File: S1DPacketEntityEffect.java   Source Code and License Vote up 6 votes
public S1DPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
    this.entityId = entityIdIn;
    this.effectId = (byte)(effect.getPotionID() & 255);
    this.amplifier = (byte)(effect.getAmplifier() & 255);

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

    this.hideParticles = (byte)(effect.getIsShowParticles() ? 1 : 0);
}
 
Example 8
Project: BaseClient   File: S1DPacketEntityEffect.java   Source Code and License Vote up 6 votes
public S1DPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
    this.entityId = entityIdIn;
    this.effectId = (byte)(effect.getPotionID() & 255);
    this.amplifier = (byte)(effect.getAmplifier() & 255);

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

    this.hideParticles = (byte)(effect.getIsShowParticles() ? 1 : 0);
}
 
Example 9
Project: Backmemed   File: EntityLivingBase.java   Source Code and License Vote up 6 votes
public void fall(float distance, float damageMultiplier)
{
    super.fall(distance, damageMultiplier);
    PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.JUMP_BOOST);
    float f = potioneffect == null ? 0.0F : (float)(potioneffect.getAmplifier() + 1);
    int i = MathHelper.ceil((distance - 3.0F - f) * damageMultiplier);

    if (i > 0)
    {
        this.playSound(this.getFallSound(i), 1.0F, 1.0F);
        this.attackEntityFrom(DamageSource.fall, (float)i);
        int j = MathHelper.floor(this.posX);
        int k = MathHelper.floor(this.posY - 0.20000000298023224D);
        int l = MathHelper.floor(this.posZ);
        IBlockState iblockstate = this.world.getBlockState(new BlockPos(j, k, l));

        if (iblockstate.getMaterial() != Material.AIR)
        {
            SoundType soundtype = iblockstate.getBlock().getSoundType();
            this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
        }
    }
}
 
Example 10
Project: Bewitchment   File: TileCauldron.java   Source Code and License Vote up 5 votes
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();
}
 
Example 11
Project: Backmemed   File: SPacketEntityEffect.java   Source Code and License Vote up 5 votes
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);
    }
}
 
Example 12
Project: CustomWorldGen   File: SPacketEntityEffect.java   Source Code and License Vote up 5 votes
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);
    }
}
 
Example 13
Project: Soot   File: MiscUtil.java   Source Code and License Vote up 4 votes
@SideOnly(Side.CLIENT)
public static void addPotionEffectTooltip(List<PotionEffect> list, List<String> lores, float durationFactor)
{
    List<Tuple<String, AttributeModifier>> attributeModifiers = Lists.newArrayList();

    if (list.isEmpty())
    {
        String s = I18n.translateToLocal("effect.none").trim();
        lores.add(TextFormatting.GRAY + s);
    }
    else
    {
        for (PotionEffect potioneffect : list)
        {
            String s1 = I18n.translateToLocal(potioneffect.getEffectName()).trim();
            Potion potion = potioneffect.getPotion();
            Map<IAttribute, AttributeModifier> map = potion.getAttributeModifierMap();

            if (!map.isEmpty())
            {
                for (Map.Entry<IAttribute, AttributeModifier> entry : map.entrySet())
                {
                    AttributeModifier attributemodifier = entry.getValue();
                    AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAttributeModifierAmount(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
                    attributeModifiers.add(new Tuple(((IAttribute)entry.getKey()).getName(), attributemodifier1));
                }
            }

            if (potioneffect.getAmplifier() > 0)
            {
                s1 = s1 + " " + I18n.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
            }

            if (potioneffect.getDuration() > 20)
            {
                s1 = s1 + " (" + Potion.getPotionDurationString(potioneffect, durationFactor) + ")";
            }

            if (potion.isBadEffect())
            {
                lores.add(TextFormatting.RED + s1);
            }
            else
            {
                lores.add(TextFormatting.BLUE + s1);
            }
        }
    }

    if (!attributeModifiers.isEmpty())
    {
        lores.add("");
        lores.add(TextFormatting.DARK_PURPLE + I18n.translateToLocal("potion.whenDrank"));

        for (Tuple<String, AttributeModifier> tuple : attributeModifiers)
        {
            AttributeModifier attributemodifier2 = tuple.getSecond();
            double d0 = attributemodifier2.getAmount();
            double d1;

            if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2)
            {
                d1 = attributemodifier2.getAmount();
            }
            else
            {
                d1 = attributemodifier2.getAmount() * 100.0D;
            }

            if (d0 > 0.0D)
            {
                lores.add(TextFormatting.BLUE + I18n.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.translateToLocal("attribute.name." + (String)tuple.getFirst())));
            }
            else if (d0 < 0.0D)
            {
                d1 = d1 * -1.0D;
                lores.add(TextFormatting.RED + I18n.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.translateToLocal("attribute.name." + (String)tuple.getFirst())));
            }
        }
    }
}
 
Example 14
Project: CustomWorldGen   File: InventoryEffectRenderer.java   Source Code and License Vote up 4 votes
/**
 * 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.thePlayer.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();
            if(!potion.shouldRender(potioneffect)) continue;
            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);
            }

            potion.renderInventoryEffect(i, j, potioneffect, mc);
            if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; }
            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;
        }
    }
}
 
Example 15
Project: DecompiledMinecraft   File: InventoryEffectRenderer.java   Source Code and License Vote up 4 votes
/**
 * 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.thePlayer.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 : this.mc.thePlayer.getActivePotionEffects())
        {
            Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            this.mc.getTextureManager().bindTexture(inventoryBackground);
            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.getDurationString(potioneffect);
            this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711);
            j += l;
        }
    }
}
 
Example 16
Project: BaseClient   File: InventoryEffectRenderer.java   Source Code and License Vote up 4 votes
/**
 * 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.thePlayer.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 : this.mc.thePlayer.getActivePotionEffects())
        {
            Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            this.mc.getTextureManager().bindTexture(inventoryBackground);
            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.getDurationString(potioneffect);
            this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711);
            j += l;
        }
    }
}
 
Example 17
Project: BaseClient   File: DrawPotions.java   Source Code and License Vote up 4 votes
@EventTarget
public void onRender(EventRender2D e) {
	if (!client.getManagers().getManager(SettingManager.class).getSetting(HUD.class, "PotionEffect").getBooleanValue()) {

		int x = e.width - 20;
		for (PotionEffect p : Minecraft.getMinecraft().thePlayer.getActivePotionEffects()) {
			Potion potion = Potion.potionTypes[p.getPotionID()];
			GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
			if (potion.hasStatusIcon()) {
				RenderUtils.drawFullCircle(x + 5, e.height - 11, 10, ColorUtils.backColor);
				RenderUtils.drawCircle(x + 5, e.height - 11, 10, ColorUtils.arrayColor);
				GL11.glColor4f(1, 1, 1, 1);

				GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
				GlStateManager.disableLighting();

				int i1 = potion.getStatusIconIndex();
				GL11.glScalef((float) 0.8f, (float) 0.8f, (float) 0.8f);
				GlStateManager.enableBlend();
				GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
				Minecraft.getMinecraft().getTextureManager().bindTexture(inventoryBackground);
				Gui.drawTexturedModalRect1((int) (x * 1.25f) - 2, (int) (e.height * 1.25f) - 23, 0 + i1 % 8 * 18,
						198 + i1 / 8 * 18, 18, 18);
				GL11.glScalef((float) 1.25f, (float) 1.25f, (float) 1.25f);
				GlStateManager.disableBlend();

				int i = p.getDuration() / 20;
				int j = i / 60;
				i = i % 60;
				String time = (String) (i < 10 ? j + ":0" + i : j + ":" + i);

				arraylist.drawStringWithShadow(time, x - arraylist.getStringWidth(time) + 12,
						e.height - arraylist.getHeight() - 2, -1);
				if (p.getAmplifier() != 0)
				arraylist.drawStringWithShadow((p.getAmplifier() + 1) + "",
						x - arraylist.getStringWidth((p.getAmplifier() + 1) + "") + 7,
						e.height - arraylist.getHeight() - 13, -1);
			}

			if (Minecraft.getMinecraft().thePlayer.getActivePotionEffects().size() > 5)
				x -= 90 / (Minecraft.getMinecraft().thePlayer.getActivePotionEffects().size() - 1);
			else
				x -= 24;
		}
	}
}
 
Example 18
Project: Mods   File: EntityTF2Boss.java   Source Code and License Vote up 4 votes
public boolean isPotionApplicable(PotionEffect potioneffectIn)
  {
return potioneffectIn.getPotion() == TF2weapons.stun && potioneffectIn.getAmplifier()>=3;
  }
 
Example 19
Project: connor41-etfuturum2   File: LingeringPotion.java   Source Code and License Vote up 4 votes
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isComplex) {
	if (stack.getItemDamage() == 0)
		return;

	List<PotionEffect> effects = getEffects(stack);
	HashMultimap<String, AttributeModifier> attributes = HashMultimap.create();

	if (effects == null || effects.isEmpty()) {
		String s = StatCollector.translateToLocal("potion.empty").trim();
		list.add(EnumChatFormatting.GRAY + s);
	} else
		for (PotionEffect potioneffect : effects) {
			String s1 = StatCollector.translateToLocal(potioneffect.getEffectName()).trim();
			Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
			Map<IAttribute, AttributeModifier> map = potion.func_111186_k();

			if (map != null && map.size() > 0)
				for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
					AttributeModifier attributemodifier = entry.getValue();
					AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
					attributes.put(entry.getKey().getAttributeUnlocalizedName(), attributemodifier1);
				}

			if (potioneffect.getAmplifier() > 0)
				s1 = s1 + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
			if (potioneffect.getDuration() > 20)
				s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")";

			if (potion.isBadEffect())
				list.add(EnumChatFormatting.RED + s1);
			else
				list.add(EnumChatFormatting.GRAY + s1);
		}

	if (!attributes.isEmpty()) {
		list.add("");
		list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank"));

		for (Entry<String, AttributeModifier> entry1 : attributes.entries()) {
			AttributeModifier attributemodifier2 = entry1.getValue();
			double d0 = attributemodifier2.getAmount();
			double d1;

			if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2)
				d1 = attributemodifier2.getAmount();
			else
				d1 = attributemodifier2.getAmount() * 100.0D;

			if (d0 > 0.0D)
				list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
			else if (d0 < 0.0D) {
				d1 *= -1.0D;
				list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
			}
		}
	}
}
 
Example 20
Project: Backmemed   File: XDolfOverlay.java   Source Code and License Vote up 4 votes
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);
				}
			}
		}
	}