use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class MixinMultiplayerScreen method init.
@Inject(method = "init", at = @At("RETURN"))
public void init(CallbackInfo ci) {
this.addDrawableChild(new ButtonWidget(2, 2, 75, 20, new LiteralText("Alt Manager"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new AccountManagerScreen());
}));
this.addDrawableChild(new ButtonWidget(79, 2, 75, 20, new LiteralText("TheAltening"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new TheAlteningScreen((MultiplayerScreen) (Object) this));
}));
this.addDrawableChild(new ButtonWidget(156, 2, 75, 20, new LiteralText("MCLeaks"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new MCLeaksScreen((MultiplayerScreen) (Object) this, false));
}));
this.addDrawableChild(new ButtonWidget(width - 77, 2, 75, 20, new LiteralText("Proxy"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new ProxyScreen());
}));
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class MixinSignEditScreen method init.
@Inject(method = "init", at = @At("RETURN"))
public void init(CallbackInfo ci) {
AutoSign autoSign = Feature.get(AutoSign.class);
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 4 + 142, 200, 20, new LiteralText("Set AutoSign Text"), (buttonWidget_1) -> {
autoSign.signText[0] = sign.getTextOnRow(0, false);
autoSign.signText[1] = sign.getTextOnRow(1, false);
autoSign.signText[2] = sign.getTextOnRow(2, false);
autoSign.signText[3] = sign.getTextOnRow(3, false);
finishEditing();
}));
}
use of net.minecraft.client.gui.widget.ButtonWidget in project ViaFabric by ViaVersion.
the class ViaConfigScreen method init.
@Override
protected void init() {
int entries = 0;
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160, this.height / 6 + 24 * (entries >> 1), 150, 20, getClientSideText(), this::onClickClientSide));
entries++;
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160, this.height / 6 + 24 * (entries >> 1), 150, 20, getHideViaButtonText(), this::onHideViaButton));
entries++;
protocolVersion = new TextFieldWidget(this.textRenderer, this.width / 2 - 155 + entries % 2 * 160, this.height / 6 + 24 * (entries >> 1), 150, 20, new TranslatableText("gui.protocol_version_field.name"));
entries++;
protocolVersion.setTextPredicate(ProtocolUtils::isStartOfProtocolText);
protocolVersion.setChangedListener(this::onChangeVersionField);
int clientSideVersion = ViaFabric.config.getClientSideVersion();
protocolVersion.setText(ProtocolUtils.getProtocolName(clientSideVersion));
this.addDrawableChild(protocolVersion);
// noinspection ConstantConditions
if (entries % 2 == 1) {
entries++;
}
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 24 * (entries >> 1), 200, 20, ScreenTexts.DONE, (buttonWidget) -> this.client.setScreen(this.parent)));
}
use of net.minecraft.client.gui.widget.ButtonWidget in project ViaFabric by ViaVersion.
the class ViaConfigScreen method onClickClientSide.
private void onClickClientSide(ButtonWidget widget) {
if (!ViaFabric.config.isClientSideEnabled()) {
MinecraftClient.getInstance().setScreen(new ConfirmScreen(answer -> {
if (answer) {
ViaFabric.config.setClientSideEnabled(true);
// AUTO
ViaFabric.config.setClientSideVersion(-2);
ViaFabric.config.saveConfig();
widget.setMessage(getClientSideText());
}
MinecraftClient.getInstance().setScreen(this);
}, new TranslatableText("gui.enable_client_side.question"), new TranslatableText("gui.enable_client_side.warning"), new TranslatableText("gui.enable_client_side.enable"), new TranslatableText("gui.cancel")));
} else {
ViaFabric.config.setClientSideEnabled(false);
ViaFabric.config.saveConfig();
}
widget.setMessage(getClientSideText());
}
use of net.minecraft.client.gui.widget.ButtonWidget in project ViaFabric by ViaVersion.
the class ViaConfigScreen method init.
@Override
protected void init() {
int entries = 0;
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160, this.height / 6 + 24 * (entries >> 1), 150, 20, getClientSideText(), this::onClickClientSide));
entries++;
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160, this.height / 6 + 24 * (entries >> 1), 150, 20, getHideViaButtonText(), this::onHideViaButton));
entries++;
protocolVersion = new TextFieldWidget(this.textRenderer, this.width / 2 - 155 + entries % 2 * 160, this.height / 6 + 24 * (entries >> 1), 150, 20, new TranslatableText(VERSION_TRANSLATE_ID));
entries++;
protocolVersion.setTextPredicate(ProtocolUtils::isStartOfProtocolText);
protocolVersion.setChangedListener(this::onChangeVersionField);
int clientSideVersion = ViaFabric.config.getClientSideVersion();
protocolVersion.setText(ProtocolUtils.getProtocolName(clientSideVersion));
this.addDrawableChild(protocolVersion);
// noinspection ConstantConditions
if (entries % 2 == 1) {
entries++;
}
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 24 * (entries >> 1), 200, 20, ScreenTexts.DONE, (buttonWidget) -> this.client.setScreen(this.parent)));
}
Aggregations