use of net.minecraft.text.TranslatableText in project SpeedRunIGT by RedLime.
the class TimerCustomizeScreen method initIGTButtons.
public void initIGTButtons() {
igtOptions.add(addButton(new SliderWidget(width / 2 - 127, height / 2 - 16, 120, 20, new TranslatableText("speedrunigt.option.timer_position.color_red", "IGT").append(" : ").append(String.valueOf(ColorMixer.getRed(drawer.getIGTColor()))), ColorMixer.getRed(drawer.getIGTColor()) / 255.0f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.color_red", "IGT").append(" : ").append(String.valueOf(ColorMixer.getRed(drawer.getIGTColor()))));
}
@Override
protected void applyValue() {
int color = drawer.getIGTColor();
drawer.setIGTColor(ColorMixer.getArgb(ColorMixer.getAlpha(color), (int) (this.value * 255), ColorMixer.getGreen(color), ColorMixer.getBlue(color)));
changed = true;
}
}));
igtOptions.add(addButton(new SliderWidget(width / 2 - 127, height / 2 + 6, 120, 20, new TranslatableText("speedrunigt.option.timer_position.color_green", "IGT").append(" : ").append(String.valueOf(ColorMixer.getGreen(drawer.getIGTColor()))), ColorMixer.getGreen(drawer.getIGTColor()) / 255.0f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.color_green", "IGT").append(" : ").append(String.valueOf(ColorMixer.getGreen(drawer.getIGTColor()))));
}
@Override
protected void applyValue() {
int color = drawer.getIGTColor();
drawer.setIGTColor(ColorMixer.getArgb(ColorMixer.getAlpha(color), ColorMixer.getRed(color), (int) (this.value * 255), ColorMixer.getBlue(color)));
changed = true;
}
}));
igtOptions.add(addButton(new SliderWidget(width / 2 - 127, height / 2 + 28, 120, 20, new TranslatableText("speedrunigt.option.timer_position.color_blue", "IGT").append(" : ").append(String.valueOf(ColorMixer.getBlue(drawer.getIGTColor()))), ColorMixer.getBlue(drawer.getIGTColor()) / 255.0f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.color_blue", "IGT").append(" : ").append(String.valueOf(ColorMixer.getBlue(drawer.getIGTColor()))));
}
@Override
protected void applyValue() {
int color = drawer.getIGTColor();
drawer.setIGTColor(ColorMixer.getArgb(ColorMixer.getAlpha(color), ColorMixer.getRed(color), ColorMixer.getGreen(color), (int) (this.value * 255)));
changed = true;
}
}));
igtOptions.add(addButton(new SliderWidget(width / 2 + 6, height / 2 - 16, 120, 20, new TranslatableText("speedrunigt.option.timer_position.scale", "IGT").append(" : ").append(((int) (drawer.getIGTScale() * 100)) + "%"), drawer.getIGTScale() / 3f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.scale", "IGT").append(" : ").append(((int) (drawer.getIGTScale() * 100)) + "%"));
}
@Override
protected void applyValue() {
drawer.setIGTScale(Math.round((float) this.value * 3f * 20f) / 20f);
changed = true;
}
}));
igtOptions.add(addButton(new ButtonWidget(width / 2 + 6, height / 2 + 6, 120, 20, new TranslatableText("speedrunigt.option.timer_position.text_decorate", "IGT").append(" : ").append(new TranslatableText("speedrunigt.option.timer_position.text_decorate." + drawer.getIGTDecoration().name().toLowerCase(Locale.ROOT))), (ButtonWidget button) -> {
int order = drawer.getIGTDecoration().ordinal();
drawer.setIGTDecoration(TimerDecoration.values()[(++order) % TimerDecoration.values().length]);
changed = true;
button.setMessage(new TranslatableText("speedrunigt.option.timer_position.text_decorate", "IGT").append(" : ").append(new TranslatableText("speedrunigt.option.timer_position.text_decorate." + drawer.getIGTDecoration().name().toLowerCase(Locale.ROOT))));
})));
}
use of net.minecraft.text.TranslatableText in project SpeedRunIGT by RedLime.
the class TimerCustomizeScreen method initBackgroundButtons.
public void initBackgroundButtons() {
backgroundOptions.add(addButton(new SliderWidget(width / 2 - 80, height / 2 - 16, 160, 20, new TranslatableText("speedrunigt.option.timer_position.background_opacity").append(" : ").append((int) (drawer.getBGOpacity() * 100) + "%"), drawer.getBGOpacity()) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.background_opacity").append(" : ").append((int) (drawer.getBGOpacity() * 100) + "%"));
}
@Override
protected void applyValue() {
drawer.setBGOpacity((float) this.value);
changed = true;
}
}));
backgroundOptions.add(addButton(new SliderWidget(width / 2 - 80, height / 2 + 6, 160, 20, new TranslatableText("speedrunigt.option.timer_position.background_padding", "RTA").append(" : ").append(String.valueOf(drawer.getRTAPadding())), (drawer.getRTAPadding() - 1) / 24f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.background_padding", "RTA").append(" : ").append(String.valueOf(drawer.getRTAPadding())));
}
@Override
protected void applyValue() {
drawer.setRTAPadding((int) (this.value * 24) + 1);
changed = true;
}
}));
backgroundOptions.add(addButton(new SliderWidget(width / 2 - 80, height / 2 + 28, 160, 20, new TranslatableText("speedrunigt.option.timer_position.background_padding", "IGT").append(" : ").append(String.valueOf(drawer.getIGTPadding())), (drawer.getIGTPadding() - 1) / 24f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.background_padding", "IGT").append(" : ").append(String.valueOf(drawer.getIGTPadding())));
}
@Override
protected void applyValue() {
drawer.setIGTPadding((int) (this.value * 24) + 1);
changed = true;
}
}));
}
use of net.minecraft.text.TranslatableText in project SpeedRunIGT by RedLime.
the class TimerCustomizeScreen method initRTAButtons.
public void initRTAButtons() {
rtaOptions.add(addButton(new SliderWidget(width / 2 - 127, height / 2 - 16, 120, 20, new TranslatableText("speedrunigt.option.timer_position.color_red", "RTA").append(" : ").append(String.valueOf(ColorMixer.getRed(drawer.getRTAColor()))), ColorMixer.getRed(drawer.getRTAColor()) / 255.0f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.color_red", "RTA").append(" : ").append(String.valueOf(ColorMixer.getRed(drawer.getRTAColor()))));
}
@Override
protected void applyValue() {
int color = drawer.getRTAColor();
drawer.setRTAColor(ColorMixer.getArgb(ColorMixer.getAlpha(color), (int) (this.value * 255), ColorMixer.getGreen(color), ColorMixer.getBlue(color)));
changed = true;
}
}));
rtaOptions.add(addButton(new SliderWidget(width / 2 - 127, height / 2 + 6, 120, 20, new TranslatableText("speedrunigt.option.timer_position.color_green", "RTA").append(" : ").append(String.valueOf(ColorMixer.getGreen(drawer.getRTAColor()))), ColorMixer.getGreen(drawer.getRTAColor()) / 255.0f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.color_green", "RTA").append(" : ").append(String.valueOf(ColorMixer.getGreen(drawer.getRTAColor()))));
}
@Override
protected void applyValue() {
int color = drawer.getRTAColor();
drawer.setRTAColor(ColorMixer.getArgb(ColorMixer.getAlpha(color), ColorMixer.getRed(color), (int) (this.value * 255), ColorMixer.getBlue(color)));
changed = true;
}
}));
rtaOptions.add(addButton(new SliderWidget(width / 2 - 127, height / 2 + 28, 120, 20, new TranslatableText("speedrunigt.option.timer_position.color_blue", "RTA").append(" : ").append(String.valueOf(ColorMixer.getBlue(drawer.getRTAColor()))), ColorMixer.getBlue(drawer.getRTAColor()) / 255.0f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.color_blue", "RTA").append(" : ").append(String.valueOf(ColorMixer.getBlue(drawer.getRTAColor()))));
}
@Override
protected void applyValue() {
int color = drawer.getRTAColor();
drawer.setRTAColor(ColorMixer.getArgb(ColorMixer.getAlpha(color), ColorMixer.getRed(color), ColorMixer.getGreen(color), (int) (this.value * 255)));
changed = true;
}
}));
rtaOptions.add(addButton(new SliderWidget(width / 2 + 6, height / 2 - 16, 120, 20, new TranslatableText("speedrunigt.option.timer_position.scale", "RTA").append(" : ").append(((int) (drawer.getRTAScale() * 100)) + "%"), drawer.getRTAScale() / 3f) {
@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("speedrunigt.option.timer_position.scale", "RTA").append(" : ").append(((int) (drawer.getRTAScale() * 100)) + "%"));
}
@Override
protected void applyValue() {
drawer.setRTAScale(Math.round((float) this.value * 3f * 20f) / 20f);
changed = true;
}
}));
rtaOptions.add(addButton(new ButtonWidget(width / 2 + 6, height / 2 + 6, 120, 20, new TranslatableText("speedrunigt.option.timer_position.text_decorate", "RTA").append(" : ").append(new TranslatableText("speedrunigt.option.timer_position.text_decorate." + drawer.getRTADecoration().name().toLowerCase(Locale.ROOT))), (ButtonWidget button) -> {
int order = drawer.getRTADecoration().ordinal();
drawer.setRTADecoration(TimerDecoration.values()[(++order) % TimerDecoration.values().length]);
changed = true;
button.setMessage(new TranslatableText("speedrunigt.option.timer_position.text_decorate", "RTA").append(" : ").append(new TranslatableText("speedrunigt.option.timer_position.text_decorate." + drawer.getRTADecoration().name().toLowerCase(Locale.ROOT))));
})));
}
use of net.minecraft.text.TranslatableText in project SpeedRunIGT by RedLime.
the class TimerCustomizeScreen method render.
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
saveButton.active = changed;
this.renderBackground(matrices);
drawer.draw();
this.drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 15, 16777215);
if (!hide) {
if (!igtButton.active || !rtaButton.active) {
if (drawer.isLocked()) {
drawCenteredText(matrices, this.textRenderer, new TranslatableText("speedrunigt.option.timer_position.description.lock"), this.width / 2, this.height / 2 - 80, 16777215);
} else {
drawCenteredText(matrices, this.textRenderer, new TranslatableText("speedrunigt.option.timer_position.description"), this.width / 2, this.height / 2 - 80, 16777215);
drawCenteredText(matrices, this.textRenderer, new TranslatableText("speedrunigt.option.timer_position.description.move"), this.width / 2, this.height / 2 - 69, 16777215);
}
}
if (!fontButton.active && client != null) {
int c = fontPage * 3;
FontManagerAccessor fontManager = (FontManagerAccessor) ((MinecraftClientAccessor) client).getFontManager();
for (int i = 0; i < fontSelectButtons.size(); i++) {
if (c + i < availableFonts.size()) {
Identifier fontIdentifier = availableFonts.get(c + i);
LiteralText text = new LiteralText(fontIdentifier.getPath());
if (client != null && fontManager.getFontStorages().containsKey(fontIdentifier)) {
text.setStyle(text.getStyle().withFont(fontIdentifier));
} else {
text.append(new LiteralText(" (Unavailable)")).formatted(Formatting.RED);
}
if (fontIdentifier.toString().equals(drawer.getTimerFont().toString())) {
text.append(" [Selected]").formatted(Formatting.ITALIC);
}
drawCenteredText(matrices, this.textRenderer, text, this.width / 2 - 30, this.height / 2 - 11 + (i * 22), 16777215);
}
}
}
}
super.render(matrices, mouseX, mouseY, delta);
}
use of net.minecraft.text.TranslatableText in project Blockus by Brandcraf06.
the class SpeedBlockItem method appendTooltip.
@Override
@Environment(EnvType.CLIENT)
public void appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context) {
super.appendTooltip(stack, world, tooltip, context);
this.getBlock().appendTooltip(stack, world, tooltip, context);
tooltip.add((new TranslatableText(Blockus.MOD_ID + ".blockitem.givespeed")).formatted(Formatting.DARK_PURPLE));
}
Aggregations