use of net.minecraft.client.gui.widget.ButtonWidget in project Hypnotic-Client by Hypnotic-Development.
the class EditAltScreen method render.
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
usernameField.render(matrices, mouseX, mouseY, delta);
passwordField.render(matrices, mouseX, mouseY, delta);
RenderUtils.drawCenteredStringWithShadow(matrices, textRenderer, status, this.width / 2, this.height / 2 - 100, -1);
if (usernameField.getText().isEmpty() && !usernameField.isFocused())
RenderUtils.drawCenteredStringWithShadow(matrices, textRenderer, "Username", this.width / 2 - 70, this.height / 2 + 6, new Color(100, 100, 100).getRGB());
if (passwordField.getText().isEmpty() && !passwordField.isFocused())
RenderUtils.drawCenteredStringWithShadow(matrices, textRenderer, "Password", this.width / 2 - 70, this.height / 2 + 36, new Color(100, 100, 100).getRGB());
((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, height / 2 + 60, 200, 20, new LiteralText("Confirm"), (button) -> {
this.status = "Edited alt";
alt.setEmail(usernameField.getText());
alt.setPassword(passwordField.getText());
}))).active = true;
((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, height / 2 + 85, 200, 20, new LiteralText("Back"), (button) -> {
MinecraftClient.getInstance().setScreen(previousScreen);
}))).active = true;
super.render(matrices, mouseX, mouseY, delta);
}
use of net.minecraft.client.gui.widget.ButtonWidget in project Hypnotic-Client by Hypnotic-Development.
the class AddAltScreen method init.
@Override
protected void init() {
usernameField = new TextFieldWidget(textRenderer, width / 2 - 100, height / 2, 200, 20, new LiteralText("Username"));
passwordField = new TextFieldWidget(textRenderer, width / 2 - 100, height / 2 + 30, 200, 20, new LiteralText("Password"));
this.addSelectableChild(usernameField);
this.addSelectableChild(passwordField);
((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, height / 2 + 60, 200, 20, new LiteralText("Login"), (button) -> {
this.status = "Trying alt...";
if (accountType == true) {
PremiumAccount alt = new PremiumAccount(usernameField.getText(), passwordField.getText());
Accounts.get().add(alt);
AltsFile.INSTANCE.saveAlts();
this.status = "Added alt " + ColorUtils.green + "\"" + alt.getUsername() + "\"";
} else {
AltsFile.INSTANCE.saveAlts();
// this.status = "Added alt " + ColorUtils.green + "\"" + alt.getUsername() + "\"";
}
}))).active = true;
((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, height / 2 + 85, 200, 20, new LiteralText("Back"), (button) -> {
MinecraftClient.getInstance().setScreen(previousScreen);
}))).active = true;
((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 350, height / 2 + 85, 50, 20, new LiteralText("Add Microsoft"), (button) -> {
MicrosoftLogin.getRefreshToken(refreshToken -> {
if (refreshToken != null) {
MicrosoftAccount account = new MicrosoftAccount(refreshToken);
account.login();
addAccount(account);
}
});
accountType = false;
}))).active = true;
status = "Idle...";
super.init();
}
use of net.minecraft.client.gui.widget.ButtonWidget in project Hypnotic-Client by Hypnotic-Development.
the class AltManagerScreen method render.
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
fill(matrices, 100, 70, width - 100, height - 70, new Color(0, 0, 0, 100).getRGB());
drawStringWithShadow(matrices, textRenderer, MinecraftClient.getInstance().getSession().getProfile().getName(), 20, 20, -1);
RenderUtils.drawCenteredStringWithShadow(matrices, textRenderer, status, width / 2, 20, -1);
((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, height - 50, 200, 20, new LiteralText("Add alt"), (button) -> {
MinecraftClient.getInstance().setScreen(new AddAltScreen(this));
}))).active = true;
int offset = 0;
RenderSystem.enableScissor(10, 10, 1000, 1000);
// GL11.glScissor(10, 10, 100000, 10000);
for (Account<?> alt : Accounts.get()) {
((ButtonWidget) this.addDrawableChild(new ButtonWidget(100, height - 50 + offset, 200, 20, new LiteralText("Login"), (button) -> {
MinecraftClient.getInstance().setScreen(new AddAltScreen(this));
}))).active = true;
drawStringWithShadow(matrices, textRenderer, alt.getUsername(), 100 + 5, offset, -1);
drawStringWithShadow(matrices, textRenderer, alt.getType().name(), 100 + 5, offset + 20, -1);
offset += 50;
}
RenderSystem.disableScissor();
super.render(matrices, mouseX, mouseY, delta);
}
use of net.minecraft.client.gui.widget.ButtonWidget in project AurorasDecorations by LambdAurora.
the class SignPostEditScreen method init.
@Override
protected void init() {
this.client.keyboard.setRepeatEvents(true);
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 4 + 120, 200, 20, ScreenTexts.DONE, button -> this.finishEditing()));
this.selectionManager = new SelectionManager(() -> this.text[this.currentRow], text -> this.text[this.currentRow] = text, SelectionManager.makeClipboardGetter(this.client), SelectionManager.makeClipboardSetter(this.client), text -> this.client.textRenderer.getWidth(text) <= 90);
}
use of net.minecraft.client.gui.widget.ButtonWidget in project LittleMaidReBirth-Fabric by SistrScarlet.
the class LittleMaidScreen method init.
@Override
protected void init() {
super.init();
if (openAt == null) {
client.openScreen(null);
return;
}
int left = (int) ((this.width - backgroundWidth) / 2F) - 5;
int top = (int) ((this.height - backgroundHeight) / 2F);
int size = 20;
int layer = -1;
this.addButton(new ButtonWidget(left - size, top + size * ++layer, size, size, new LiteralText(""), button -> OpenIFFScreenPacket.sendC2SPacket(openAt)) {
@Override
public void renderButton(MatrixStack matrices, int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) {
super.renderButton(matrices, p_renderButton_1_, p_renderButton_2_, p_renderButton_3_);
itemRenderer.renderGuiItemIcon(BOOK, this.x - 8 + this.width / 2, this.y - 8 + this.height / 2);
}
});
this.addButton(new ButtonWidget(left - size, top + size * ++layer, size, size, new LiteralText(""), button -> {
openAt.setConfigHolder(LMConfigManager.INSTANCE.getAnyConfig());
SyncSoundConfigPacket.sendC2SPacket(openAt, openAt.getConfigHolder().getName());
}, (button, matrices, x, y) -> {
String text = openAt.getConfigHolder().getName();
float renderX = Math.max(0, x - textRenderer.getWidth(text) / 2F);
textRenderer.drawWithShadow(matrices, text, renderX, y - textRenderer.fontHeight / 2F, 0xFFFFFF);
}) {
@Override
public void renderButton(MatrixStack matrices, int x, int y, float delta) {
super.renderButton(matrices, x, y, delta);
itemRenderer.renderGuiItemIcon(NOTE, this.x - 8 + this.width / 2, this.y - 8 + this.height / 2);
}
});
this.addButton(new ButtonWidget(left - size, top + size * ++layer, size, size, new LiteralText(""), button -> client.openScreen(new ModelSelectScreen(title, openAt.world, openAt))) {
@Override
public void renderButton(MatrixStack matrices, int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) {
super.renderButton(matrices, p_renderButton_1_, p_renderButton_2_, p_renderButton_3_);
itemRenderer.renderGuiItemIcon(ARMOR, this.x - 8 + this.width / 2, this.y - 8 + this.height / 2);
}
});
this.addButton(new ButtonWidget(left - size, top + size * ++layer, size, size, new LiteralText(""), button -> {
openAt.setMovingState(openAt.getMovingState() == Tameable.MovingState.FREEDOM ? Tameable.MovingState.WAIT : Tameable.MovingState.FREEDOM);
stateText = getStateText();
}) {
@Override
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.renderButton(matrices, mouseX, mouseY, delta);
itemRenderer.renderGuiItemIcon(FEATHER, this.x - 8 + this.width / 2, this.y - 8 + this.height / 2);
}
});
stateText = getStateText();
}
Aggregations