/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.joml.Matrix3x2fc * org.jspecify.annotations.Nullable */ package net.minecraft.client.gui.render.state; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.render.state.ScreenArea; import net.minecraft.util.FormattedCharSequence; import org.joml.Matrix3x2fc; import org.jspecify.annotations.Nullable; public final class GuiTextRenderState implements ScreenArea { public final Font font; public final FormattedCharSequence text; public final Matrix3x2fc pose; public final int x; public final int y; public final int color; public final int backgroundColor; public final boolean dropShadow; final boolean includeEmpty; public final @Nullable ScreenRectangle scissor; private @Nullable Font.PreparedText preparedText; private @Nullable ScreenRectangle bounds; public GuiTextRenderState(Font font, FormattedCharSequence text, Matrix3x2fc pose, int x, int y, int color, int backgroundColor, boolean dropShadow, boolean includeEmpty, @Nullable ScreenRectangle scissor) { this.font = font; this.text = text; this.pose = pose; this.x = x; this.y = y; this.color = color; this.backgroundColor = backgroundColor; this.dropShadow = dropShadow; this.includeEmpty = includeEmpty; this.scissor = scissor; } public Font.PreparedText ensurePrepared() { if (this.preparedText == null) { this.preparedText = this.font.prepareText(this.text, this.x, this.y, this.color, this.dropShadow, this.includeEmpty, this.backgroundColor); ScreenRectangle bounds = this.preparedText.bounds(); if (bounds != null) { bounds = bounds.transformMaxBounds(this.pose); this.bounds = this.scissor != null ? this.scissor.intersection(bounds) : bounds; } } return this.preparedText; } @Override public @Nullable ScreenRectangle bounds() { this.ensurePrepared(); return this.bounds; } }