Skip to content

Commit

Permalink
more compact render text provider
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Jul 20, 2020
1 parent 5dee1a9 commit 0711263
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.glasspane.auther.Auther;
import io.github.glasspane.auther.api.specialized.MojangAuthenticator;
import joptsimple.internal.Strings;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
Expand All @@ -17,8 +18,6 @@
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;

import java.util.Arrays;

@Environment(EnvType.CLIENT)
public class AuthScreen extends Screen {

Expand Down Expand Up @@ -47,11 +46,7 @@ protected void init() {
int y = this.height / 2 - 50;
this.usernameField = this.addButton(new TextFieldWidget(this.textRenderer, x + 2, y + 2, 196, 20, this.usernameField, new TranslatableText("menu.auther.field.username")));
this.passwordField = this.addButton(new TextFieldWidget(this.textRenderer, x + 2, y + 26, 196, 20, this.passwordField, new TranslatableText("menu.auther.field.password")));
this.passwordField.setRenderTextProvider((text, cursorPos) -> {
char[] array = new char[text.length()];
Arrays.fill(array, '*');
return new String(array);
});
this.passwordField.setRenderTextProvider((text, cursorPos) -> Strings.repeat('*', text.length()));
this.addButton(new ButtonWidget(x, y + 48, 200, 20, new TranslatableText("menu.auther.button.login"), button -> {
if (!this.usernameField.getText().trim().isEmpty() && !this.passwordField.getText().trim().isEmpty()) {
this.updating = true;
Expand Down

0 comments on commit 0711263

Please sign in to comment.