/// <summary>
        /// Displays debuff/potion effects that are currently being applied to the player
        /// </summary>
        private void DisplayDebuffEffects()
        {
            int i = GuiLeft - 124;
            int j = GuiTop;
            int k = Mc.RenderEngineOld.GetTexture("/gui/inventory.png");
            ICollection <PotionEffect> collection = Mc.ThePlayer.GetActivePotionEffects();

            if (collection.Count == 0)
            {
                return;
            }

            int l = 33;

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

            for (IEnumerator <PotionEffect> iterator = Mc.ThePlayer.GetActivePotionEffects().GetEnumerator(); iterator.MoveNext();)
            {
                PotionEffect potioneffect = iterator.Current;
                Potion       potion       = Potion.PotionTypes[potioneffect.GetPotionID()];
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                Mc.RenderEngineOld.BindTexture(k);
                DrawTexturedModalRect(i, j, 0, YSize, 140, 32);

                if (potion.HasStatusIcon())
                {
                    int i1 = potion.GetStatusIconIndex();
                    DrawTexturedModalRect(i + 6, j + 7, 0 + (i1 % 8) * 18, YSize + 32 + (i1 / 8) * 18, 18, 18);
                }

                string s = StatCollector.TranslateToLocal(potion.GetName());

                if (potioneffect.GetAmplifier() == 1)
                {
                    s = (new StringBuilder()).Append(s).Append(" II").ToString();
                }
                else if (potioneffect.GetAmplifier() == 2)
                {
                    s = (new StringBuilder()).Append(s).Append(" III").ToString();
                }
                else if (potioneffect.GetAmplifier() == 3)
                {
                    s = (new StringBuilder()).Append(s).Append(" IV").ToString();
                }

                FontRenderer.DrawStringWithShadow(s, i + 10 + 18, j + 6, 0xffffff);
                string s1 = Potion.GetDurationString(potioneffect);
                FontRenderer.DrawStringWithShadow(s1, i + 10 + 18, j + 6 + 10, 0x7f7f7f);
                j += l;
            }
        }
Exemple #2
0
        public static int Func_40354_a(ICollection <PotionEffect> par0Collection)
        {
            int i = 0x385dc6;

            if (par0Collection == null || par0Collection.Count == 0)
            {
                return(i);
            }

            float f  = 0.0F;
            float f1 = 0.0F;
            float f2 = 0.0F;
            float f3 = 0.0F;

            for (IEnumerator <PotionEffect> iterator = par0Collection.GetEnumerator(); iterator.MoveNext();)
            {
                PotionEffect potioneffect = iterator.Current;
                int          j            = Potion.PotionTypes[potioneffect.GetPotionID()].GetLiquidColor();
                int          k            = 0;

                while (k <= potioneffect.GetAmplifier())
                {
                    f  += (float)(j >> 16 & 0xff) / 255F;
                    f1 += (float)(j >> 8 & 0xff) / 255F;
                    f2 += (float)(j >> 0 & 0xff) / 255F;
                    f3++;
                    k++;
                }
            }

            f  = (f / f3) * 255F;
            f1 = (f1 / f3) * 255F;
            f2 = (f2 / f3) * 255F;
            return((int)f << 16 | (int)f1 << 8 | (int)f2);
        }
Exemple #3
0
        /// <summary>
        /// allows items to add custom lines of information to the mouseover description
        /// </summary>
        public virtual void AddInformation(ItemStack par1ItemStack, List <string> par2List)
        {
            if (par1ItemStack.GetItemDamage() == 0)
            {
                return;
            }

            List <PotionEffect> list = Item.Potion.GetEffects(par1ItemStack);

            if (list != null && list.Count > 0)
            {
                for (IEnumerator <PotionEffect> iterator = list.GetEnumerator(); iterator.MoveNext();)
                {
                    PotionEffect potioneffect = iterator.Current;
                    string       s1           = StatCollector.TranslateToLocal(potioneffect.GetEffectName()).Trim();

                    if (potioneffect.GetAmplifier() > 0)
                    {
                        s1 = (new StringBuilder()).Append(s1).Append(" ").Append(StatCollector.TranslateToLocal((new StringBuilder()).Append("potion.potency.").Append(potioneffect.GetAmplifier()).ToString()).Trim()).ToString();
                    }

                    if (potioneffect.GetDuration() > 20)
                    {
                        s1 = (new StringBuilder()).Append(s1).Append(" (").Append(net.minecraft.src.Potion.GetDurationString(potioneffect)).Append(")").ToString();
                    }

                    if (net.minecraft.src.Potion.PotionTypes[potioneffect.GetPotionID()].IsBadEffect())
                    {
                        par2List.Add((new StringBuilder()).Append((char)0xa7 + "c").Append(s1).ToString());
                    }
                    else
                    {
                        par2List.Add((new StringBuilder()).Append((char)0xa7 + "7").Append(s1).ToString());
                    }
                }
            }
            else
            {
                string s = StatCollector.TranslateToLocal("potion.empty").Trim();
                par2List.Add((new StringBuilder()).Append((char)0xa7).Append(s).ToString());
            }
        }
        /// <summary>
        /// Called when the throwable hits a block or entity.
        /// </summary>
        protected override void OnImpact(MovingObjectPosition par1MovingObjectPosition)
        {
            if (!WorldObj.IsRemote)
            {
                List <PotionEffect> list = Item.Potion.GetEffects(PotionDamage);

                if (list != null && list.Count > 0)
                {
                    AxisAlignedBB axisalignedbb = BoundingBox.Expand(4, 2, 4);
                    List <Entity> list1         = WorldObj.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityLiving), axisalignedbb);

                    if (list1 != null && list1.Count > 0)
                    {
                        for (IEnumerator <Entity> iterator = list1.GetEnumerator(); iterator.MoveNext();)
                        {
                            Entity entity = iterator.Current;
                            double d      = GetDistanceSqToEntity(entity);

                            if (d < 16D)
                            {
                                double d1 = 1.0D - Math.Sqrt(d) / 4D;

                                if (entity == par1MovingObjectPosition.EntityHit)
                                {
                                    d1 = 1.0D;
                                }

                                IEnumerator <PotionEffect> iterator1 = list.GetEnumerator();

                                while (iterator1.MoveNext())
                                {
                                    PotionEffect potioneffect = iterator1.Current;
                                    int          i            = potioneffect.GetPotionID();

                                    if (Potion.PotionTypes[i].IsInstant())
                                    {
                                        Potion.PotionTypes[i].AffectEntity(Thrower, (EntityLiving)entity, potioneffect.GetAmplifier(), d1);
                                    }
                                    else
                                    {
                                        int j = (int)(d1 * (double)potioneffect.GetDuration() + 0.5D);

                                        if (j > 20)
                                        {
                                            ((EntityLiving)entity).AddPotionEffect(new PotionEffect(i, j, potioneffect.GetAmplifier()));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                WorldObj.PlayAuxSFX(2002, (int)Math.Round(PosX), (int)Math.Round(PosY), (int)Math.Round(PosZ), PotionDamage);
                SetDead();
            }
        }