/// <summary>
        /// Adds the buttons (and other controls) to the screen in question.
        /// </summary>
        public override void InitGui()
        {
            ControlList.Clear();

            if (Mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled())
            {
                ControlList.Add(new GuiButton(1, Width / 2 - 100, Height / 4 + 96, StatCollector.TranslateToLocal("deathScreen.deleteWorld")));
            }
            else
            {
                ControlList.Add(new GuiButton(1, Width / 2 - 100, Height / 4 + 72, StatCollector.TranslateToLocal("deathScreen.respawn")));
                ControlList.Add(new GuiButton(2, Width / 2 - 100, Height / 4 + 96, StatCollector.TranslateToLocal("deathScreen.titleScreen")));

                if (Mc.Session == null)
                {
                    ControlList[1].Enabled = false;
                }
            }

            for (IEnumerator <GuiButton> iterator = ControlList.GetEnumerator(); iterator.MoveNext();)
            {
                GuiButton guibutton = iterator.Current;
                guibutton.Enabled = false;
            }
        }
Пример #2
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);
        }
Пример #3
0
        public override string GetItemDisplayName(ItemStack par1ItemStack)
        {
            if (par1ItemStack.GetItemDamage() == 0)
            {
                return(StatCollector.TranslateToLocal("item.emptyPotion.name").Trim());
            }

            string s = "";

            if (IsSplash(par1ItemStack.GetItemDamage()))
            {
                s = (new StringBuilder()).Append(StatCollector.TranslateToLocal("potion.prefix.grenade").Trim()).Append(" ").ToString();
            }

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

            if (list != null && list.Count > 0)
            {
                string s1 = ((PotionEffect)list[0]).GetEffectName();
                s1 = (new StringBuilder()).Append(s1).Append(".postfix").ToString();
                return((new StringBuilder()).Append(s).Append(StatCollector.TranslateToLocal(s1).Trim()).ToString());
            }
            else
            {
                string s2 = PotionHelper.Func_40359_b(par1ItemStack.GetItemDamage());
                return((new StringBuilder()).Append(StatCollector.TranslateToLocal(s2).Trim()).Append(" ").Append(base.GetItemDisplayName(par1ItemStack)).ToString());
            }
        }
 /// <summary>
 /// Queue a information about a achievement to be displayed.
 /// </summary>
 public virtual void QueueAchievementInformation(Achievement par1Achievement)
 {
     AchievementGetLocalText = StatCollector.TranslateToLocal(par1Achievement.GetName());
     AchievementStatName     = par1Achievement.GetDescription();
     AchievementTime         = JavaHelper.CurrentTimeMillis() - 2500L;
     TheAchievement          = par1Achievement;
     HaveAchiement           = true;
 }
 /// <summary>
 /// Queue a taken achievement to be displayed.
 /// </summary>
 public virtual void QueueTakenAchievement(Achievement par1Achievement)
 {
     AchievementGetLocalText = StatCollector.TranslateToLocal("achievement.get");
     AchievementStatName     = StatCollector.TranslateToLocal(par1Achievement.GetName());
     AchievementTime         = JavaHelper.CurrentTimeMillis();
     TheAchievement          = par1Achievement;
     HaveAchiement           = false;
 }
Пример #6
0
 public GuiCreateWorld(GuiScreen par1GuiScreen)
 {
     GameMode              = "survival";
     Field_35365_g         = true;
     Field_40232_h         = false;
     Field_46030_z         = 0;
     ParentGuiScreen       = par1GuiScreen;
     Seed                  = "";
     LocalizedNewWorldText = StatCollector.TranslateToLocal("selectWorld.newWorld");
 }
 /// <summary>
 /// Returns the fully description of the achievement - ready to be displayed on screen.
 /// </summary>
 public virtual string GetDescription()
 {
     if (StatStringFormatter != null)
     {
         return(StatStringFormatter.FormatString(StatCollector.TranslateToLocal(AchievementDescription)));
     }
     else
     {
         return(StatCollector.TranslateToLocal(AchievementDescription));
     }
 }
Пример #8
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());
     }
 }
        /// <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;
            }
        }
        public override string GetItemDisplayName(ItemStack par1ItemStack)
        {
            string s  = (new StringBuilder()).Append("").Append(StatCollector.TranslateToLocal((new StringBuilder()).Append(GetItemName()).Append(".name").ToString())).ToString().Trim();
            string s1 = EntityList.GetStringFromID(par1ItemStack.GetItemDamage());

            if (s1 != null)
            {
                s = (new StringBuilder()).Append(s).Append(" ").Append(StatCollector.TranslateToLocal((new StringBuilder()).Append("entity.").Append(s1).Append(".name").ToString())).ToString();
            }

            return(s);
        }
Пример #11
0
 /// <summary>
 /// Adds the buttons (and other controls) to the screen in question.
 /// </summary>
 public override void InitGui()
 {
     StatsTitle  = StatCollector.TranslateToLocal("gui.stats");
     SlotGeneral = new GuiSlotStatsGeneral(this);
     SlotGeneral.RegisterScrollButtons(ControlList, 1, 1);
     SlotItem = new GuiSlotStatsItem(this);
     SlotItem.RegisterScrollButtons(ControlList, 1, 1);
     SlotBlock = new GuiSlotStatsBlock(this);
     SlotBlock.RegisterScrollButtons(ControlList, 1, 1);
     SelectedSlot = SlotGeneral;
     AddHeaderButtons();
 }
Пример #12
0
        public virtual string GetLocalItemName(ItemStack par1ItemStack)
        {
            string s = GetItemNameIS(par1ItemStack);

            if (s == null)
            {
                return("");
            }
            else
            {
                return(StatCollector.TranslateToLocal(s));
            }
        }
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            DrawDefaultBackground();
            DrawCenteredString(FontRenderer, ScreenTitle, Width / 2, 20, 0xffffff);

            if (!Is64bit && GuiGameSettings.RenderDistance == 0)
            {
                DrawCenteredString(FontRenderer, StatCollector.TranslateToLocal("options.farWarning1"), Width / 2, Height / 6 + 144, 0xaf0000);
                DrawCenteredString(FontRenderer, StatCollector.TranslateToLocal("options.farWarning2"), Width / 2, Height / 6 + 144 + 12, 0xaf0000);
            }

            base.DrawScreen(par1, par2, par3);
        }
        /// <summary>
        /// Adds the buttons (and other controls) to the screen in question.
        /// </summary>
        public override void InitGui()
        {
            UpdateCounter2 = 0;
            ControlList.Clear();
            sbyte byte0 = -16;

            ControlList.Add(new GuiButton(1, Width / 2 - 100, Height / 4 + 120 + byte0, StatCollector.TranslateToLocal("menu.returnToMenu")));

            if (Mc.IsMultiplayerWorld())
            {
                ((GuiButton)ControlList[0]).DisplayString = StatCollector.TranslateToLocal("menu.disconnect");
            }

            ControlList.Add(new GuiButton(4, Width / 2 - 100, Height / 4 + 24 + byte0, StatCollector.TranslateToLocal("menu.returnToGame")));
            ControlList.Add(new GuiButton(0, Width / 2 - 100, Height / 4 + 96 + byte0, StatCollector.TranslateToLocal("menu.options")));
            ControlList.Add(new GuiButton(5, Width / 2 - 100, Height / 4 + 48 + byte0, 98, 20, StatCollector.TranslateToLocal("gui.achievements")));
            ControlList.Add(new GuiButton(6, Width / 2 + 2, Height / 4 + 48 + byte0, 98, 20, StatCollector.TranslateToLocal("gui.stats")));
        }
Пример #15
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);
        }
Пример #16
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);
        }
Пример #17
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);
        }
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            DrawGradientRect(0, 0, Width, Height, 0x6050000, 0xa080303);
            //GL.PushMatrix();
            //GL.Scale(2.0F, 2.0F, 2.0F);
            bool   flag = Mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled();
            string s    = flag ? StatCollector.TranslateToLocal("deathScreen.title.hardcore") : StatCollector.TranslateToLocal("deathScreen.title");

            DrawCenteredString(FontRenderer, s, Width / 2 / 2, 30, 0xffffff);
            //GL.PopMatrix();

            if (flag)
            {
                DrawCenteredString(FontRenderer, StatCollector.TranslateToLocal("deathScreen.hardcoreInfo"), Width / 2, 144, 0xffffff);
            }

            DrawCenteredString(FontRenderer, (new StringBuilder()).Append(StatCollector.TranslateToLocal("deathScreen.score")).Append(": ").Append(Mc.ThePlayer.GetScore()).ToString(), Width / 2, 100, 0xffffff);
            base.DrawScreen(par1, par2, par3);
        }
Пример #19
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());
            }
        }
Пример #20
0
        /// <summary>
        /// Adds the buttons (and other controls) to the screen in question.
        /// </summary>
        public override void InitGui()
        {
            StringTranslate stringtranslate = StringTranslate.GetInstance();

            ScreenTitle = stringtranslate.TranslateKey("options.title");
            int i = 0;

            Options[] aenumoptions = RelevantOptions;
            int       j            = aenumoptions.Length;

            for (int k = 0; k < j; k++)
            {
                Options enumoptions = aenumoptions[k];

                if (!enumoptions.Float)
                {
                    GuiSmallButton guismallbutton = new GuiSmallButton(enumoptions.Ordinal(), (Width / 2 - 155) + (i % 2) * 160, Height / 6 + 24 * (i >> 1), enumoptions, Settings.GetKeyBinding(enumoptions));

                    if (enumoptions == Options.DIFFICULTY && Mc.TheWorld != null && Mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled())
                    {
                        guismallbutton.Enabled       = false;
                        guismallbutton.DisplayString = (new StringBuilder()).Append(StatCollector.TranslateToLocal("options.difficulty")).Append(": ").Append(StatCollector.TranslateToLocal("options.difficulty.hardcore")).ToString();
                    }

                    ControlList.Add(guismallbutton);
                }
                else
                {
                    ControlList.Add(new GuiSlider(enumoptions.Ordinal(), (Width / 2 - 155) + (i % 2) * 160, Height / 6 + 24 * (i >> 1), enumoptions, Settings.GetKeyBinding(enumoptions), Settings.GetOptionFloatValue(enumoptions)));
                }

                i++;
            }

            ControlList.Add(new GuiButton(101, Width / 2 - 100, (Height / 6 + 96) - 6, stringtranslate.TranslateKey("options.video")));
            ControlList.Add(new GuiButton(100, Width / 2 - 100, (Height / 6 + 120) - 6, stringtranslate.TranslateKey("options.controls")));
            ControlList.Add(new GuiButton(102, Width / 2 - 100, (Height / 6 + 144) - 6, stringtranslate.TranslateKey("options.language")));
            ControlList.Add(new GuiButton(200, Width / 2 - 100, Height / 6 + 168, stringtranslate.TranslateKey("gui.done")));
        }
        protected override void DrawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator)
        {
            SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.GetSize(ParentWorldGui)[par1];
            string s = saveformatcomparator.GetDisplayName();

            if (s == null || MathHelper2.StringNullOrLengthZero(s))
            {
                s = (new StringBuilder()).Append(GuiSelectWorld.GetLocalizedWorldName(ParentWorldGui)).Append(" ").Append(par1 + 1).ToString();
            }

            string s1 = saveformatcomparator.GetFileName();

            s1 = (new StringBuilder()).Append(s1).Append(" (").Append(new DateTime(saveformatcomparator.GetLastTimePlayed())).ToString();
            s1 = (new StringBuilder()).Append(s1).Append(")").ToString();
            string s2 = "";

            if (saveformatcomparator.RequiresConversion())
            {
                s2 = (new StringBuilder()).Append(GuiSelectWorld.GetLocalizedMustConvert(ParentWorldGui)).Append(" ").Append(s2).ToString();
            }
            else
            {
                s2 = GuiSelectWorld.GetLocalizedGameMode(ParentWorldGui)[saveformatcomparator.GetGameType()];

                if (saveformatcomparator.IsHardcoreModeEnabled())
                {
                    s2 = (new StringBuilder()).Append(FontRenderer.SpecialChar).Append("4").Append(StatCollector.TranslateToLocal("gameMode.hardcore")).Append(FontRenderer.SpecialChar).Append("8").ToString();
                }
            }

            ParentWorldGui.DrawString(ParentWorldGui.FontRenderer, s, par2 + 2, par3 + 1, 0xffffff);
            ParentWorldGui.DrawString(ParentWorldGui.FontRenderer, s1, par2 + 2, par3 + 12, 0x808080);
            ParentWorldGui.DrawString(ParentWorldGui.FontRenderer, s2, par2 + 2, par3 + 12 + 10, 0x808080);
        }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 2)
            {
                string s = ServerList[SelectedServer].Name;

                if (s != null)
                {
                    DeleteClicked = true;
                    StringTranslate stringtranslate = StringTranslate.GetInstance();
                    string          s1       = stringtranslate.TranslateKey("selectServer.deleteQuestion");
                    string          s2       = new StringBuilder().Append("'").Append(s).Append("' ").Append(stringtranslate.TranslateKey("selectServer.deleteWarning")).ToString();
                    string          s3       = stringtranslate.TranslateKey("selectServer.deleteButton");
                    string          s4       = stringtranslate.TranslateKey("gui.cancel");
                    GuiYesNo        guiyesno = new GuiYesNo(this, s1, s2, s3, s4, SelectedServer);
                    Mc.DisplayGuiScreen(guiyesno);
                }
            }
            else if (par1GuiButton.Id == 1)
            {
                JoinServer(SelectedServer);
            }
            else if (par1GuiButton.Id == 4)
            {
                DirectClicked = true;
                Mc.DisplayGuiScreen(new GuiScreenServerList(this, TempServer = new ServerNBTStorage(StatCollector.TranslateToLocal("selectServer.defaultName"), "")));
            }
            else if (par1GuiButton.Id == 3)
            {
                AddClicked = true;
                Mc.DisplayGuiScreen(new GuiScreenAddServer(this, TempServer = new ServerNBTStorage(StatCollector.TranslateToLocal("selectServer.defaultName"), "")));
            }
            else if (par1GuiButton.Id == 7)
            {
                EditClicked = true;
                ServerNBTStorage servernbtstorage = (ServerNBTStorage)ServerList[SelectedServer];
                Mc.DisplayGuiScreen(new GuiScreenAddServer(this, TempServer = new ServerNBTStorage(servernbtstorage.Name, servernbtstorage.Host)));
            }
            else if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(ParentScreen);
            }
            else if (par1GuiButton.Id == 8)
            {
                Mc.DisplayGuiScreen(new GuiMultiplayer(ParentScreen));
            }
            else
            {
                ServerSlotContainer.ActionPerformed(par1GuiButton);
            }
        }
Пример #23
0
 /// <summary>
 /// Draw the foreground layer for the GuiContainer (everythin in front of the items)
 /// </summary>
 protected override void DrawGuiContainerForegroundLayer()
 {
     FontRenderer.DrawString(StatCollector.TranslateToLocal("container.furnace"), 60, 6, 0x404040);
     FontRenderer.DrawString(StatCollector.TranslateToLocal("container.Inventory"), 8, (YSize - 96) + 2, 0x404040);
 }
Пример #24
0
        /// <summary>
        /// Returns the correct traslated name of the enchantment and the level in roman numbers.
        /// </summary>
        public virtual string GetTranslatedName(int par1)
        {
            string s = StatCollector.TranslateToLocal(GetName());

            return((new StringBuilder()).Append(s).Append(" ").Append(StatCollector.TranslateToLocal((new StringBuilder()).Append("enchantment.level.").Append(par1).ToString())).ToString());
        }
Пример #25
0
 ///<summary>
 /// Adds the buttons (and other controls) to the screen in question.
 ///</summary>
 public new void InitGui()
 {
     ControlList.Clear();
     ControlList.Add(new GuiSmallButton(1, Width / 2 + 24, Height / 2 + 74, 80, 20, StatCollector.TranslateToLocal("gui.done")));
 }
Пример #26
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();
        }
Пример #27
0
 public override string ToString()
 {
     return(StatCollector.TranslateToLocal(StatName));
 }
Пример #28
0
 ///<summary>
 /// Draw the foreground layer for the GuiContainer (everythin in front of the items)
 ///</summary>
 protected override void DrawGuiContainerForegroundLayer()
 {
     FontRenderer.DrawString(StatCollector.TranslateToLocal(lowerChestInventory.GetInvName()), 8, 6, 0x404040);
     FontRenderer.DrawString(StatCollector.TranslateToLocal(upperChestInventory.GetInvName()), 8, (YSize - 96) + 2, 0x404040);
 }
Пример #29
0
 /// <summary>
 /// Draw the foreground layer for the GuiContainer (everythin in front of the items)
 /// </summary>
 protected override void DrawGuiContainerForegroundLayer()
 {
     FontRenderer.DrawString(StatCollector.TranslateToLocal("container.creative"), 8, 6, 0x404040);
 }
Пример #30
0
 public virtual string GetStatName()
 {
     return(StatCollector.TranslateToLocal((new StringBuilder()).Append(GetItemName()).Append(".name").ToString()));
 }