use of net.minecraft.text.TranslatableText in project BedrockIfy by juancarloscp52.
the class LevelLoadingScreenMixin method render.
/**
* Draws the loading screen widget and allows to toggle the chunk map loading widget.
*/
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
if (!Bedrockify.getInstance().settings.isLoadingScreenEnabled())
return;
this.renderBackground(matrices);
int xPosition = this.width / 2;
int yPosition = this.height / 2;
LoadingScreenWidget.getInstance().render(matrices, xPosition, yPosition, new TranslatableText("menu.generatingLevel"), null, this.progressProvider.getProgressPercentage());
String string = MathHelper.clamp(this.progressProvider.getProgressPercentage(), 0, 100) + "%";
long l = Util.getMeasuringTimeMs();
if (l - this.field_19101 > 2000L) {
this.field_19101 = l;
NarratorManager.INSTANCE.narrate((new TranslatableText("narrator.loading", new Object[] { string })).getString());
}
if (Bedrockify.getInstance().settings.isShowChunkMapEnabled())
drawChunkMap(matrices, this.progressProvider, xPosition, yPosition + yPosition / 2 + 89 / 4, 1, 0);
info.cancel();
}
use of net.minecraft.text.TranslatableText in project BedrockIfy by juancarloscp52.
the class ChatHudMixin method render.
/**
* Use bedrock-like chat if enabled.
*/
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void render(MatrixStack matrixStack, int ticks, CallbackInfo info) {
if (!settings.isBedrockChatEnabled())
return;
if (!this.isChatHidden()) {
this.processMessageQueue();
int visibleLines = Math.min(this.getVisibleLineCount(), this.getAvailableLines());
int visibleMessagesCount = this.visibleMessages.size();
if (visibleMessagesCount > 0) {
boolean isChatFocused = this.isChatFocused();
int posY = settings.getPositionHUDHeight() + (settings.getPositionHUDHeight() < 50 ? 50 : 0) + (settings.isShowPositionHUDEnabled() ? 10 : 0) + (settings.getFPSHUDoption() == 2 ? 10 : 0) + settings.getScreenSafeArea();
double chatScale = this.getChatScale();
int scaledChatWidth = MathHelper.ceil((double) this.getWidth() / chatScale);
RenderSystem.pushMatrix();
RenderSystem.translatef(settings.getScreenSafeArea(), (float) (48 - MinecraftClient.getInstance().getWindow().getScaledHeight() + (counter1 * (9.0D * chatScale * (this.client.options.chatLineSpacing + 1.0D)))) + posY, 0.0F);
RenderSystem.scaled(chatScale, chatScale, 1.0D);
double textOpacity = this.client.options.chatOpacity * 0.9D + 0.1D;
double backgroundOpacity = this.client.options.textBackgroundOpacity;
double chatLineSpacing1 = 9.0D * (this.client.options.chatLineSpacing + 1.0D);
double chatLineSpacing2 = -8.0D * (this.client.options.chatLineSpacing + 1.0D) + 4.0D * this.client.options.chatLineSpacing;
// Shown messages
counter1 = 0;
for (int i = 0; i + this.scrolledLines < this.visibleMessages.size() && i < visibleLines; ++i) {
ChatHudLine<OrderedText> chatHudLine = this.visibleMessages.get(i + this.scrolledLines);
if (chatHudLine != null) {
int ticksSinceCreation;
ticksSinceCreation = ticks - chatHudLine.getCreationTick();
if (ticksSinceCreation < 200 || isChatFocused) {
double opacityMultiplayer = isChatFocused ? 1.0D : getMessageOpacityMultiplier(ticksSinceCreation);
int finalTextOpacity = (int) (255.0D * opacityMultiplayer * textOpacity);
int finalBackgroundOpacity = (int) (255.0D * opacityMultiplayer * backgroundOpacity);
++counter1;
if (finalTextOpacity > 3) {
double currentMessageHeight = (double) (-i) * chatLineSpacing1;
matrixStack.push();
matrixStack.translate(0, 0, 0);
fill(matrixStack, 0, (int) currentMessageHeight, scaledChatWidth + 4, (int) (currentMessageHeight - chatLineSpacing1), finalBackgroundOpacity << 24);
RenderSystem.enableBlend();
matrixStack.translate(0, 0, 0);
this.client.textRenderer.drawWithShadow(matrixStack, chatHudLine.getText(), 2F, (float) ((int) (currentMessageHeight + chatLineSpacing2)), 16777215 + (finalTextOpacity << 24));
RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
matrixStack.pop();
}
}
}
}
// Unread Messages:
if (!this.messageQueue.isEmpty()) {
int textOpacityFinal = (int) (128.0D * textOpacity);
int backgroundOpacityFinal = (int) (255.0D * backgroundOpacity);
matrixStack.push();
matrixStack.translate(0.0D, 0.0D, 50.0D);
fill(matrixStack, -2, 0, scaledChatWidth + 4, 9, backgroundOpacityFinal << 24);
RenderSystem.enableBlend();
matrixStack.translate(0.0D, 0.0D, 50.0D);
this.client.textRenderer.drawWithShadow(matrixStack, new TranslatableText("chat.queue", this.messageQueue.size()), 2F, 1.0F, 16777215 + (textOpacityFinal << 24));
matrixStack.pop();
RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
}
if (isChatFocused) {
int textSize = 9;
RenderSystem.translatef(-3.0F, 0.0F, 0.0F);
int x = visibleMessagesCount * textSize + visibleMessagesCount;
int renderedMessages = counter1 * textSize + counter1;
int z = this.scrolledLines * renderedMessages / visibleMessagesCount;
int aa = renderedMessages * renderedMessages / x;
if (x != renderedMessages) {
int alpha = z > 0 ? 170 : 96;
int color = this.hasUnreadNewMessages ? 13382451 : 3355562;
fill(matrixStack, 2, -z, 2, -z - aa, color + (alpha << 24));
fill(matrixStack, 4, -z, 1, -z - aa, 13421772 + (alpha << 24));
}
}
RenderSystem.popMatrix();
}
}
info.cancel();
}
use of net.minecraft.text.TranslatableText in project AdvancedChatBox by DarkKronicle.
the class ChatSuggestorGui method formatException.
private static OrderedText formatException(CommandSyntaxException exception) {
Text text = Texts.toText(exception.getRawMessage());
String string = exception.getContext();
return string == null ? text.asOrderedText() : (new TranslatableText("command.context.parse_error", text, exception.getCursor(), string)).asOrderedText();
}
use of net.minecraft.text.TranslatableText in project Biome-Makeover by Lemonszz.
the class DirectionalDataScreen method init.
@Override
protected void init() {
this.client.keyboard.setRepeatEvents(true);
this.buttonDone = this.addButton(new ButtonWidget(this.width / 2 - 4 - 150, 210, 150, 20, ScreenTexts.DONE, (buttonWidget) -> {
this.done();
}));
this.buttonCancel = this.addButton(new ButtonWidget(this.width / 2 + 4, 210, 150, 20, ScreenTexts.CANCEL, (buttonWidget) -> {
this.cancel();
}));
this.inputMetadata = new TextFieldWidget(this.textRenderer, this.width / 2 - 152, 120, 308, 20, new TranslatableText("structure_block.custom_data"));
this.inputMetadata.setMaxLength(128);
this.inputMetadata.setText(initialMeta);
this.children.add(this.inputMetadata);
}
use of net.minecraft.text.TranslatableText in project Moonfix by Kingdom-of-Moon.
the class ConfigScreen method init.
@Override
protected void init() {
super.init();
this.addDrawableChild(new ButtonWidget(this.width / 2 - 154, this.height - 29, 150, 20, new TranslatableText("gui.cancel"), (buttonWidgetx) -> {
ConfigManager.discardConfig();
this.client.setScreen(parentScreen);
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 + 4, this.height - 29, 150, 20, new TranslatableText("gui.done"), (buttonWidgetx) -> {
ConfigManager.applyConfig();
ConfigManager.saveConfig();
this.client.setScreen(parentScreen);
}));
this.configListWidget = new ConfigListWidget(this, this.client);
this.addSelectableChild(this.configListWidget);
// generate configs...
configListWidget.addEntries(Config.values());
}
Aggregations