Jump to content

Recommended Posts

Posted

Hey, everyone!

 

Is it possible to set the username via the command line when I do:

 

gradlew runClient

 

I want to be able to type something at the end of that so that I can set the player's username.

The reason I am doing it this way is because I want to set the username to be the computer's name (Which I can get from a CMD with "localhost").

 

If possible, how would I do this through the build.gradle? I know I can do something like:

 

runClient {
    jvmArgs "-Xmx1024m", "-Xms1024m"
	args = [username, 'NAMEHERE'] //I know this is wrong, I need help with this.
}

 

All your help is appreciated, thank you!

Posted (edited)

Can I ask what you're trying to achieve with this, as setting the account wont completely work without giving the password as well.

Edited by DaemonUmbra

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

This will only work in your development environment but;

Change your build.gradle to this:

run {
    if (project.hasProperty("appArgs")) {
        args Eval.me(appArgs)
    }
}

Then to run: gradle run :

-PappArgs="['--username DamianPilot382']"

 

Posted
  On 5/16/2018 at 2:45 AM, MDW01 said:

This will only work in your development environment but;

Change your build.gradle to this:

run {
    if (project.hasProperty("appArgs")) {
        args Eval.me(appArgs)
    }
}

Then to run: gradle run :

-PappArgs="['--username DamianPilot382']"

 

Expand  

Thank you so much for you help. It is still not working. This is what I am doing:

 

My build.gradle looks like this: https://pastebin.com/LUVFJvhy (The part you suggested is at the bottom)

 

And when I open a command prompt and navigate to my forge folder, I type:

gradlew runClient -PappArgs="['--username DamianPilot382']"

 

When I run it, it gives me no errors, yet the name is still "player###." At the beginning of the launch, I see this in the log:

 

[21:51:10] [main/INFO] [GradleStart]: Extra: [--username DamianPilot382]
[21:51:10] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Pilot/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --username DamianPilot382, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

 

Again, thank you for your help!

 

P.S. I tried adding a coma in between "--username" and "DamianPilot382" and it didn't work.

Posted
  On 5/16/2018 at 3:08 PM, MDW01 said:

You may have to add:

To your build.gradle

Expand  

Awesome, where would i put it? I tried placing it at the top underneath "apply plugin: 'net.minecraftforge.gradle.forge'" and then inside of here:

 

run {
	apply plugin: 'java'
    if (project.hasProperty("appArgs")) {
        args Eval.me(appArgs)
    }
}

 

Thanks for your help

Posted
  On 5/16/2018 at 2:05 AM, DaemonUmbra said:

Can I ask what you're trying to achieve with this, as setting the account wont completely work without giving the password as well.

Expand  

My end goal is to set the username for the player to the computer's name. But to do that, I have to figure out how to set the username through command line first.

 

Thanks for your help!

Posted

@DaemonUmbra You are incorrect. You shouldn't try to help someone if you don't understand the topic and then remove your posts saying you need to do more research. Just don't post in the first place. What he is asking is how he can change the username in his dev workspace instead of having player###. He is not asking how to change the username of players playing the mod or how to make it so he can access an online server from his dev workspace which would require a password.

 

As for setting the username I completely forgot that forge uses runClient instead of run.

runClient {
    if (project.hasProperty("appArgs")) {
        args Eval.me(appArgs)
    }
}

 Hope this helped.

Posted

I know how to do it, I was testing how complete the effect would be and beyond vanity, i.e. the display name, there seem to be no other changes unless a password is also provided.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.