Beispiel #1
0
        /// <summary>
        /// Initializes statistic fields related to usable items and blocks.
        /// </summary>
        private static StatBase[] InitUsableStats(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)
                {
                    continue;
                }

                string s = StatCollector.TranslateToLocalFormatted(par1Str, new object[] { Item.ItemsList[i].GetStatName() });
                par0ArrayOfStatBase[i] = (new StatCrafting(par2 + i, s, i)).RegisterStat();

                if (i >= 256)
                {
                    ItemStats.Add((StatCrafting)par0ArrayOfStatBase[i]);
                }
            }

            ReplaceAllSimilarBlocks(par0ArrayOfStatBase);
            return(par0ArrayOfStatBase);
        }
Beispiel #2
0
 /// <summary>
 /// Represents a key or mouse button as a string. Args: key
 /// </summary>
 public static string GetKeyDisplayString(int par0)
 {
     if (par0 < 0)
     {
         return(StatCollector.TranslateToLocalFormatted("key.mouseButton", new object[] { par0 + 101 }));
     }
     else
     {
         return(((Keys)par0).ToString());
     }
 }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        protected void GenAchievementBackground(int par1, int par2, float par3)
        {
            int i = MathHelper2.Floor_double(Field_27116_m + (GuiMapX - Field_27116_m) * (double)par3);
            int j = MathHelper2.Floor_double(Field_27115_n + (GuiMapY - Field_27115_n) * (double)par3);

            if (i < guiMapTop)
            {
                i = guiMapTop;
            }

            if (j < guiMapLeft)
            {
                j = guiMapLeft;
            }

            if (i >= guiMapBottom)
            {
                i = guiMapBottom - 1;
            }

            if (j >= guiMapRight)
            {
                j = guiMapRight - 1;
            }

            int k  = Mc.RenderEngineOld.GetTexture("/terrain.png");
            int l  = Mc.RenderEngineOld.GetTexture("/achievement/bg.png");
            int i1 = (Width - AchievementsPaneWidth) / 2;
            int j1 = (Height - AchievementsPaneHeight) / 2;
            int k1 = i1 + 16;
            int l1 = j1 + 17;

            ZLevel = 0.0F;
            //GL.DepthFunc(DepthFunction.Gequal);
            //GL.PushMatrix();
            //GL.Translate(0.0F, 0.0F, -200F);
            //GL.Enable(EnableCap.Texture2D);
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.RescaleNormal);
            //GL.Enable(EnableCap.ColorMaterial);
            Mc.RenderEngineOld.BindTexture(k);
            int    i2     = i + 288 >> 4;
            int    j2     = j + 288 >> 4;
            int    k2     = (i + 288) % 16;
            int    l2     = (j + 288) % 16;
            Random random = new Random();

            for (int i3 = 0; i3 * 16 - l2 < 155; i3++)
            {
                float f = 0.6F - ((float)(j2 + i3) / 25F) * 0.3F;
                //GL.Color4(f, f, f, 1.0F);

                for (int k3 = 0; k3 * 16 - k2 < 224; k3++)
                {
                    random = new Random(1234 + i2 + k3);
                    random.Next();
                    int j4 = random.Next(1 + j2 + i3) + (j2 + i3) / 2;
                    int l4 = Block.Sand.BlockIndexInTexture;

                    if (j4 > 37 || j2 + i3 == 35)
                    {
                        l4 = Block.Bedrock.BlockIndexInTexture;
                    }
                    else if (j4 == 22)
                    {
                        if (random.Next(2) == 0)
                        {
                            l4 = Block.OreDiamond.BlockIndexInTexture;
                        }
                        else
                        {
                            l4 = Block.OreRedstone.BlockIndexInTexture;
                        }
                    }
                    else if (j4 == 10)
                    {
                        l4 = Block.OreIron.BlockIndexInTexture;
                    }
                    else if (j4 == 8)
                    {
                        l4 = Block.OreCoal.BlockIndexInTexture;
                    }
                    else if (j4 > 4)
                    {
                        l4 = Block.Stone.BlockIndexInTexture;
                    }
                    else if (j4 > 0)
                    {
                        l4 = Block.Dirt.BlockIndexInTexture;
                    }

                    DrawTexturedModalRect((k1 + k3 * 16) - k2, (l1 + i3 * 16) - l2, l4 % 16 << 4, (l4 >> 4) << 4, 16, 16);
                }
            }

            //GL.Enable(EnableCap.DepthTest);
            //GL.DepthFunc(DepthFunction.Lequal);
            //GL.Disable(EnableCap.Texture2D);

            for (int j3 = 0; j3 < AchievementList.Achievements.Count; j3++)
            {
                Achievement achievement1 = (Achievement)AchievementList.Achievements[j3];

                if (achievement1.ParentAchievement == null)
                {
                    continue;
                }

                int  l3    = (achievement1.DisplayColumn * 24 - i) + 11 + k1;
                int  k4    = (achievement1.DisplayRow * 24 - j) + 11 + l1;
                int  i5    = (achievement1.ParentAchievement.DisplayColumn * 24 - i) + 11 + k1;
                int  l5    = (achievement1.ParentAchievement.DisplayRow * 24 - j) + 11 + l1;
                bool flag  = statFileWriter.HasAchievementUnlocked(achievement1);
                bool flag1 = statFileWriter.CanUnlockAchievement(achievement1);
                int  c     = Math.Sin(((double)(JavaHelper.CurrentTimeMillis() % 600L) / 600D) * Math.PI * 2D) <= 0.59999999999999998D ? 202 : 377;
                long i8    = 0xff000000;

                if (flag)
                {
                    i8 = 0xff707070;
                }
                else if (flag1)
                {
                    i8 = 65280 + (c << 24);
                }

                DrawHorizontalLine(l3, i5, k4, (int)i8);
                DrawVerticalLine(i5, k4, l5, (int)i8);
            }

            Achievement achievement = null;
            RenderItem  renderitem  = new RenderItem();

            RenderHelper.EnableGUIStandardItemLighting();
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.RescaleNormal);
            //GL.Enable(EnableCap.ColorMaterial);

            for (int i4 = 0; i4 < AchievementList.Achievements.Count; i4++)
            {
                Achievement achievement2 = (Achievement)AchievementList.Achievements[i4];
                int         j5           = achievement2.DisplayColumn * 24 - i;
                int         i6           = achievement2.DisplayRow * 24 - j;

                if (j5 < -24 || i6 < -24 || j5 > 224 || i6 > 155)
                {
                    continue;
                }

                if (statFileWriter.HasAchievementUnlocked(achievement2))
                {
                    float f1 = 1.0F;
                    //GL.Color4(f1, f1, f1, 1.0F);
                }
                else if (statFileWriter.CanUnlockAchievement(achievement2))
                {
                    float f2 = Math.Sin(((double)(JavaHelper.CurrentTimeMillis() % 600L) / 600D) * Math.PI * 2D) >= 0.59999999999999998D ? 0.8F : 0.6F;
                    //GL.Color4(f2, f2, f2, 1.0F);
                }
                else
                {
                    float f3 = 0.3F;
                    //GL.Color4(f3, f3, f3, 1.0F);
                }

                Mc.RenderEngineOld.BindTexture(l);
                int k6 = k1 + j5;
                int j7 = l1 + i6;

                if (achievement2.GetSpecial())
                {
                    DrawTexturedModalRect(k6 - 2, j7 - 2, 26, 202, 26, 26);
                }
                else
                {
                    DrawTexturedModalRect(k6 - 2, j7 - 2, 0, 202, 26, 26);
                }

                if (!statFileWriter.CanUnlockAchievement(achievement2))
                {
                    float f4 = 0.1F;
                    //GL.Color4(f4, f4, f4, 1.0F);
                    renderitem.Field_27004_a = false;
                }

                //GL.Enable(EnableCap.Lighting);
                //GL.Enable(EnableCap.CullFace);
                renderitem.RenderItemIntoGUI(Mc.FontRenderer, Mc.RenderEngineOld, achievement2.TheItemStack, k6 + 3, j7 + 3);
                //GL.Disable(EnableCap.Lighting);

                if (!statFileWriter.CanUnlockAchievement(achievement2))
                {
                    renderitem.Field_27004_a = true;
                }

                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);

                if (par1 >= k1 && par2 >= l1 && par1 < k1 + 224 && par2 < l1 + 155 && par1 >= k6 && par1 <= k6 + 22 && par2 >= j7 && par2 <= j7 + 22)
                {
                    achievement = achievement2;
                }
            }

            //GL.Disable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Blend);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            Mc.RenderEngineOld.BindTexture(l);
            DrawTexturedModalRect(i1, j1, 0, 0, AchievementsPaneWidth, AchievementsPaneHeight);
            //GL.PopMatrix();
            ZLevel = 0.0F;
            //GL.DepthFunc(DepthFunction.Lequal);
            //GL.Disable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Texture2D);
            base.DrawScreen(par1, par2, par3);

            if (achievement != null)
            {
                string s  = StatCollector.TranslateToLocal(achievement.GetName());
                string s1 = achievement.GetDescription();
                int    k5 = par1 + 12;
                int    j6 = par2 - 4;

                if (statFileWriter.CanUnlockAchievement(achievement))
                {
                    int l6 = Math.Max(FontRenderer.GetStringWidth(s), 120);
                    int k7 = FontRenderer.SplitStringWidth(s1, l6);

                    if (statFileWriter.HasAchievementUnlocked(achievement))
                    {
                        k7 += 12;
                    }

                    DrawGradientRect(k5 - 3, j6 - 3, k5 + l6 + 3, j6 + k7 + 3 + 12, 0xc000000, 0xc000000);
                    FontRenderer.DrawSplitString(s1, k5, j6 + 12, l6, 0xffa0a0a);

                    if (statFileWriter.HasAchievementUnlocked(achievement))
                    {
                        FontRenderer.DrawStringWithShadow(StatCollector.TranslateToLocal("achievement.taken"), k5, j6 + k7 + 4, 0xff9090f);
                    }
                }
                else
                {
                    int    i7 = Math.Max(FontRenderer.GetStringWidth(s), 120);
                    string s2 = StatCollector.TranslateToLocalFormatted("achievement.requires", new Object[]
                    {
                        StatCollector.TranslateToLocal(achievement.ParentAchievement.GetName())
                    });
                    int l7 = FontRenderer.SplitStringWidth(s2, i7);
                    DrawGradientRect(k5 - 3, j6 - 3, k5 + i7 + 3, j6 + l7 + 12 + 3, 0xc000000, 0xc000000);
                    FontRenderer.DrawSplitString(s2, k5, j6 + 12, i7, 0xff70505);
                }

                FontRenderer.DrawStringWithShadow(s, k5, j6, statFileWriter.CanUnlockAchievement(achievement) ? achievement.GetSpecial() ? -128 : -1 : achievement.GetSpecial() ? 0xff80804 : 0xff80808);
            }

            //GL.Enable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Lighting);
            RenderHelper.DisableStandardItemLighting();
        }