Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

xkyouchoux

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by xkyouchoux

  1. Again, this is nothing like cracked, you still need a minecraft username and password to login to minecraft to get a lastlogin file, which this would only set the username to your lastlogin IF your playing without a internet connection, not in offline mode. locking this thread so it doesnt turn into flame. :/

  2. This is a pretty silly request, but some of the big forge mods like EE2 use the players username for saving stuff, and if your offline it uses a random username, and I have already fixed this, but I am asking if Forge can detect if the game is playing in offline, and if so, set net.minecraft.client.Minecraft.session.username to the first UTF in the .minecraft/lastlogin file, so when your playing offline, you would stille have your username. Its pretty easy to implement, but im not posting code because the lastlogin file uses a Cipher (assuming a cipher is a encrytion.. lol) :/

     

    Edit:

     

    code with cipher removed :)

     

    @Override
    public void load()
    {
    	File file = new File(Minecraft.getAppDir("minecraft"), "lastlogin");
    	if(file.exists() && isOffline())
    	{
    		try
    		{
    			CipherInputStream cipherStream = new CipherInputStream(new FileInputStream(file), getCipher(2, "passwordfile"));
    			DataInputStream stream = new DataInputStream(cipherStream);
    			String username = stream.readUTF();
    			System.out.println("Setting offline username as " + username + ".");
    			ModLoader.getMinecraftInstance().session.username = username;
    		}
    		catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    	}
    }
    
    /**
     * Copied directly from Minecraft.exe to get access to the lastligin files because it uses a cipher.
     * 
     * @param mode
     * @param password
     * @return
     * @throws Exception
     */
    private Cipher getCipher(int mode, String password)
    {
    	//removed for various reasons
                    return null;
    }
    
    public static boolean isOffline()
    {
    	try
    	{
    		URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/");
                DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance();
                DocumentBuilder var3 = var2.newDocumentBuilder();
                Document var4 = var3.parse(var1.openStream());
                return false;
    	}
    	catch(Exception e)
    	{
    		return true;
    	}
    }
    

     

    It is possibly to do in a simple mod_ file, but it would be more effective if it is ran before mods are initialized.

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.