use of net.minecraft.client.font.TextRenderer in project BedrockIfy by juancarloscp52.
the class LoadingScreenWidget method render.
/**
* Renders the bedrockify loading screen.
* @param matrices Current MatrixStack.
* @param width window width
* @param height window height
* @param title Title of the loading screen.
* @param message Message of the loading screen. Set to null to use a random tip.
* @param progress Loading screen progress. Set to -1 is the screen has no progress bar.
*/
public void render(MatrixStack matrices, int width, int height, Text title, Text message, int progress) {
// If the background cube map is disabled for other screens, manually render the cube map for the loading screen.
if (!Bedrockify.getInstance().settings.isCubemapBackgroundEnabled())
BedrockifyRotatingCubeMapRenderer.getInstance().render();
MinecraftClient client = MinecraftClient.getInstance();
renderLogo(matrices, width, height, client);
renderLoadingWidget(matrices, width, height, client);
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
textRenderer.draw(matrices, title, width - textRenderer.getWidth(title) / 2.0f, height - 9.0f / 2.0f - 32, 76 + (76 << 8) + (76 << 16));
renderTextBody(matrices, width, height, message, textRenderer);
if (progress >= 0) {
renderLoadingBar(matrices, client, width, height, progress);
}
}
use of net.minecraft.client.font.TextRenderer in project WildfireFemaleGenderMod by WildfireRomeo.
the class WildfireButton method renderButton.
@Override
public void renderButton(MatrixStack m, int mouseX, int mouseY, float partialTicks) {
MinecraftClient minecraft = MinecraftClient.getInstance();
TextRenderer font = minecraft.textRenderer;
int clr = 0x444444 + (84 << 24);
if (this.isHovered())
clr = 0x666666 + (84 << 24);
if (!this.active)
clr = 0x222222 + (84 << 24);
if (!transparent)
fill(m, x, y, x + getWidth(), y + height, clr);
font.draw(m, this.getMessage(), x + (this.width / 2) - (font.getWidth(this.getMessage()) / 2) + 1, y + (int) Math.ceil((float) height / 2f) - font.fontHeight / 2, active ? 0xFFFFFF : 0x666666);
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
if (this.isHovered()) {
this.renderTooltip(m, mouseX, mouseY);
}
}
use of net.minecraft.client.font.TextRenderer in project WildfireFemaleGenderMod by WildfireRomeo.
the class WildfireSlider method render.
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if (this.visible) {
RenderSystem.disableDepthTest();
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int clr = 84 << 24;
int xP = x + 4;
Screen.fill(matrices, xP - 2, y + 1, x + this.width - 1, y + this.height - 1, 0x222222 + (128 << 24));
int xPos = x + 4 + (int) (this.value * (float) (this.width - 6));
Screen.fill(matrices, x + 3, y + 2, xPos - 1, y + this.height - 2, 0x222266 + (180 << 24));
int xPos2 = this.x + 2 + (int) (this.value * (float) (this.width - 4));
Screen.fill(matrices, xPos2 - 2, y + 1, xPos2, y + this.height - 1, 0xFFFFFF + (120 << 24));
RenderSystem.enableDepthTest();
TextRenderer font = MinecraftClient.getInstance().textRenderer;
drawCenteredText(matrices, font, getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, this.hovered || changed ? 0xFFFF55 : 0xFFFFFF);
}
}
use of net.minecraft.client.font.TextRenderer in project LittleMaidReBirth-Fabric by SistrScarlet.
the class IFFType method render.
@Environment(EnvType.CLIENT)
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
textRenderer.drawWithShadow(matrices, new TranslatableText(entityType.getTranslationKey()), (float) x + 60, (float) y - textRenderer.fontHeight, 0xFFFFFFFF);
if (renderClashed || !(entity instanceof LivingEntity))
return;
try {
InventoryScreen.drawEntity(x, y, 15, mouseX, mouseY, (LivingEntity) entity);
} catch (Exception e) {
LOGGER.warn("描画処理がクラッシュしました。" + entityType + ":" + entity);
e.printStackTrace();
renderClashed = true;
// 行われない終了処理を行う
// ちょっと強引
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
immediate.draw();
EntityRenderDispatcher entityRenderDispatcher = MinecraftClient.getInstance().getEntityRenderDispatcher();
entityRenderDispatcher.setRenderShadows(true);
RenderSystem.popMatrix();
}
}
use of net.minecraft.client.font.TextRenderer in project Moonfix by Kingdom-of-Moon.
the class BooleanEntry method render.
@Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
// text
TextRenderer textRenderer = client.textRenderer;
int posY = y + entryHeight / 2;
textRenderer.draw(matrices, this.title, (float) x, (float) (posY - 9 / 2), 0xFFFFFF);
// reset button
this.reset.x = x + 260;
this.reset.y = y;
this.reset.active = this.config.configValue != this.config.defaultValue;
this.reset.render(matrices, mouseX, mouseY, tickDelta);
// toggle button
this.toggle.x = x + 175;
this.toggle.y = y;
this.toggle.setMessage(new TranslatableText("gui." + ((boolean) this.config.configValue ? "yes" : "no")));
// if setting is changed
if ((boolean) this.config.configValue != this.initValue)
this.toggle.setMessage(new LiteralText("").styled(ConfigManager.ACCENT_COLOR).append(this.toggle.getMessage()));
this.toggle.render(matrices, mouseX, mouseY, tickDelta);
}
Aggregations