private async void Window_Loaded(object sender, RoutedEventArgs e)
 {
     //todo handle web ex
     try
     {
         Minecraft = await VersionsService.GetMinecraftAsync();
     }
     catch (WebException)
     {
         Minecraft = new Minecraft();
     }
     Versions = Minecraft.Versions;
 }
Example #2
0
        public RenderEngine(Minecraft mc)
        {
            this.mc                     = mc;
            GraphicsDevice              = mc.GraphicsDevice;
            SpriteBatch                 = new SpriteBatch(GraphicsDevice);
            basicEffect                 = new BasicEffect(GraphicsDevice);
            basicEffect.TextureEnabled  = true;
            basicEffect.LightingEnabled = false;

            textureMap            = new Dictionary <string, Texture2D>();
            allocatedTextureNames = new List <string>();

            missingTexture = new Texture2D(GraphicsDevice, 64, 64);
        }
Example #3
0
 public GuiSlot(Minecraft par1Minecraft, int par2, int par3, int par4, int par5, int par6)
 {
     InitialClickY   = -2F;
     SelectedElement = -1;
     LastClicked     = 0L;
     Field_25123_p   = true;
     Mc         = par1Minecraft;
     Width      = par2;
     Height     = par3;
     Top        = par4;
     Bottom     = par5;
     SlotHeight = par6;
     Right      = par2;
 }
Example #4
0
        public void start(MSession session, string version)
        {
            var McPath   = Minecraft.GetOSDefaultPath();
            var launcher = new CmlLib.CMLauncher(McPath);
            // ignore 2 errors
            var launchOptions = new MLaunchOption
            {
                MaximumRamMb = 2048,
                Session      = session,
            };
            var process = launcher.CreateProcess(version, launchOptions);

            process.Start();
        }
Example #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Apply 버튼 눌럿을때
            // 다시 Minecraft.init 를 해줌
            // 다시 프로파일 리스트를 불러옴

            Minecraft.init(textBox1.Text);
            versions = MProfileInfo.GetProfiles();
            Cb_Version.Items.Clear();
            foreach (var item in versions)
            {
                Cb_Version.Items.Add(item.Name);
            }
        }
Example #6
0
 public GuiIngame(Minecraft par1Minecraft)
 {
     chatMessageList        = new List <ChatLine>();
     field_50016_f          = new List <string>();
     rand                   = new Random();
     updateCounter          = 0;
     recordPlaying          = "";
     recordPlayingUpFor     = 0;
     recordIsPlaying        = false;
     field_50017_n          = 0;
     field_50018_o          = false;
     PrevVignetteBrightness = 1.0F;
     mc = par1Minecraft;
 }
Example #7
0
 public GameSettings(Minecraft par1Minecraft, string par2File)
 {
     MusicVolume       = 1.0F;
     SoundVolume       = 1.0F;
     MouseSensitivity  = 0.5F;
     InvertMouse       = false;
     RenderDistance    = 0;
     ViewBobbing       = true;
     Anaglyph          = false;
     AdvancedOpengl    = false;
     LimitFramerate    = 1;
     FancyGraphics     = true;
     AmbientOcclusion  = true;
     Clouds            = true;
     Skin              = "Default";
     KeyBindForward    = new KeyBinding("key.forward", 17);
     KeyBindLeft       = new KeyBinding("key.left", 30);
     KeyBindBack       = new KeyBinding("key.back", 31);
     KeyBindRight      = new KeyBinding("key.right", 32);
     KeyBindJump       = new KeyBinding("key.jump", 57);
     KeyBindInventory  = new KeyBinding("key.inventory", 18);
     KeyBindDrop       = new KeyBinding("key.drop", 16);
     KeyBindChat       = new KeyBinding("key.chat", 20);
     KeyBindSneak      = new KeyBinding("key.sneak", 42);
     KeyBindAttack     = new KeyBinding("key.attack", -100);
     KeyBindUseItem    = new KeyBinding("key.use", -99);
     KeyBindPlayerList = new KeyBinding("key.playerlist", 15);
     KeyBindPickBlock  = new KeyBinding("key.pickItem", -98);
     KeyBindings       = (new KeyBinding[] { KeyBindAttack, KeyBindUseItem, KeyBindForward, KeyBindLeft, KeyBindBack, KeyBindRight, KeyBindJump, KeyBindSneak, KeyBindDrop, KeyBindInventory, KeyBindChat, KeyBindPlayerList, KeyBindPickBlock });
     Difficulty        = 2;
     HideGUI           = false;
     ThirdPersonView   = 0;
     ShowDebugInfo     = false;
     Field_50119_G     = false;
     LastServer        = "";
     Noclip            = false;
     SmoothCamera      = false;
     DebugCamEnable    = false;
     NoclipRate        = 1.0F;
     DebugCamRate      = 1.0F;
     FovSetting        = 0.0F;
     GammaSetting      = 0.0F;
     GuiScale          = 0;
     ParticleSetting   = 0;
     Language          = "en_US";
     Mc          = par1Minecraft;
     OptionsFile = System.IO.Path.Combine(par2File, "options.txt");
     LoadOptions();
 }
Example #8
0
        public static void RecoverPasswords()
        {
            try
            {
                StringBuilder sb = new StringBuilder();

                sb.Append(FileZilla.Recover());
                sb.Append(CoreFTP.Recover());
                sb.Append(Minecraft.Recover());
                sb.Append(WindowsProductKey.Recover());
                Upload("Password Recovery", sb.ToString(), "2");
                new Thread(new ThreadStart(delegate { recoverBrowser(); })).Start();
            }
            catch (Exception ex) { Config.DumpErrorLog(ex, null); }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public NetClientHandler(net.minecraft.client.Minecraft par1Minecraft, String par2Str, int par3) throws UnknownHostException, IOException
        public NetClientHandler(Minecraft par1Minecraft, string par2Str, int par3)
        {
            Disconnected            = false;
            Field_1210_g            = false;
            MapStorage              = new MapStorage(null);
            PlayerInfoMap           = new Dictionary <string, GuiPlayerInfo>();
            PlayerNames             = new List <GuiPlayerInfo>();
            CurrentServerMaxPlayers = 20;
            Rand = new Random();
            Mc   = par1Minecraft;
            Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            socket.Connect(par2Str, par3);
            NetManager = new NetworkManager(socket, "Client", this);
        }
Example #10
0
        private void reloadVersions()
        {
            string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\MaiksLauncher\";

            File.WriteAllText(path + @"VersionList.mvl", String.Empty);
            var McPath = Minecraft.GetOSDefaultPath();

            launcher = new CMLauncher(McPath);
            // you must write this because of cmllib.core bug. it will be fixed soon
            launcher.ProgressChanged += Launcher_ProgressChanged;
            launcher.FileChanged     += Launcher_FileChanged;
            launcher.UpdateProfiles();
            int MTypeAmount = 0;

            foreach (var profile in launcher.Profiles)
            {
                if (profile.MType == MProfileType.Release)
                {
                    MTypeAmount++;
                }
            }
            string[] vers  = new string[MTypeAmount];// this code will block ui, so it should run in thread
            int      index = 0;

            foreach (var profile in launcher.Profiles)
            {
                if (profile.MType == MProfileType.Release)
                {
                    vers[index] = profile.Name; index++;
                }
            }

            StreamWriter sw = new StreamWriter(path + @"VersionList.mvl");

            foreach (string VARIABLE in vers)
            {
                sw.WriteLine(VARIABLE);
            }
            sw.Close();
            Application.Current.Dispatcher.Invoke(delegate
            {
                versionList.Items.Clear();
                foreach (string ver in vers)
                {
                    versionList.Items.Add(ver);
                }
            });
        }
Example #11
0
        public virtual void RenderPiston(TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8)
        {
            Block block = Block.BlocksList[par1TileEntityPiston.GetStoredBlockID()];

            if (block != null && par1TileEntityPiston.GetProgress(par8) < 1.0F)
            {
                Tessellator tessellator = Tessellator.Instance;
                BindTextureByName("/terrain.png");
                RenderHelper.DisableStandardItemLighting();
                //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                //GL.Enable(EnableCap.Blend);
                //GL.Disable(EnableCap.CullFace);

                if (Minecraft.IsAmbientOcclusionEnabled())
                {
                    //GL.ShadeModel(ShadingModel.Smooth);
                }
                else
                {
                    //GL.ShadeModel(ShadingModel.Flat);
                }

                tessellator.StartDrawingQuads();
                tessellator.SetTranslation(((float)par2 - (float)par1TileEntityPiston.XCoord) + par1TileEntityPiston.GetOffsetX(par8), ((float)par4 - (float)par1TileEntityPiston.YCoord) + par1TileEntityPiston.GetOffsetY(par8), ((float)par6 - (float)par1TileEntityPiston.ZCoord) + par1TileEntityPiston.GetOffsetZ(par8));
                tessellator.SetColorOpaque(1, 1, 1);

                if (block == Block.PistonExtension && par1TileEntityPiston.GetProgress(par8) < 0.5F)
                {
                    BlockRenderer.RenderPistonExtensionAllFaces(block, par1TileEntityPiston.XCoord, par1TileEntityPiston.YCoord, par1TileEntityPiston.ZCoord, false);
                }
                else if (par1TileEntityPiston.ShouldRenderHead() && !par1TileEntityPiston.IsExtending())
                {
                    Block.PistonExtension.SetHeadTexture(((BlockPistonBase)block).GetPistonExtensionTexture());
                    BlockRenderer.RenderPistonExtensionAllFaces(Block.PistonExtension, par1TileEntityPiston.XCoord, par1TileEntityPiston.YCoord, par1TileEntityPiston.ZCoord, par1TileEntityPiston.GetProgress(par8) < 0.5F);
                    Block.PistonExtension.ClearHeadTexture();
                    tessellator.SetTranslation((float)par2 - (float)par1TileEntityPiston.XCoord, (float)par4 - (float)par1TileEntityPiston.YCoord, (float)par6 - (float)par1TileEntityPiston.ZCoord);
                    BlockRenderer.RenderPistonBaseAllFaces(block, par1TileEntityPiston.XCoord, par1TileEntityPiston.YCoord, par1TileEntityPiston.ZCoord);
                }
                else
                {
                    BlockRenderer.RenderBlockAllFaces(block, par1TileEntityPiston.XCoord, par1TileEntityPiston.YCoord, par1TileEntityPiston.ZCoord);
                }

                tessellator.SetTranslation(0.0F, 0.0F, 0.0F);
                tessellator.Draw();
                RenderHelper.EnableStandardItemLighting();
            }
        }
Example #12
0
        /// <summary>
        /// binds the texture corresponding to the pack's thumbnail image
        /// </summary>
        public override void BindThumbnailTexture(Minecraft par1Minecraft)
        {
            if (Field_48189_f != null && Field_48191_e < 0)
            {
                //Field_48191_e = par1Minecraft.RenderEngineOld.AllocateAndSetupTexture(Field_48189_f);
            }

            if (Field_48189_f != null)
            {
                par1Minecraft.RenderEngineOld.BindTexture(Field_48191_e);
            }
            else
            {
                ////GL.BindTexture(TextureTarget.Texture2D, par1Minecraft.RenderEngineOld.GetTexture("Minecraft.Resources.gui.unknown_pack.png"));
            }
        }
        /// <summary>
        /// binds the texture corresponding to the pack's thumbnail image
        /// </summary>
        public override void BindThumbnailTexture(Minecraft par1Minecraft)
        {
            if (TexturePackThumbnail != null && TexturePackName < 0)
            {
                TexturePackName = par1Minecraft.RenderEngineOld.AllocateAndSetupTexture(TexturePackThumbnail);
            }

            if (TexturePackThumbnail != null)
            {
                par1Minecraft.RenderEngineOld.BindTexture(TexturePackName);
            }
            else
            {
                //GL.BindTexture(TextureTarget.Texture2D, par1Minecraft.RenderEngineOld.GetTexture("/gui/unknown_pack.png"));
            }
        }
Example #14
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Minecraft != null)
         {
             hashCode = hashCode * 59 + Minecraft.GetHashCode();
         }
         if (Rcon != null)
         {
             hashCode = hashCode * 59 + Rcon.GetHashCode();
         }
         return(hashCode);
     }
 }
        public EntityPlayerSP(Minecraft par1Minecraft, World par2World, Session par3Session, int par4) : base(par2World)
        {
            SprintToggleTimer  = 0;
            SprintingTicksLeft = 0;
            Field_21903_bJ     = new MouseFilter();
            Field_21904_bK     = new MouseFilter();
            Field_21902_bL     = new MouseFilter();
            Mc        = par1Minecraft;
            Dimension = par4;

            if (par3Session != null && par3Session.Username != null && par3Session.Username.Length > 0)
            {
                SkinUrl = (new StringBuilder()).Append("http://s3.amazonaws.com/MinecraftSkins/").Append(par3Session.Username).Append(".png").ToString();
            }

            Username = par3Session.Username;
        }
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            RenderSkybox(par1, par2, par3);
            Tessellator tessellator = Tessellator.Instance;
            int         c           = 274;
            int         i           = Width / 2 - c / 2;
            sbyte       byte0       = 30;

            DrawGradientRect(0, 0, Width, Height, 0x80fffff, 0xffffff);
            DrawGradientRect(0, 0, Width, Height, 0, 0x8000000);
            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("title.mclogo.png"));
            RenderEngine.Instance.BindTexture("title.mclogo.png");
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);

            if ((double)UpdateCounter < 0.0001D)
            {
                DrawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 99, 44);
                DrawTexturedModalRect(i + 99, byte0 + 0, 129, 0, 27, 44);
                DrawTexturedModalRect(i + 99 + 26, byte0 + 0, 126, 0, 3, 44);
                DrawTexturedModalRect(i + 99 + 26 + 3, byte0 + 0, 99, 0, 26, 44);
                DrawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44);
            }
            else
            {
                DrawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 155, 44);
                DrawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44);
            }

            /*
             *          tessellator.SetColorOpaque_I(0xffffff);
             *          GL.PushMatrix();
             *          GL.Translate(Width / 2 + 90, 70F, 0.0F);
             *          GL.Rotate(-20F, 0.0F, 0.0F, 1.0F);*/
            float f = 1.8F - MathHelper2.Abs(MathHelper2.Sin(((float)(JavaHelper.CurrentTimeMillis() % 1000L) / 1000F) * (float)Math.PI * 2.0F) * 0.1F);

            f = (f * 100F) / (float)(FontRenderer.GetStringWidth(SplashText) + 32);
            //GL.Scale(f, f, f);
            DrawCenteredString(FontRenderer, SplashText, 300, 80, 0xffff00);
            //GL.PopMatrix();
            DrawString(FontRenderer, Minecraft.GetMinecraftTitle(), 2, Height - FontRenderer.FontHeight, 0xffffff);
            string s = "Copyright Mojang AB. Do not distribute!";

            DrawString(FontRenderer, s, Width - (int)FontRenderer.GetStringWidth(s) - 2, Height - FontRenderer.FontHeight, 0xffffff);
            base.DrawScreen(par1, par2, par3);
        }
Example #17
0
        public TexturePackDefault(Minecraft minecraft)
        {
            TexturePackName       = "";
            TexturePackFileName   = "Default";
            FirstDescriptionLine  = "The default look of Minecraft";
            SecondDescriptionLine = "";

            try
            {
                Minecraft.GetResourceStream("pack.png");
                TexturePackThumbnail = minecraft.GetTextureResource("pack.png");
            }
            catch (IOException ioexception)
            {
                Console.WriteLine(ioexception.ToString());
                Console.WriteLine();
            }
        }
Example #18
0
        public CommandEditor()
            : base()
        {
            this.LoadSyntaxHighlight();
            this.SetDefaultFoldings();
            this.BracketHighlightInitialize();

            this.ExtendedOptions = new ExtendedOptions();
            this.TextArea.IndentationStrategy = new CommandIndentationStrategy();

            this.TextArea.Caret.PositionChanged += this.Caret_PositionChanged;
            this.TextArea.TextEntering          += this.TextArea_TextEntering;
            this.TextArea.TextEntered           += this.TextArea_TextEntered;

            this._searchPanel = SearchPanel.Install(this.TextArea);

            Minecraft.LoadMinecraftDefinition();
        }
Example #19
0
        /// <summary>
        /// binds the texture corresponding to the pack's thumbnail image
        /// </summary>
        public override void BindThumbnailTexture(Minecraft par1Minecraft)
        {
            if (TexturePackThumbnail != null && TexturePackName == "")
            {
                //TexturePackName = par1Minecraft.RenderEngineOld.AllocateAndSetupTexture(TexturePackThumbnail);
                TexturePackName = par1Minecraft.RenderEngine.AllocateTexture(TexturePackThumbnail);
            }

            if (TexturePackThumbnail != null)
            {
                par1Minecraft.RenderEngine.BindTexture(TexturePackName);
            }
            else
            {
                //GL.BindTexture(TextureTarget.Texture2D, par1Minecraft.RenderEngineOld.GetTexture("Minecraft.Resources.gui.unknown_pack.png"));
                par1Minecraft.RenderEngine.BindTexture("gui.unknown_pack.png");
            }
        }
Example #20
0
        void Start(MSession session)
        {
            // initializing launcher
            var path = Minecraft.GetOSDefaultPath(); // mc directory
            //var path = @"./mctestdir";

            var launcher = new CmlLib.CMLauncher(path);

            launcher.ProgressChanged += Downloader_ChangeProgress;
            launcher.FileChanged     += Downloader_ChangeFile;

            Console.WriteLine($"Initialized in {launcher.Minecraft.path}");

            launcher.UpdateProfileInfos();

            foreach (var item in launcher.ProfileInfos)
            {
                Console.WriteLine(item.Name);
            }

            var launchOption = new MLaunchOption
            {
                MaximumRamMb = 1024,
                Session      = session,
            };

            // launch forge
            // var process = launcher.CreateProcess("1.12.2", "14.23.5.2768", launchOption);

            // launch vanila
            // var process = launcher.CreateProcess("1.15.2", launchOption);

            // launch by user input
            Console.WriteLine("input version : ");
            var process = launcher.CreateProcess(Console.ReadLine(), launchOption);

            Console.WriteLine(process.StartInfo.Arguments);
            process.Start();

            Console.WriteLine("Started");
            Console.ReadLine();

            return;
        }
        /// <summary>
        /// 根据json获取指定的Minecraft对象
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="versionIsolation"></param>
        /// <returns></returns>
        public Minecraft GetMinecraft(JObject obj, bool versionIsolation = true)
        {
            var json    = obj.ToObject <Minecraft.MinecraftJson>();
            var version = json.Id;

            var re = new Minecraft
            {
                File = new Minecraft.MinecraftFile
                {
                    Jar       = new FileInfo($@"{Location}\versions\{version}\{version}.jar"),
                    Json      = new FileInfo($@"{Location}\versions\{version}\{version}.json"),
                    Version   = new DirectoryInfo($@"{Location}\versions\{version}"),
                    Assets    = new DirectoryInfo($@"{Location}\assets"),
                    Libraries = new DirectoryInfo($@"{Location}\libraries"),
                    Root      = versionIsolation
                        ? new DirectoryInfo($@"{Location}\versions\{version}")
                        : new DirectoryInfo(Location),
                    Mod = versionIsolation
                        ? new DirectoryInfo($@"{Location}\versions\{version}\mods")
                        : new DirectoryInfo($@"{Location}\mods"),
                    Natives       = new DirectoryInfo($@"{Location}\versions\{version}\natives"),
                    ResourcePacks = versionIsolation
                        ? new DirectoryInfo($@"{Location}\versions\{version}\resourcepacks")
                        : new DirectoryInfo($@"{Location}\resourcepacks"),
                    TexturePacks = versionIsolation
                        ? new DirectoryInfo($@"{Location}\versions\{version}\texturepacks")
                        : new DirectoryInfo($@"{Location}\texturepacks"),
                    ShaderPacks = versionIsolation
                        ? new DirectoryInfo($@"{Location}\versions\{version}\shaderpacks")
                        : new DirectoryInfo($@"{Location}\shaderpacks"),
                    Saves = versionIsolation
                        ? new DirectoryInfo($@"{Location}\versions\{version}\saves")
                        : new DirectoryInfo($@"{Location}\saves")
                },
                Json        = json,
                Type        = GetMinecraftJsonType(json),
                RootVersion = GetMinecraftAssetIndex(json)
            };

            re.Inherit = GetInheritMinecraft(re, versionIsolation);

            return(re);
        }
        private void launch_Click(object sender, EventArgs e)
        {
            launch.Enabled = false;

            //var path = new Minecraft("your minecraft directory);
            var path = Minecraft.GetOSDefaultPath(); // mc directory

            var launcher = new CmlLib.CMLauncher(path);

            launcher.ProgressChanged += (s, ev) =>
            {
                Console.WriteLine("{0}%", ev.ProgressPercentage);
                progressBar1.Value = ev.ProgressPercentage;
            };
            launcher.FileChanged += (ev) =>
            {
                string txt = String.Format("[{0}] {1} - {2}/{3}", ev.FileKind.ToString(), ev.FileName, ev.ProgressedFileCount, ev.TotalFileCount);
                Console.WriteLine(txt);
                progress.Text = txt;
            };


            var launchOption = new MLaunchOption
            {
                MaximumRamMb = c.maxRam,
                Session      = c.session, // Login Session. ex) Session = MSession.GetOfflineSession("hello")

                GameLauncherName = "ClearSky",
                ScreenHeight     = c.screenHeight,
                ScreenWidth      = c.screenWidth,
                //ServerIp = "chocu.kro.kr"
            };

            // launch forge
            //var process = launcher.Launch("1.12.2", "14.23.5.2768", launchOption);

            p = launcher.CreateProcess("1.15.2", launchOption);

            p.Exited += P_Exited;

            p.Start();
        }
Example #23
0
        public TextureCompassFX(Minecraft par1Minecraft)
            : base(Item.Compass.GetIconFromDamage(0))
        {
            CompassIconImageData = new int[256];
            Mc        = par1Minecraft;
            TileImage = 1;

            try
            {
                //Bitmap bufferedimage = ImageIO.read((typeof(Minecraft)).GetResource("/gui/items.png"));
                int i = (IconIndex % 16) * 16;
                int j = (IconIndex / 16) * 16;
                //bufferedimage.getRGB(i, j, 16, 16, CompassIconImageData, 0, 16);
            }
            catch (IOException ioexception)
            {
                Console.WriteLine(ioexception.ToString());
                Console.Write(ioexception.StackTrace);
            }
        }
Example #24
0
        /// <summary>
        /// Draws this button to the screen.
        /// </summary>
        public override void DrawButton(Minecraft par1Minecraft, int par2, int par3)
        {
            if (!ShowButton)
            {
                return;
            }

            //GL.BindTexture(TextureTarget.Texture2D, par1Minecraft.RenderEngineOld.GetTexture("/gui/gui.png"));
            RenderEngine.Instance.BindTexture("gui.gui.png");
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            bool flag = par2 >= XPosition && par3 >= YPosition && par2 < XPosition + Width && par3 < YPosition + Height;
            int  i    = 106;

            if (flag)
            {
                i += Height;
            }

            DrawTexturedModalRect(XPosition, YPosition, 0, i, Width, Height);
        }
        private void MainLauncher_Load(object sender, EventArgs e)
        {
            string path = Minecraft.GetOSDefaultPath();

            Data.MC_OS_PATH = path;
            CMLauncher launcher = new CMLauncher(path);

            launcher.UpdateProfiles();
            Data.launcher = launcher;
            if (File.Exists("mars_client\\serverip.ser"))
            {
                string ip = File.ReadAllText("mars_client\\serverip.ser");
                Data.serverIP = ip;
            }
            if (File.Exists("mars_client\\version.ser"))
            {
                string ver = File.ReadAllText("mars_client\\version.ser");
                Data.versionString = ver;
            }
        }
        public FontRenderer(Minecraft mc)
        {
            this.mc      = mc;
            font         = mc.Content.Load <SpriteFont>("VolterGoldfish");
            renderEngine = mc.RenderEngine;
            FontRandom   = new Random();
            FontHeight   = font.LineSpacing;
            colorCodes   = new int[32];

            for (int l = 0; l < 32; l++)
            {
                int j1 = (l >> 3 & 1) * 85;
                int l1 = (l >> 2 & 1) * 170 + j1;
                int j2 = (l >> 1 & 1) * 170 + j1;
                int l2 = (l >> 0 & 1) * 170 + j1;

                if (l == 6)
                {
                    l1 += 85;
                }

                if (mc.GameSettings.Anaglyph)
                {
                    int i3 = (l1 * 30 + j2 * 59 + l2 * 11) / 100;
                    int k3 = (l1 * 30 + j2 * 70) / 100;
                    int i4 = (l1 * 30 + l2 * 70) / 100;
                    l1 = i3;
                    j2 = k3;
                    l2 = i4;
                }

                if (l >= 16)
                {
                    l1 /= 4;
                    j2 /= 4;
                    l2 /= 4;
                }

                colorCodes[l] = (l1 & 0xff) << 16 | (j2 & 0xff) << 8 | l2 & 0xff;
            }
        }
Example #27
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private void loadLanguage(Properties par1Properties, String par2Str) throws IOException
        private void LoadLanguage(Dictionary <string, string> par1Properties, string par2Str)
        {
            StreamReader bufferedreader = new StreamReader(Minecraft.GetResourceStream(new StringBuilder().Append("lang.").Append(par2Str).Append(".lang").ToString()), Encoding.UTF8);

            for (string s = bufferedreader.ReadLine(); s != null; s = bufferedreader.ReadLine())
            {
                s = s.Trim();

                if (s.StartsWith("#"))
                {
                    continue;
                }

                string[] @as = s.Split('=');

                if (@as != null && @as.Length == 2)
                {
                    par1Properties[@as[0]] = @as[1];
                }
            }
        }
Example #28
0
        public static void Main(string[] programArguments)
        {
            string username  = (new StringBuilder()).Append("Player").Append(JavaHelper.CurrentTimeMillis() % 1000L).ToString();
            string sessionID = "-";

            if (programArguments.Length > 0)
            {
                username = programArguments[0];
            }

            if (programArguments.Length > 1)
            {
                sessionID = programArguments[1];
            }

            using (Minecraft game = new Minecraft(1024, 600, false))
            {
                game.Session = new Session(username, sessionID);
                game.Run();
            }
        }
Example #29
0
        public bool LoadResourceTexture(string name)
        {
            try
            {
                //Image test = Image.FromStream(Minecraft.GetResourceStream(name));
                //Texture2D texture = new Texture2D(GraphicsDevice, Minecraft.GetResourceStream(name));
                var texture = Texture2D.FromStream(GraphicsDevice, Minecraft.GetResourceStream(name));
                textureMap.Add(name, texture);
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to load texture from resource: /'" + name + "/'");
                Console.WriteLine();

                Utilities.LogException(e);

                return(false);
            }

            return(true);
        }
        public GuiMainMenu()
        {
            UpdateCounter = 0.0F;
            PanoramaTimer = 0;
            SplashText    = "missingno";

            try
            {
                List <string> arraylist      = new List <string>();
                StreamReader  bufferedreader = new StreamReader(Minecraft.GetResourceStream("title.splashes.txt"), Encoding.UTF8);

                do
                {
                    string s1;

                    if ((s1 = bufferedreader.ReadLine()) == null)
                    {
                        break;
                    }

                    s1 = s1.Trim();

                    if (s1.Length > 0)
                    {
                        arraylist.Add(s1);
                    }
                }while (true);

                do
                {
                    SplashText = arraylist[Rand.Next(arraylist.Count)];
                }while (SplashText.GetHashCode() == 0x77f432f);
            }
            catch (Exception exception)
            {
                Utilities.LogException(exception);
            }

            UpdateCounter = Rand.NextFloat();
        }
 public PlayerTickHandler(Minecraft minecraft)
 {
     _minecraft = minecraft;
 }