use of net.minecraft.client.gui.widget.CheckboxWidget in project databreaker by SuperCoder7979.
the class MixinBackupPromptScreen method init.
/**
* @reason Stop users from loading old worlds. They're better off this way.
* @author SuperCoder79
*/
@Overwrite
public void init() {
if (!dontStop) {
super.init();
this.wrappedText = MultilineText.create(this.textRenderer, this.subtitle, this.width - 50);
int var10000 = this.wrappedText.count() + 1;
this.textRenderer.getClass();
int i = var10000 * 9;
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 80, 124 + i, 150, 20, ScreenTexts.CANCEL, (buttonWidget) -> {
this.client.setScreen(this.parent);
}));
} else {
this.wrappedText = MultilineText.create(this.textRenderer, this.subtitle, this.width - 50);
int var10000 = this.wrappedText.count() + 1;
this.textRenderer.getClass();
int i = var10000 * 9;
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, 100 + i, 150, 20, new TranslatableText("selectWorld.backupJoinConfirmButton"), (buttonWidget) -> {
this.callback.proceed(true, this.eraseCacheCheckbox.isChecked());
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 160, 100 + i, 150, 20, new TranslatableText("selectWorld.backupJoinSkipButton"), (buttonWidget) -> {
this.callback.proceed(false, this.eraseCacheCheckbox.isChecked());
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 80, 124 + i, 150, 20, ScreenTexts.CANCEL, (buttonWidget) -> {
this.client.setScreen(this.parent);
}));
this.eraseCacheCheckbox = new CheckboxWidget(this.width / 2 - 155 + 80, 76 + i, 150, 20, new TranslatableText("selectWorld.backupEraseCache"), false);
if (this.showEraseCacheCheckbox) {
this.addDrawableChild(this.eraseCacheCheckbox);
}
}
}
use of net.minecraft.client.gui.widget.CheckboxWidget in project isometric-renders by gliscowo.
the class RenderScreen method init.
@Override
protected void init() {
super.init();
viewportBeginX = (int) ((this.width - this.height) * 0.5);
viewportEndX = (int) (this.width - (this.width - this.height) * 0.5) + 1;
((ParticleManagerAccessor) client.particleManager).getParticles().clear();
IsometricRenderHelper.allowParticles = false;
buttons.clear();
buildGuiElements();
TextFieldWidget colorField = new TextFieldWidget(client.textRenderer, viewportEndX + 10, 38, 50, 20, Text.of("#0000ff"));
colorField.setTextPredicate(s -> s.matches("^#([A-Fa-f0-9]{0,6})$"));
colorField.setText("#" + String.format("%02X", backgroundColor >> 16) + String.format("%02X", backgroundColor >> 8 & 0xFF) + String.format("%02X", backgroundColor & 0xFF));
colorField.setChangedListener(s -> {
if (s.substring(1).length() < 6)
return;
backgroundColor = Integer.parseInt(s.substring(1), 16);
});
CheckboxWidget playAnimationsCheckbox = new CallbackCheckboxWidget(viewportEndX + 10, 68, Text.of("Animations"), playAnimations, aBoolean -> {
playAnimations = aBoolean;
});
CheckboxWidget playParticlesCheckbox = new CallbackCheckboxWidget(viewportEndX + 10, 93, Text.of("Particles (requires animations)"), tickParticles, aBoolean -> {
tickParticles = aBoolean;
});
CheckboxWidget doHiResCheckbox = new CallbackCheckboxWidget(viewportEndX + 10, 183, Text.of("Use External Renderer"), useExternalRenderer, aBoolean -> {
useExternalRenderer = aBoolean;
});
CheckboxWidget allowMultipleRendersCheckbox = new CallbackCheckboxWidget(viewportEndX + 10, 208, Text.of("Allow Multiple Export Jobs"), allowMultipleNonThreadedJobs, aBoolean -> {
allowMultipleNonThreadedJobs = aBoolean;
});
CheckboxWidget dumpIntoRootCheckbox = new CallbackCheckboxWidget(viewportEndX + 10, 233, Text.of("Dump into root"), dumpIntoRoot, aBoolean -> {
dumpIntoRoot = aBoolean;
});
ButtonWidget clearQueueButton = new ButtonWidget(viewportEndX + 80, 260, 75, 20, Text.of("Clear Queue"), button -> {
ImageExporter.clearQueue();
});
exportButton = new ButtonWidget(viewportEndX + 10, 260, 65, 20, Text.of("Export"), button -> {
if ((ImageExporter.getJobCount() < 1 || allowMultipleNonThreadedJobs)) {
captureScheduled = true;
}
});
TextFieldWidget resolutionField = new TextFieldWidget(client.textRenderer, viewportEndX + 10, 153, 50, 20, Text.of("2048"));
resolutionField.setEditableColor(0x00FF00);
resolutionField.setText(String.valueOf(exportResolution));
resolutionField.setTextPredicate(s -> s.matches("[0-9]{0,5}"));
resolutionField.setChangedListener(s -> {
if (s.length() < 1)
return;
int resolution = Integer.parseInt(s);
if (((resolution != 0) && ((resolution & (resolution - 1)) != 0) || resolution < 16 || resolution > 16384) && !allowInsaneResolutions) {
resolutionField.setEditableColor(0xFF0000);
exportButton.active = false;
} else {
resolutionField.setEditableColor(0x00FF00);
exportResolution = resolution;
exportButton.active = true;
}
});
addButton(colorField);
addButton(playAnimationsCheckbox);
addButton(doHiResCheckbox);
addButton(allowMultipleRendersCheckbox);
addButton(playParticlesCheckbox);
addButton(dumpIntoRootCheckbox);
addButton(resolutionField);
addButton(exportButton);
addButton(clearQueueButton);
}
Aggregations