/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.joml.Matrix3x2f * org.joml.Matrix3x2fc * org.joml.Vector2f * org.jspecify.annotations.Nullable */ package net.minecraft.client.gui; import java.util.Objects; import java.util.function.Consumer; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.TextAlignment; import net.minecraft.client.gui.font.ActiveArea; import net.minecraft.client.gui.font.EmptyArea; import net.minecraft.client.gui.font.TextRenderable; import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.render.state.GuiTextRenderState; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.util.ARGB; import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; import net.minecraft.util.Util; import org.joml.Matrix3x2f; import org.joml.Matrix3x2fc; import org.joml.Vector2f; import org.jspecify.annotations.Nullable; public interface ActiveTextCollector { public static final double PERIOD_PER_SCROLLED_PIXEL = 0.5; public static final double MIN_SCROLL_PERIOD = 3.0; public Parameters defaultParameters(); public void defaultParameters(Parameters var1); default public void accept(int x, int y, FormattedCharSequence text) { this.accept(TextAlignment.LEFT, x, y, this.defaultParameters(), text); } default public void accept(int x, int y, Component text) { this.accept(TextAlignment.LEFT, x, y, this.defaultParameters(), text.getVisualOrderText()); } default public void accept(TextAlignment alignment, int anchorX, int y, Parameters parameters, Component text) { this.accept(alignment, anchorX, y, parameters, text.getVisualOrderText()); } public void accept(TextAlignment var1, int var2, int var3, Parameters var4, FormattedCharSequence var5); default public void accept(TextAlignment alignment, int anchorX, int y, Component text) { this.accept(alignment, anchorX, y, text.getVisualOrderText()); } default public void accept(TextAlignment alignment, int anchorX, int y, FormattedCharSequence text) { this.accept(alignment, anchorX, y, this.defaultParameters(), text); } public void acceptScrolling(Component var1, int var2, int var3, int var4, int var5, int var6, Parameters var7); default public void acceptScrolling(Component message, int centerX, int left, int right, int top, int bottom) { this.acceptScrolling(message, centerX, left, right, top, bottom, this.defaultParameters()); } default public void acceptScrollingWithDefaultCenter(Component message, int left, int right, int top, int bottom) { this.acceptScrolling(message, (left + right) / 2, left, right, top, bottom); } default public void defaultScrollingHelper(Component message, int centerX, int left, int right, int top, int bottom, int lineWidth, int lineHeight, Parameters parameters) { int textTop = (top + bottom - lineHeight) / 2 + 1; int availableMessageWidth = right - left; if (lineWidth > availableMessageWidth) { int maxPosition = lineWidth - availableMessageWidth; double time = (double)Util.getMillis() / 1000.0; double period = Math.max((double)maxPosition * 0.5, 3.0); double alpha = Math.sin(1.5707963267948966 * Math.cos(Math.PI * 2 * time / period)) / 2.0 + 0.5; double pos = Mth.lerp(alpha, 0.0, (double)maxPosition); Parameters localParameters = parameters.withScissor(left, right, top, bottom); this.accept(TextAlignment.LEFT, left - (int)pos, textTop, localParameters, message.getVisualOrderText()); } else { int textX = Mth.clamp(centerX, left + lineWidth / 2, right - lineWidth / 2); this.accept(TextAlignment.CENTER, textX, textTop, message); } } public static void findElementUnderCursor(GuiTextRenderState text, float testX, float testY, final Consumer