diff --git a/src/openonyx/render/group_w/FormattedText.java b/src/openonyx/render/group_w/FormattedText.java new file mode 100644 index 0000000..b313026 --- /dev/null +++ b/src/openonyx/render/group_w/FormattedText.java @@ -0,0 +1,279 @@ +package openonyx.render.group_w; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import openonyx.render.Render2D; +import openonyx.render.group_e.FontStyle; +import openonyx.render.group_p.ShaderProgram; + +public final class FormattedText { + private static final int[] j; + private static final float m = 0.26F; + private static final float h = 7.0F; + private static final float l = 0.5F; + private static final String I = "0123456789abcdef"; + private static final char d = '§'; + private static final float i = 2.0F; + private static final float f = 0.8F; + private static final float H = 0.12F; + private static final float e = 1.0F; + + static { + int[] ix = new int[16]; + boolean bl = true; + ix[0] = -16777216; + ix[1] = -16777046; + ix[2] = -16733696; + ix[3] = -16733526; + ix[4] = -5636096; + ix[5] = -5635926; + ix[6] = -22016; + ix[7] = -5592406; + ix[8] = -11184811; + ix[9] = -11184641; + ix[10] = -11141291; + ix[11] = -11141121; + ix[12] = -43691; + ix[13] = -43521; + ix[14] = -171; + ix[15] = -1; + j = ix; + } + + private static FormattedTextMode L(FontStyle fontStyle, char c) { + if (fontStyle.L().d(c)) { + return FormattedTextMode.ATLAS; + } else { + return L(c) != null ? FormattedTextMode.ICON : FormattedTextMode.BITMAP; + } + } + + private static float L(FontStyle fontStyle, String string) { + FontStyle fontStyle1 = fontStyle; + FontRenderer fontRenderer; + return (fontRenderer = Minecraft.getMinecraft().fontRendererObj) == null ? 0.0F : fontRenderer.getStringWidth(string) * (fontStyle1.i() / 7.0F); + } + + private static float d(Render2D render2D, FontStyle fontStyle, String string) { + Render2D render2D1 = render2D; + float g = fontStyle.i() / 0.8F; + float fx = 0.0F; + + int ix; + for (int jx = ix = 0; jx < string.length(); jx = ix) { + float hx = render2D1.getIconWidth(L(string.charAt(ix)), g); + ix++; + fx += hx + 1.0F; + } + + return fx; + } + + private static String L(char c) { + switch (c) { + case '☑': + case '✅': + case '✓': + case '✔': + while (false) { + } + + return "\ue5ca"; + case '☒': + case '✕': + case '✖': + case '✗': + case '✘': + case '❌': + return "\ue5cd"; + default: + return null; + } + } + + public static String L(String string) { + String string1 = string; + if (string1 != null && !string1.isEmpty()) { + StringBuilder stringBuilder = new StringBuilder(string1.length()); + + for (int jx = ix = 0; jx < string1.length(); jx = ++ix) { + char c; + if ((c = string1.charAt(ix)) == 167 && ix < string1.length() - 1) { + ix++; + } else { + stringBuilder.append(c); + } + } + + return stringBuilder.toString(); + } else { + return ""; + } + } + + public static float F(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + return l(render2D, fontStyle, string, fx - L(render2D, fontStyle, string), g, ix); + } + + private FormattedText() { + } + + private static int L(float f) { + return (int)(Math.clamp(fx, 0.0F, 1.0F) * 255.0F) << 24; + } + + public static float L(Render2D render2D, FontStyle fontStyle, String string) { + if ((string = L(string)).isEmpty()) { + return 0.0F; + } + + float fx = 0.0F; + int jx = 0; + FormattedTextMode formattedTextMode = L(fontStyle, string.charAt(0)); + + int ix; + for (int k = ix = 1; k <= string.length(); k = ++ix) { + FormattedTextMode formattedTextMode1 = ix < string.length() ? L(fontStyle, string.charAt(ix)) : null; + if (ix >= string.length() || formattedTextMode1 != formattedTextMode) { + String string1 = string.substring(jx, ix); + + fx += switch (formattedTextMode) { + case BITMAP -> { + while (false) { + } + + yield render2D.getTextWidth(fontStyle, string1); + } + case ATLAS -> d(render2D, fontStyle, string1); + case ICON -> L(fontStyle, string1); + }; + jx = ix; + formattedTextMode = formattedTextMode1; + } + } + + return fx; + } + + public static float l(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + if (string != null && !string.isEmpty()) { + int jx = ix & 0xFF000000; + int k = ix; + float hx = fx; + int lx = 0; + + int mx; + for (int o = mx = 0; o < string.length(); o = ++mx) { + if (string.charAt(mx) == 167 && mx < string.length() - 1) { + hx += L(render2D, fontStyle, string, lx, mx, hx, g, k); + char c = Character.toLowerCase(string.charAt(mx + 1)); + int n; + if ((n = "0123456789abcdef".indexOf(c)) >= 0) { + k = jx | j[n] & 16777215; + } else if (c == 'r') { + k = ix; + } + + lx = ++mx + 1; + } + } + + return hx + L(render2D, fontStyle, string, lx, string.length(), hx, g, k) - fx; + } else { + return 0.0F; + } + } + + public static float h(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + if (string != null && !string.isEmpty()) { + String string1 = L(string); + float hx = (ix >>> 24) / 255.0F; + l(render2D, fontStyle, string1, fx + 2.0F, g + 2.0F, L(0.12F * hx)); + l(render2D, fontStyle, string1, fx + 1.0F, g + 1.0F, L(0.26F * hx)); + return l(render2D, fontStyle, string, fx, g, ix); + } else { + return 0.0F; + } + } + + private static float I(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + float hx = fontStyle.i() / 0.8F; + float k = render2D.L(fontStyle, g) - fontStyle.i() / 2.0F; + g = fx; + + int jx; + for (int mx = jx = 0; mx < string.length(); mx = jx) { + String string1; + String string2 = string1 = L(string.charAt(jx)); + float lx = render2D.getIconWidth(string1, hx) + 1.0F; + render2D.drawIcon(string2, g + lx / 2.0F, k, hx, ix); + jx++; + g += lx; + } + + return g - fx; + } + + public static float i(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + return l(render2D, fontStyle, string, fx - L(render2D, fontStyle, string) / 2.0F, g, ix); + } + + private static float D(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + render2D.drawText(fontStyle, string, fx, g, ix); + return render2D.getTextWidth(fontStyle, string); + } + + private static float d(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + Render2D render2D1 = render2D; + FontRenderer fontRenderer; + if ((fontRenderer = Minecraft.getMinecraft().fontRendererObj) == null) { + return 0.0F; + } + + float hx = fontStyle.i() / 7.0F; + float jx = render2D1.L(fontStyle, g) - 7.0F * hx; + ShaderProgram.unbind(); + render2D1.pushMatrix(); + render2D1.translate(fx, jx); + render2D1.scaleAround(hx, 0.0F, 0.0F); + fontRenderer.drawString(string, 0.0F, 0.0F, ix, false); + render2D1.popMatrix(); + return L(fontStyle, string); + } + + private static float L(Render2D render2D, FontStyle fontStyle, String string, int i, int j, float f, float g, int k) { + if (jx <= ix) { + return 0.0F; + } + + float hx = fx; + int lx = ix; + FormattedTextMode formattedTextMode = L(fontStyle, string.charAt(ix)); + + for (int mx = ++ix; mx <= jx; mx = ++ix) { + FormattedTextMode formattedTextMode1 = ix < jx ? L(fontStyle, string.charAt(ix)) : null; + if (ix >= jx || formattedTextMode1 != formattedTextMode) { + String string1 = string.substring(lx, ix); + + hx += switch (formattedTextMode) { + case BITMAP -> { + while (false) { + } + + yield D(render2D, fontStyle, string1, hx, g, k); + } + case ATLAS -> I(render2D, fontStyle, string1, hx, g, k); + case ICON -> d(render2D, fontStyle, string1, hx, g, k); + }; + lx = ix; + formattedTextMode = formattedTextMode1; + } + } + + return hx - fx; + } + + public static float L(Render2D render2D, FontStyle fontStyle, String string, float f, float g, int i) { + return h(render2D, fontStyle, string, fx - L(render2D, fontStyle, string) / 2.0F, g, ix); + } +} diff --git a/src/openonyx/render/group_w/FormattedTextMode.java b/src/openonyx/render/group_w/FormattedTextMode.java new file mode 100644 index 0000000..5987538 --- /dev/null +++ b/src/openonyx/render/group_w/FormattedTextMode.java @@ -0,0 +1,16 @@ +package openonyx.render.group_w; + +enum FormattedTextMode { + BITMAP, + ATLAS, + ICON; + + private static FormattedTextMode[] L() { + FormattedTextMode[] formattedTextModes = new FormattedTextMode[3]; + boolean bl = true; + formattedTextModes[0] = ATLAS; + formattedTextModes[1] = ICON; + formattedTextModes[2] = BITMAP; + return formattedTextModes; + } +} diff --git a/src/openonyx/render/group_w/GuiBlurBackground.java b/src/openonyx/render/group_w/GuiBlurBackground.java new file mode 100644 index 0000000..2980b6b --- /dev/null +++ b/src/openonyx/render/group_w/GuiBlurBackground.java @@ -0,0 +1,176 @@ +package openonyx.render.group_w; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiIngameMenu; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.shader.Framebuffer; +import openonyx.core.OnyxClient; +import openonyx.features.hud.CustomGui; +import openonyx.render.RenderTarget; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.Easings; +import org.lwjgl.opengl.GL11; + +public final class GuiBlurBackground { + private static final Animation ANIMATION = new Animation(1.0F); + private static final float l = 100.0F; + private static boolean I = true; + private static boolean d; + private static final RenderTarget RENDER_TARGET = new RenderTarget(false); + private static boolean f; + private static final float H = 16.0F; + private static long e; + + public static void L(GuiScreen guiScreen) { + GuiScreen guiScreen1 = guiScreen; + if (L(guiScreen1)) { + CustomGui customGui; + if ((customGui = CustomGuiState.L()) != null) { + e = 0L; + ANIMATION.set(0.0F).animateTo(1.0F, customGui.customGuiPart7.duration.getFloat(), Easings.EASING7); + } + } + } + + public static void i() { + if (f) { + GlStateManager.popMatrix(); + f = false; + } else if (d) { + d = false; + Minecraft minecraft = Minecraft.getMinecraft(); + D(minecraft); + d(minecraft); + } + } + + private static float d() { + CustomGui customGui; + float fx = (customGui = CustomGuiState.L()) == null ? 0.92F : customGui.customGuiPart7.scaleFrom.getFloat(); + return fx + (1.0F - fx) * ANIMATION.getValue(); + } + + public static boolean d() { + return d; + } + + public static void D() { + ANIMATION.set(1.0F); + d = false; + f = false; + } + + private GuiBlurBackground() { + } + + private static void D(Minecraft minecraft) { + Minecraft minecraft1 = minecraft; + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); + Framebuffer framebuffer = minecraft1.getFramebuffer(); + if (OpenGlHelper.isFramebufferEnabled() && framebuffer != null) { + framebuffer.bindFramebuffer(true); + } else { + GlStateManager.viewport(0, 0, minecraft1.displayWidth, minecraft1.displayHeight); + } + } + + public static void d() { + d = false; + f = false; + Minecraft minecraft = Minecraft.getMinecraft(); + if (L() && L(minecraft.currentScreen) && !ANIMATION.isFinished()) { + L(); + if (CustomGuiState.L().customGuiPart7.fade.isEnabled() && I && OpenGlHelper.framebufferSupported) { + try { + RENDER_TARGET.resize(minecraft.displayWidth, minecraft.displayHeight); + RENDER_TARGET.bindAndClear(); + d = true; + } catch (Throwable throwable) { + I = false; + RENDER_TARGET.delete(); + OnyxClient.LOGGER.warn("GUI open animation fell back to scaling after a target failure", throwable); + f = true; + L(minecraft); + } + } else { + f = true; + L(minecraft); + } + } + } + + private static void d(Minecraft minecraft) { + Minecraft minecraft1 = minecraft; + ScaledResolution scaledResolution = new ScaledResolution(minecraft1); + float i = scaledResolution.getScaledWidth(); + float g = scaledResolution.getScaledHeight(); + float j = d(); + float h = ANIMATION.getValue(); + float fx = i * (1.0F - j) / 2.0F; + float k = g * (1.0F - j) / 2.0F; + GlStateManager.enableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.disableDepth(); + GlStateManager.disableLighting(); + GlStateManager.bindTexture(RENDER_TARGET.getTexture()); + GlStateManager.tryBlendFuncSeparate(1, 771, 1, 771); + GlStateManager.color(h, h, h, h); + GL11.glBegin(7); + GL11.glTexCoord2f(0.0F, 1.0F); + GL11.glVertex2f(fx, k); + GL11.glTexCoord2f(0.0F, 0.0F); + GL11.glVertex2f(fx, g - k); + GL11.glTexCoord2f(1.0F, 0.0F); + GL11.glVertex2f(i - fx, g - k); + GL11.glTexCoord2f(1.0F, 1.0F); + GL11.glVertex2f(i - fx, k); + GL11.glEnd(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.enableAlpha(); + GlStateManager.enableDepth(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.resetColor(); + } + + private static boolean L() { + CustomGui customGui; + return (customGui = CustomGuiState.L()) != null && customGui.isEnabled() && customGui.customGuiPart7.isEnabled(); + } + + private static boolean L(GuiScreen guiScreen) { + if (guiScreen == null || guiScreen instanceof GuiChat) { + return false; + } else { + return !L() ? false : guiScreen instanceof GuiContainer || guiScreen instanceof GuiIngameMenu; + } + } + + private static void L() { + long lx = System.nanoTime(); + float fx = e == 0L ? 16.0F : Math.min((float)(lx - e) / 1000000.0F, 100.0F); + e = lx; + ANIMATION.update(fx); + } + + private static void L(Minecraft minecraft) { + Minecraft minecraft1 = minecraft; + ScaledResolution scaledResolution = new ScaledResolution(minecraft1); + float fx = scaledResolution.getScaledWidth(); + float h = scaledResolution.getScaledHeight(); + float g = d(); + GlStateManager.pushMatrix(); + GlStateManager.translate(fx / 2.0F, h / 2.0F, 0.0F); + GlStateManager.scale(g, g, 1.0F); + GlStateManager.translate(-fx / 2.0F, -h / 2.0F, 0.0F); + } + + public static float L() { + return L() ? ANIMATION.getValue() : 1.0F; + } +} diff --git a/src/openonyx/render/group_w/GuiElement.java b/src/openonyx/render/group_w/GuiElement.java new file mode 100644 index 0000000..ef97b44 --- /dev/null +++ b/src/openonyx/render/group_w/GuiElement.java @@ -0,0 +1,181 @@ +package openonyx.render.group_w; + +import net.minecraft.client.Minecraft; +import openonyx.core.MinecraftAccess; +import openonyx.history.internal.NumberSetting; +import openonyx.render.Render2D; +import openonyx.render.group_v.IconPaths; +import openonyx.render.group_v.RenderSupport_184; +import openonyx.render.group_v.RoundedShapes; +import openonyx.render.group_v.RoundedShapesData2; +import openonyx.theme.Palette; +import openonyx.theme.ThemeManager; +import org.lwjgl.input.Mouse; + +public abstract class GuiElement implements MinecraftAccess { + protected static final float C = 10.0F; + private boolean J; + private final NumberSetting numberSetting; + private boolean c; + private final NumberSetting numberSetting2; + private float k; + private final String g; + private boolean M; + private static final float L = 7.0F; + private static final float j = 8.0F; + private float m; + private static final float h = 1.0F; + private float l; + private float I; + private float d; + private final NumberSetting numberSetting3; + private RoundedShapesData2 roundedShapesData2; + private float H; + private final RenderSupport_184 renderSupport_184 = new RenderSupport_184(); + + public final void L() { + IconPaths.L(this.g); + this.J = false; + this.c = false; + } + + protected abstract boolean L(boolean bl); + + protected abstract void L(Render2D render2D, float f, float g, float h); + + private boolean L() { + return Mouse.isButtonDown(0); + } + + private void L(Render2D render2D, boolean i) { + Palette palette = ThemeManager.getPalette(); + i = !i && !this.J && !this.c ? palette.outlineVariant() : palette.primary(); + render2D.roundedOutline(this.l, this.H, this.k, this.m, 4.0F, 1.0F, i); + render2D.roundedRect(this.l + this.k - 7.0F, this.H + this.m - 7.0F, 7.0F, 7.0F, 4.0F, i); + } + + public final boolean L(double d, double e) { + return dx >= this.l && dx < this.l + this.k && e >= this.H && e < this.H + this.m; + } + + protected abstract float d(Render2D render2D); + + protected static float L(NumberSetting numberSetting, float f) { + return f <= 0.0F ? 0.0F : (float)(f * numberSettingx.getValue() / 100.0); + } + + protected static void L(NumberSetting numberSetting, float f, float g) { + if (!(gx <= 0.0F)) { + numberSettingx.setValue(Math.clamp(f / gx, 0.0F, 1.0F) * 100.0); + } + } + + private boolean L(boolean bl, float f, float g, float h, float i, float j, float k) { + GuiElement guiElement1 = this; + float lx = Minecraft.getScaledMouseX() * jx / mc.displayWidth; + float mx = kx - Minecraft.getScaledMouseY() * kx / mc.displayHeight - 1.0F; + boolean bl1 = guiElement1.L(); + boolean bl2 = guiElement1.L(lx, mx); + boolean bl3 = lx >= guiElement1.l + guiElement1.k - 7.0F + && lx < guiElement1.l + guiElement1.k + && mx >= guiElement1.H + guiElement1.m - 7.0F + && mx < guiElement1.H + guiElement1.m; + GuiElement guiElement2; + if (bl && bl1) { + if (!guiElement1.M && bl2) { + guiElement1.c = bl3; + guiElement1.J = !bl3; + guiElement1.d = lx - guiElement1.l; + guiElement1.I = mx - guiElement1.H; + } + + guiElement2 = guiElement1; + } else { + guiElement2 = guiElement1; + guiElement1.J = false; + guiElement1.c = false; + guiElement1.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2; + } + + guiElement2.M = bl1; + if (guiElement1.c) { + float n = Math.max(lx - guiElement1.l, mx - guiElement1.H); + f = Math.max(lx - guiElement1.l >= mx - guiElement1.H ? f : gx, 1.0F); + guiElement1.numberSetting.setValue((double)(n / f)); + guiElement1.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2; + return bl2; + } + + if (guiElement1.J) { + guiElement1.roundedShapesData2 = RoundedShapes.L( + lx - guiElement1.d, mx - guiElement1.I, guiElement1.k, guiElement1.m, jx, kx, 10.0F, IconPaths.L(guiElement1.g) + ); + L(guiElement1.numberSetting2, guiElement1.roundedShapesData2.x() - 10.0F, hx); + L(guiElement1.numberSetting3, guiElement1.roundedShapesData2.y() - 10.0F, i); + } + + return bl2; + } + + protected GuiElement(String string, NumberSetting numberSetting, NumberSetting numberSetting1, NumberSetting numberSetting2) { + this.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2; + this.g = string; + this.numberSetting2 = numberSettingx; + this.numberSetting3 = numberSetting1; + this.numberSetting = numberSetting2x; + } + + protected abstract float L(Render2D render2D); + + protected void L(float f) { + } + + public final void L(Render2D render2D, float f, float g, boolean bl) { + GuiElement guiElement1 = this; + float hx = CustomGuiState.D(); + guiElement1.L(hx); + if (!guiElement1.L(bl)) { + IconPaths.L(guiElement1.g); + guiElement1.M = guiElement1.L(); + } else { + float n = guiElement1.numberSetting.getFloat(); + float i = Math.max(8.0F, guiElement1.d(render2D)); + float jx = Math.max(8.0F, guiElement1.L(render2D)); + guiElement1.k = i * n; + guiElement1.m = jx * n; + float kx = f - guiElement1.k - 20.0F; + float lx = gx - guiElement1.m - 20.0F; + guiElement1.l = 10.0F + L(guiElement1.numberSetting2, kx); + guiElement1.H = 10.0F + L(guiElement1.numberSetting3, lx); + IconPaths.L(guiElement1.g, guiElement1.l, guiElement1.H, guiElement1.k, guiElement1.m); + boolean bl1 = guiElement1.L(bl, i, jx, kx, lx, f, gx); + if (bl && bl1 && !guiElement1.J && !guiElement1.c) { + float[] mx; + if ((mx = guiElement1.renderSupport_184.L(true))[0] != 0.0F || mx[1] != 0.0F) { + L(guiElement1.numberSetting2, L(guiElement1.numberSetting2, kx) + mx[0], kx); + L(guiElement1.numberSetting3, L(guiElement1.numberSetting3, lx) + mx[1], lx); + } + } else { + guiElement1.renderSupport_184.L(false); + } + + float o = guiElement1.numberSetting.getFloat(); + guiElement1.k = i * o; + guiElement1.m = jx * o; + guiElement1.l = 10.0F + L(guiElement1.numberSetting2, kx); + guiElement1.H = 10.0F + L(guiElement1.numberSetting3, lx); + if (guiElement1.J || guiElement1.c) { + RoundedShapes.L(render2D, f, gx, guiElement1.roundedShapesData2); + } + + render2D.pushMatrix(); + render2D.translate(guiElement1.l, guiElement1.H); + render2D.scaleAround(o, 0.0F, 0.0F); + guiElement1.L(render2D, i, jx, hx); + render2D.popMatrix(); + if (bl) { + guiElement1.L(render2D, bl1); + } + } + } +} diff --git a/src/openonyx/render/group_w/HotbarElement.java b/src/openonyx/render/group_w/HotbarElement.java new file mode 100644 index 0000000..061f523 --- /dev/null +++ b/src/openonyx/render/group_w/HotbarElement.java @@ -0,0 +1,245 @@ +package openonyx.render.group_w; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import openonyx.features.hud.CustomGui; +import openonyx.render.Render2D; +import openonyx.render.RenderSupport_120; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.ColorAnimation; +import openonyx.render.group_d.Easings; +import openonyx.render.group_e.FontFamilyMode; +import openonyx.render.group_e.FontStyle; +import openonyx.render.group_e.TargetHudTextSettingsWeightMode; +import openonyx.theme.AlphaLevels; +import openonyx.theme.Fonts; +import openonyx.theme.Palette; +import openonyx.theme.ThemeManager; + +public final class HotbarElement { + private static final float W = 7.0F; + private static final int P = 9; + private final CustomGui customGui; + private float R; + private static final float p = 22.0F; + private static final float t = 3.0F; + private static final float b = 2.5F; + private static final float E = 16.0F; + private final ItemStack[] itemStacks; + private static final float G = 4.0F; + private final Animation animation; + private static final FontStyle FONT_STYLE = new FontStyle(FontFamilyMode.PT9, TargetHudTextSettingsWeightMode.BOLD, 9.0F, 11.0F); + private final Animation[] animations; + private static final float C = 0.0F; + private static final int J = 134217728; + private static final float D = 6.0F; + private static final float c = 1.5F; + private static final float a = 2.0F; + private static final float k = 0.5F; + private static final int g = -11740828; + private static final float M = 4.0F; + private float L; + private float j; + private static final float m = 0.55F; + private static final float h = 0.0F; + private static final float l = 1.0F; + private static final float I = 2.0F; + private static final float d = 1.0F; + private float i; + private static final int f = -50384; + private static final int H = 3; + private static final float e = 4.0F; + + public void L(Render2D render2D, float f, float g, float h) { + HotbarElement hotbarElement1 = this; + Minecraft minecraft; + EntityPlayerSP entityPlayerSP; + if ((entityPlayerSP = (minecraft = Minecraft.getMinecraft()).thePlayer) != null) { + float kx = hotbarElement1.customGui.customGuiPart4.scale.getFloat(); + float ix = 204.0F; + float jx = 28.0F; + hotbarElement1.j = ix * kx; + hotbarElement1.R = jx * kx; + hotbarElement1.L(entityPlayerSP, hx); + hotbarElement1.i = (fx - hotbarElement1.j) / 2.0F; + hotbarElement1.L = (fx = gx - 4.0F - hotbarElement1.R - RenderSupport_202.L()) - hotbarElement1.L(entityPlayerSP, minecraft) * kx; + RenderSupport_120.L(hotbarElement1.customGui.customGuiPart4.blur.isEnabled()); + render2D.pushMatrix(); + render2D.translate(hotbarElement1.i, fx); + render2D.scaleAround(kx, 0.0F, 0.0F); + hotbarElement1.L(render2D, minecraft, entityPlayerSP, ix, jx); + render2D.popMatrix(); + } + } + + private void L(Render2D render2D, Palette palette, Minecraft minecraft, EntityPlayer entityPlayer, float f) { + if (L(minecraft)) { + float hx = fx - 0.0F; + float gx = -10.0F; + render2D.roundedRect(0.0F, gx, hx, 6.0F, Float.MAX_VALUE, palette.surfaceContainerHighest()); + float ix; + if ((ix = hx * Math.clamp(entityPlayer.experience, 0.0F, 1.0F)) > 0.5F) { + render2D.roundedRect(0.0F, gx, ix, 6.0F, Float.MAX_VALUE, palette.tertiary()); + } + + if (entityPlayer.experienceLevel > 0) { + float jx = gx - 1.0F - Fonts.FONT_STYLE12.lineHeight() / 2.0F; + render2D.drawTextCenteredVCentered(Fonts.FONT_STYLE12, String.valueOf(entityPlayer.experienceLevel), fx / 2.0F, jx, palette.tertiary()); + } + } + } + + private void L(Render2D render2D, Minecraft minecraft, EntityPlayer entityPlayer, float f, float g) { + Palette palette = ThemeManager.getPalette(); + int ix = AlphaLevels.L(3, palette); + render2D.shadow(0.0F, 0.0F, fx, gx, 7.0F, 3); + RenderSupport_120.L(render2D, 0.0F, 0.0F, fx, gx, 7.0F, ix, this.customGui.customGuiPart4.blur.isEnabled()); + gx = 22.0F; + float hx; + render2D.roundedRect(hx = 3.0F + this.animation.getValue() * 22.0F + 0.0F, 3.0F, gx, gx, 7.0F, ThemeManager.withAlpha(palette.primary(), 0.28F)); + render2D.roundedOutline(hx, 3.0F, gx, gx, 7.0F, 1.5F, palette.primary()); + + for (int kx = jx = 0; kx < 9; kx = jx) { + this.L(render2D, palette, entityPlayer.inventory.mainInventory[jx], jx++); + } + + this.L(render2D, palette, minecraft, entityPlayer, fx); + } + + private void L(Render2D render2D, ItemStack itemStack, float f, float g) { + float jx = 1.0F - (float)itemStack.getItemDamage() / itemStack.getMaxDamage(); + float hx = 12.0F; + fx -= hx / 2.0F; + gx = gx + 8.0F - 2.0F - 2.0F; + render2D.roundedRect(fx, gx, hx, 2.0F, Float.MAX_VALUE, -1728053248); + float ix; + if (!((ix = hx * jx) <= 0.5F)) { + render2D.roundedRect(fx, gx, ix, 2.0F, Float.MAX_VALUE, ColorAnimation.L(-50384, -11740828, jx)); + } + } + + private static boolean L(Minecraft minecraft) { + return minecraft.playerController.gameIsSurvivalOrAdventure() && !minecraft.thePlayer.isRidingHorse(); + } + + public float D() { + return this.i; + } + + private static boolean L(ItemStack itemStack, ItemStack itemStack1) { + if (itemStack != null && itemStack1 != null) { + return itemStack.getItem() != itemStack1.getItem() ? true : !itemStack1.isItemStackDamageable() && itemStack.getMetadata() != itemStack1.getMetadata(); + } else { + return itemStack != itemStack1; + } + } + + public boolean L() { + HotbarElement hotbarElement1 = this; + Minecraft minecraft = Minecraft.getMinecraft(); + return hotbarElement1.customGui.isEnabled() + && hotbarElement1.customGui.customGuiPart4.isEnabled() + && minecraft.thePlayer != null + && !minecraft.playerController.isSpectator(); + } + + public float d() { + return this.L; + } + + public float L() { + return this.i + this.j; + } + + public void L() { + HotbarElement hotbarElement1 = this; + hotbarElement1.animation.set(0.0F); + int ix = 0; + + for (int jx = ix; jx < 9; jx = ix) { + hotbarElement1.animations[ix].set(1.0F); + hotbarElement1.itemStacks[ix++] = null; + } + } + + private void L(EntityPlayer entityPlayer, float f) { + HotbarElement hotbarElement1 = this; + int ix = entityPlayer.inventory.currentItem; + HotbarElement hotbarElement2; + if (hotbarElement1.customGui.customGuiPart4.slotGlide.isEnabled()) { + hotbarElement1.animation.animateTo(ix, 200.0F, Easings.EASING2); + hotbarElement1.animation.update(fx); + hotbarElement2 = hotbarElement1; + } else { + hotbarElement1.animation.set(ix); + hotbarElement2 = hotbarElement1; + } + + boolean bl = hotbarElement2.customGui.customGuiPart4.itemPop.isEnabled(); + + for (int kx = jx = 0; kx < 9; kx = jx) { + ItemStack itemStack = entityPlayer.inventory.mainInventory[jx]; + if (L(hotbarElement1.itemStacks[jx], itemStack)) { + hotbarElement1.itemStacks[jx] = itemStack; + if (bl && itemStack != null) { + hotbarElement1.animations[jx].set(0.55F).animateTo(1.0F, 250.0F, Easings.EASING2); + } + } + + hotbarElement1.animations[jx++].update(fx); + } + } + + private float L(EntityPlayer entityPlayer, Minecraft minecraft) { + return L(minecraft) ? 10.0F : 0.0F; + } + + private void L(Render2D render2D, Palette palette, ItemStack itemStack, int i) { + if (itemStack != null && itemStack.getItem() != null) { + float fx = 3.0F + ix * 22.0F + 11.0F; + float gx = 14.0F; + float kx = this.animations[ix].getValue(); + render2D.pushMatrix(); + render2D.scaleAround(kx, fx, gx); + render2D.L(fx - 8.0F + 4.0F, gx - 8.0F + 4.0F, 8.0F, 8.0F, 4.0F, 2.5F, 1.0F, 134217728); + render2D.drawItem(itemStack, fx - 8.0F, gx - 8.0F); + render2D.popMatrix(); + if (itemStack.stackSize > 1) { + String string = String.valueOf(itemStack.stackSize); + float hx = fx + 8.0F; + float jx = gx + 8.0F - 1.5F; + FormattedText.h( + render2D, FONT_STYLE, string, hx - render2D.getTextWidth(FONT_STYLE, string), render2D.centerTextY(FONT_STYLE, jx), palette.onSurface() + ); + } + + if (itemStack.isItemDamaged()) { + this.L(render2D, itemStack, fx, gx); + } + } + } + + public HotbarElement(CustomGui customGui) { + int kx = 121 & 15; + super(); + this.animation = new Animation(0.0F); + Animation[] animations1 = new Animation[kx]; + boolean bl = true; + this.animations = animations1; + ItemStack[] itemStacksx = new ItemStack[9]; + bl = true; + this.itemStacks = itemStacksx; + int jx = 0; + this.customGui = customGuix; + + for (int ix = 0; jx < 9; jx = ix) { + Animation[] animationsx = this.animations; + kx = ix; + Animation animationx = new Animation(1.0F); + ix++; + animationsx[kx] = animationx; + } + } +}