Exemple #1
0
        protected override void DrawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator)
        {
            StatCrafting statcrafting = Func_27264_b(par1);
            int          i            = statcrafting.GetItemID();

            GuiStats.DrawItemSprite(Field_27275_a, par2 + 40, par3, i);
            Func_27265_a((StatCrafting)StatList.ObjectBreakStats[i], par2 + 115, par3, par1 % 2 == 0);
            Func_27265_a((StatCrafting)StatList.ObjectCraftStats[i], par2 + 165, par3, par1 % 2 == 0);
            Func_27265_a(statcrafting, par2 + 215, par3, par1 % 2 == 0);
        }
 protected void Func_27265_a(StatCrafting par1StatCrafting, int par2, int par3, bool par4)
 {
     if (par1StatCrafting != null)
     {
         string s = par1StatCrafting.Func_27084_a(GuiStats.GetStatsFileWriter(Field_27269_g).WriteStat(par1StatCrafting));
         Field_27269_g.DrawString(GuiStats.GetFontRenderer(Field_27269_g), s, par2 - (int)GuiStats.GetFontRenderer(Field_27269_g).GetStringWidth(s), par3 + 5, par4 ? 0xffffff : 0x909090);
     }
     else
     {
         string s1 = "-";
         Field_27269_g.DrawString(GuiStats.GetFontRenderer(Field_27269_g), s1, par2 - (int)GuiStats.GetFontRenderer(Field_27269_g).GetStringWidth(s1), par3 + 5, par4 ? 0xffffff : 0x909090);
     }
 }
        protected override void Func_27257_b(int par1, int par2)
        {
            if (par2 < Top || par2 > Bottom)
            {
                return;
            }
            int i = Func_27256_c(par1, par2);
            int j = Field_27269_g.Width / 2 - 92 - 16;

            if (i >= 0)
            {
                if (par1 < j + 40 || par1 > j + 40 + 20)
                {
                    return;
                }
                StatCrafting statcrafting = Func_27264_b(i);
                Func_27267_a(statcrafting, par1, par2);
            }
            else
            {
                string s = "";
                if (par1 >= (j + 115) - 18 && par1 <= j + 115)
                {
                    s = Func_27263_a(0);
                }
                else if (par1 >= (j + 165) - 18 && par1 <= j + 165)
                {
                    s = Func_27263_a(1);
                }
                else if (par1 >= (j + 215) - 18 && par1 <= j + 215)
                {
                    s = Func_27263_a(2);
                }
                else
                {
                    return;
                }
                s = (new StringBuilder()).Append("").Append(StringTranslate.GetInstance().TranslateKey(s)).ToString().Trim();
                if (s.Length > 0)
                {
                    int k  = par1 + 12;
                    int l  = par2 - 12;
                    int i1 = GuiStats.GetFontRenderer(Field_27269_g).GetStringWidth(s);
                    GuiStats.DrawGradientRect(Field_27269_g, k - 3, l - 3, k + i1 + 3, l + 8 + 3, 0xc000000, 0xc000000);
                    GuiStats.GetFontRenderer(Field_27269_g).DrawStringWithShadow(s, k, l, -1);
                }
            }
        }
        protected void Func_27267_a(StatCrafting par1StatCrafting, int par2, int par3)
        {
            if (par1StatCrafting == null)
            {
                return;
            }
            Item   item = Item.ItemsList[par1StatCrafting.GetItemID()];
            string s    = new StringBuilder().Append("").Append(StringTranslate.GetInstance().TranslateNamedKey(item.GetItemName())).ToString().Trim();

            if (s.Length > 0)
            {
                int i = par2 + 12;
                int j = par3 - 12;
                int k = GuiStats.GetFontRenderer(Field_27269_g).GetStringWidth(s);
                GuiStats.DrawGradientRect(Field_27269_g, i - 3, j - 3, i + k + 3, j + 8 + 3, 0xc000000, 0xc000000);
                GuiStats.GetFontRenderer(Field_27269_g).DrawStringWithShadow(s, i, j, -1);
            }
        }
Exemple #5
0
        private static StatBase[] InitBreakStats(StatBase[] par0ArrayOfStatBase, string par1Str, int par2, int par3, int par4)
        {
            if (par0ArrayOfStatBase == null)
            {
                par0ArrayOfStatBase = new StatBase[32000];
            }

            for (int i = par3; i < par4; i++)
            {
                if (Item.ItemsList[i] != null && Item.ItemsList[i].IsDamageable())
                {
                    string s = StatCollector.TranslateToLocalFormatted(par1Str, new object[] { Item.ItemsList[i].GetStatName() });
                    par0ArrayOfStatBase[i] = new StatCrafting(par2 + i, s, i).RegisterStat();
                }
            }

            ReplaceAllSimilarBlocks(par0ArrayOfStatBase);
            return(par0ArrayOfStatBase);
        }
Exemple #6
0
        /// <summary>
        /// Initializes statistic fields related to minable items and blocks.
        /// </summary>
        private static StatBase[] InitMinableStats(string par0Str, int par1)
        {
            StatBase[] astatbase = new StatBase[256];

            for (int i = 0; i < 256; i++)
            {
                var block = Block.BlocksList[i];

                if (block != null && block.GetEnableStats())
                {
                    string s = StatCollector.TranslateToLocalFormatted(par0Str, new object[] { Block.BlocksList[i].TranslateBlockName() });
                    astatbase[i] = new StatCrafting(par1 + i, s, i).RegisterStat();
                    ObjectMineStats.Add((StatCrafting)astatbase[i]);
                }
            }

            ReplaceAllSimilarBlocks(astatbase);
            return(astatbase);
        }
Exemple #7
0
        /// <summary>
        /// Initializes statistics related to craftable items. Is only called after both block and item stats have been
        /// initialized.
        /// </summary>
        public static void InitCraftableStats()
        {
            if (!BlockStatsInitialized || !ItemStatsInitialized)
            {
                return;
            }

            List <int> hashset = new List <int>();
            IRecipe    irecipe;

            for (IEnumerator <IRecipe> iterator = CraftingManager.GetInstance().GetRecipeList().GetEnumerator(); iterator.MoveNext(); hashset.Add(irecipe.GetRecipeOutput().ItemID))
            {
                irecipe = iterator.Current;
            }

            ItemStack itemstack;

            for (IEnumerator <ItemStack> iterator1 = FurnaceRecipes.Smelting().GetSmeltingList().Values.GetEnumerator(); iterator1.MoveNext(); hashset.Add(itemstack.ItemID))
            {
                itemstack = iterator1.Current;
            }

            ObjectCraftStats = new StatBase[32000];
            IEnumerator <int> iterator2 = hashset.GetEnumerator();

            do
            {
                if (!iterator2.MoveNext())
                {
                    break;
                }

                int integer = iterator2.Current;

                if (Item.ItemsList[(int)integer] != null)
                {
                    string s = StatCollector.TranslateToLocalFormatted("stat.craftItem", new object[] { Item.ItemsList[integer].GetStatName() });
                    ObjectCraftStats[integer] = new StatCrafting(0x1010000 + integer, s, integer).RegisterStat();
                }
            }while (true);

            ReplaceAllSimilarBlocks(ObjectCraftStats);
        }
Exemple #8
0
        public GuiSlotStatsItem(GuiStats par1GuiStats) : base(par1GuiStats)
        {
            Field_27275_a = par1GuiStats;
            Field_27273_c = new List <StatCrafting>();

            IEnumerator <StatCrafting> iterator = StatList.ItemStats.GetEnumerator();

            do
            {
                if (!iterator.MoveNext())
                {
                    break;
                }

                StatCrafting statcrafting = (StatCrafting)iterator.Current;
                bool         flag         = false;
                int          i            = statcrafting.GetItemID();

                if (GuiStats.GetStatsFileWriter(par1GuiStats).WriteStat(statcrafting) > 0)
                {
                    flag = true;
                }
                else if (StatList.ObjectBreakStats[i] != null && GuiStats.GetStatsFileWriter(par1GuiStats).WriteStat(StatList.ObjectBreakStats[i]) > 0)
                {
                    flag = true;
                }
                else if (StatList.ObjectCraftStats[i] != null && GuiStats.GetStatsFileWriter(par1GuiStats).WriteStat(StatList.ObjectCraftStats[i]) > 0)
                {
                    flag = true;
                }

                if (flag)
                {
                    Field_27273_c.Add(statcrafting);
                }
            }while (true);

            Field_27272_d = new SorterStatsItem(this, par1GuiStats);
        }