/* */ package fun.rich.client.ui.clickgui.component.impl;
/* */ import fun.rich.client.feature.Feature;
/* */ import fun.rich.client.feature.impl.hud.ClickGUI;
/* */ import fun.rich.client.ui.clickgui.ClickGuiScreen;
/* */ import fun.rich.client.ui.clickgui.component.Component;
/* */ import fun.rich.client.ui.clickgui.component.ExpandableComponent;
/* */ import fun.rich.client.ui.components.SorterHelper;
/* */ import fun.rich.client.ui.settings.Setting;
/* */ import fun.rich.client.ui.settings.impl.*;
/* */
/* */
/* */
/* */ import fun.rich.client.utils.math.TimerHelper;
/* */ import fun.rich.client.utils.render.RenderUtils;
/* */ import java.awt.Color;
/* */ import java.util.Comparator;
/* */ import net.minecraft.client.Minecraft;
/* */ import net.minecraft.client.gui.ScaledResolution;
/* */ import org.lwjgl.input.Keyboard;
/* */
/* */ public final class ModuleComponent extends ExpandableComponent {
/* 22 */ Minecraft mc = Minecraft.getMinecraft();
/* */ private final Feature module;
/* 24 */ public static TimerHelper timerHelper = new TimerHelper();
/* */ private boolean binding;
/* 26 */ int alpha = 0;
/* 27 */ private final TimerHelper descTimer = new TimerHelper();
/* */ public boolean ready;
/* */
/* 30 */ public ModuleComponent(Component parent, Feature module, int x, int y, int width, int height) { super(parent, module.getLabel(), x, y, width, height);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 49 */ this.ready = false; this.module = module; int propertyX = 1; for (Setting setting : module.getSettings()) { if (setting instanceof BooleanSetting) { this.components.add(new BooleanSettingComponent((Component)this, (BooleanSetting)setting, propertyX, height, width - 2, 21)); continue; } if (setting instanceof ColorSetting) { this.components.add(new ColorPickerComponent((Component)this, (ColorSetting)setting, propertyX, height, width - 2, 15)); continue; } if (setting instanceof NumberSetting) { this.components.add(new NumberSettingComponent((Component)this, (NumberSetting)setting, propertyX, height, width - 2, 20)); continue; } if (setting instanceof ListSetting) { this.components.add(new ListSettingComponent((Component)this, (ListSetting)setting, propertyX, height, width - 2, 17)); continue; } if (setting instanceof MultipleBoolSetting)
/* 50 */ this.components.add(new MultipleBoolSettingComponent((Component)this, (MultipleBoolSetting)setting, propertyX, height, width - 2, 16)); } } static String i = " ";
/* */
/* */ String getI(String s) {
/* 53 */ if (!timerHelper.hasReached(5.0D)) {
/* 54 */ return i;
/* */ }
/* 56 */ timerHelper.reset();
/* */
/* 58 */ if (i.length() < s.length()) {
/* 59 */ this.ready = false;
/* 60 */ return i += i;
/* */ }
/* 62 */ this.ready = true;
/* 63 */ return i;
/* */ }
/* */
/* */
/* */ public void drawComponent(ScaledResolution scaledResolution, int mouseX, int mouseY) {
/* 68 */ this.components.sort((Comparator)new SorterHelper());
/* 69 */ float x = getX();
/* 70 */ float y = (getY() - 2);
/* 71 */ int width = getWidth();
/* 72 */ int height = getHeight();
/* 73 */ if (isExpanded()) {
/* 74 */ int childY = 15;
/* 75 */ for (Component child : this.components) {
/* 76 */ int cHeight = child.getHeight();
/* 77 */ if (child instanceof BooleanSettingComponent) {
/* 78 */ BooleanSettingComponent booleanSettingComponent = (BooleanSettingComponent)child;
/* 79 */ if (!booleanSettingComponent.booleanSetting.isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 83 */ if (child instanceof NumberSettingComponent) {
/* 84 */ NumberSettingComponent numberSettingComponent = (NumberSettingComponent)child;
/* 85 */ if (!numberSettingComponent.numberSetting.isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* */
/* 90 */ if (child instanceof ColorPickerComponent) {
/* 91 */ ColorPickerComponent colorPickerComponent = (ColorPickerComponent)child;
/* 92 */ if (!colorPickerComponent.getSetting().isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 96 */ if (child instanceof ListSettingComponent) {
/* 97 */ ListSettingComponent listSettingComponent = (ListSettingComponent)child;
/* 98 */ if (!listSettingComponent.getSetting().isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 102 */ if (child instanceof ExpandableComponent) {
/* 103 */ ExpandableComponent expandableComponent = (ExpandableComponent)child;
/* 104 */ if (expandableComponent.isExpanded()) cHeight = expandableComponent.getHeightWithExpand();
/* */ }
/* 106 */ child.setY(childY);
/* 107 */ child.drawComponent(scaledResolution, mouseX, mouseY);
/* 108 */ childY += cHeight;
/* */ }
/* */ }
/* 111 */ if (!ClickGuiScreen.search.getText().isEmpty() && !this.module.getLabel().toLowerCase().contains(ClickGuiScreen.search.getText().toLowerCase()))
/* */ return;
/* 113 */ Color color = new Color(ClickGUI.color.getColorValue());
/* 114 */ Color color2 = new Color(color.getRed(), color.getGreen(), color.getBlue(), 140);
/* 115 */ boolean hovered = isHovered(mouseX, mouseY);
/* */
/* */
/* 118 */ if (this.components.size() > 0.5D) {
/* 119 */ this.mc.rubik_18.drawStringWithShadow(isExpanded() ? "?" : "?", (x + width - 8.5F), (y + height / 2.0F) - 3.5D, -1);
/* */ }
/* */
/* 122 */ this.components.sort((Comparator)new SorterHelper());
/* 123 */ if (hovered && this.module.getDesc() != null) {
/* 124 */ RenderUtils.drawShadow(5.0F, 1.0F, () -> {
/* */ ScaledResolution sr = new ScaledResolution(this.mc);
/* */
/* */
/* */ if (!hovered) {
/* */ i = " ";
/* */ }
/* */
/* */ RenderUtils.drawRect((sr.getScaledWidth() / 2 - this.mc.sfui16.getStringWidth(this.module.getDesc()) / 2 - 10), (sr.getScaledHeight() - 25), (sr.getScaledWidth() / 2 + this.mc.rubik_16.getStringWidth(this.module.getDesc()) / 2 + 10), sr.getScaledHeight(), (new Color(0, 0, 0, 150)).getRGB());
/* */
/* */ this.mc.rubik_16.drawCenteredStringWithShadow((this.module == null) ? "null pointer :(" : getI(this.module.getDesc()), sr.getScaledWidth() / 2.0F, (sr.getScaledHeight() - 10), -1);
/* */
/* */ RenderUtils.drawRect((sr.getScaledWidth() / 2 - this.mc.sfui16.getStringWidth(this.module.getDesc()) / 2 - 10), (sr.getScaledHeight() - 25), (sr.getScaledWidth() / 2 + this.mc.rubik_16.getStringWidth(this.module.getDesc()) / 2 + 10), (sr.getScaledHeight() - 26), color2.getRGB());
/* */
/* */ if (!ClickGUI.potato_mode.getBoolValue()) {
/* */ this.mc.rubik_16.drawCenteredBlurredString(this.module.getLabel(), (sr.getScaledWidth() / 2), (sr.getScaledHeight() - 21), 8, new Color(255, 255, 255, 255), -1);
/* */ } else {
/* */ this.mc.rubik_16.drawCenteredString(this.module.getLabel(), (sr.getScaledWidth() / 2), (sr.getScaledHeight() - 21), -1);
/* */ }
/* */ });
/* */
/* 145 */ ScaledResolution sr = new ScaledResolution(this.mc);
/* */
/* 147 */ if (!hovered) {
/* 148 */ i = " ";
/* */ }
/* 150 */ RenderUtils.drawRect((sr.getScaledWidth() / 2 - this.mc.rubik_16.getStringWidth(this.module.getDesc()) / 2 - 10), (sr.getScaledHeight() - 25), (sr.getScaledWidth() / 2 + this.mc.rubik_16.getStringWidth(this.module.getDesc()) / 2 + 10), sr.getScaledHeight(), (new Color(0, 0, 0, 150)).getRGB());
/* 151 */ this.mc.rubik_16.drawCenteredStringWithShadow((this.module == null) ? "null pointer :(" : getI(this.module.getDesc()), sr.getScaledWidth() / 2.0F, (sr.getScaledHeight() - 10), -1);
/* */
/* */
/* 154 */ RenderUtils.drawRect((sr.getScaledWidth() / 2 - this.mc.rubik_16.getStringWidth(this.module.getDesc()) / 2 - 10), (sr.getScaledHeight() - 25), (sr.getScaledWidth() / 2 + this.mc.rubik_16.getStringWidth(this.module.getDesc()) / 2 + 10), (sr.getScaledHeight() - 26), color2.getRGB());
/* 155 */ if (!ClickGUI.potato_mode.getBoolValue()) {
/* 156 */ this.mc.rubik_16.drawCenteredBlurredString(this.module.getLabel(), (sr.getScaledWidth() / 2), (sr.getScaledHeight() - 21), 8, new Color(255, 255, 255, 255), -1);
/* */ } else {
/* */
/* 159 */ this.mc.rubik_16.drawCenteredString(this.module.getLabel(), (sr.getScaledWidth() / 2), (sr.getScaledHeight() - 21), -1);
/* */ }
/* */
/* 162 */ if (this.module == null) { i = ""; }
/* */
/* 164 */ else if (this.ready && !i.equals(this.module.getDesc())) { i = ""; }
/* */
/* */ } else {
/* 167 */ this.ready = false;
/* */ }
/* */
/* 170 */ if (this.module.isEnabled()) {
/* */
/* 172 */ if (!ClickGUI.potato_mode.getBoolValue() && ClickGUI.glow.getBoolValue()) {
/* 173 */ this.mc.rubik_16.drawCenteredBlurredStringWithShadow(this.binding ? ("Press a key.. " + Keyboard.getKeyName(this.module.getBind())) : getName(), (x + 53.5F), (y + height / 2.0F - 3.0F), (int)ClickGUI.glowRadius2.getNumberValue(), this.module.isEnabled() ? RenderUtils.injectAlpha(new Color((new Color(color.getRed(), color.getGreen(), color.getBlue())).getRGB()), 100) : Color.GRAY, this.module.isEnabled() ? ClickGUI.color.getColorValue() : Color.GRAY.getRGB());
/* */ } else {
/* 175 */ this.mc.rubik_16.drawCenteredStringWithShadow(this.binding ? ("Press a key.. " + Keyboard.getKeyName(this.module.getBind())) : getName(), x + 53.5F, y + height / 2.0F - 3.0F, this.module.isEnabled() ? color.getRGB() : Color.GRAY.getRGB());
/* */ }
/* */ } else {
/* 178 */ this.mc.rubik_16.drawCenteredStringWithShadow(this.binding ? ("Press a key.. " + Keyboard.getKeyName(this.module.getBind())) : getName(), x + 53.5F, y + height / 2.0F - 3.0F, this.module.isEnabled() ? (new Color(color.getRGB())).getRGB() : Color.GRAY.getRGB());
/* */ }
/* */ }
/* */
/* */
/* */ public boolean canExpand() {
/* 184 */ return !this.components.isEmpty();
/* */ }
/* */
/* */
/* */ public void onPress(int mouseX, int mouseY, int button) {
/* 189 */ switch (button) {
/* */ case 0:
/* 191 */ this.module.toggle();
/* */ break;
/* */ case 2:
/* 194 */ this.binding = !this.binding;
/* */ break;
/* */ }
/* */ }
/* */
/* */
/* */ public void onKeyPress(int keyCode) {
/* 201 */ if (this.binding) {
/* 202 */ ClickGuiScreen.escapeKeyInUse = true;
/* 203 */ this.module.setBind((keyCode == 211) ? 0 : keyCode);
/* 204 */ this.binding = false;
/* */ }
/* */ }
/* */
/* */
/* */ public int getHeightWithExpand() {
/* 210 */ int height = getHeight();
/* 211 */ if (isExpanded()) {
/* 212 */ for (Component child : this.components) {
/* 213 */ int cHeight = child.getHeight();
/* 214 */ if (child instanceof BooleanSettingComponent) {
/* 215 */ BooleanSettingComponent booleanSettingComponent = (BooleanSettingComponent)child;
/* 216 */ if (!booleanSettingComponent.booleanSetting.isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 220 */ if (child instanceof NumberSettingComponent) {
/* 221 */ NumberSettingComponent numberSettingComponent = (NumberSettingComponent)child;
/* 222 */ if (!numberSettingComponent.numberSetting.isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 226 */ if (child instanceof ColorPickerComponent) {
/* 227 */ ColorPickerComponent colorPickerComponent = (ColorPickerComponent)child;
/* 228 */ if (!colorPickerComponent.getSetting().isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 232 */ if (child instanceof ListSettingComponent) {
/* 233 */ ListSettingComponent listSettingComponent = (ListSettingComponent)child;
/* 234 */ if (!listSettingComponent.getSetting().isVisible()) {
/* */ continue;
/* */ }
/* */ }
/* 238 */ if (child instanceof ExpandableComponent) {
/* 239 */ ExpandableComponent expandableComponent = (ExpandableComponent)child;
/* 240 */ if (expandableComponent.isExpanded()) cHeight = expandableComponent.getHeightWithExpand();
/* */ }
/* 242 */ height += cHeight;
/* */ }
/* */ }
/* 245 */ return height;
/* */ }
/* */ }
/* Location: C:\Users\C523~1\AppData\Local\Temp\Rar$DRa6544.15747\Meteor\Meteor.jar!\fun\rich\clien\\ui\clickgui\component\impl\ModuleComponent.class
* Java compiler version: 18 (62.0)
* JD-Core Version: 1.1.3
*/