Upload files to "src/openonyx/features/hud"
This commit is contained in:
1 parent
e37b058c6a
commit
d543d7be9f
5 files changed
+667
No files matched your search
@@ -0,0 +1,27 @@
|
|||||||
|
package openonyx.features.hud;
|
||||||
|
|
||||||
|
import openonyx.history.SettingGroup;
|
||||||
|
import openonyx.history.internal.BooleanSetting;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
public final class CustomGuiPart8 extends SettingGroup {
|
||||||
|
public final BooleanSetting blur;
|
||||||
|
public final NumberSetting minWidth;
|
||||||
|
public final NumberSetting background = new NumberSetting("Background", 70.0, 0.0, 100.0, 1.0)
|
||||||
|
.withSuffix("%")
|
||||||
|
.describe("Opacity of the card behind the rows");
|
||||||
|
public final NumberSetting positionY;
|
||||||
|
public final NumberSetting positionX;
|
||||||
|
public final NumberSetting scale;
|
||||||
|
|
||||||
|
private CustomGuiPart8() {
|
||||||
|
super("Scoreboard", true);
|
||||||
|
this.minWidth = new NumberSetting("Min width", 60.0, 40.0, 260.0, 1.0)
|
||||||
|
.withSuffix(" px")
|
||||||
|
.describe("The card never draws narrower than this, however short its rows are");
|
||||||
|
this.blur = new BooleanSetting("Blur", true).describe("Frost the card over what is behind it (needs ClickGui's frosted glass)");
|
||||||
|
this.positionX = new NumberSetting("Position X", 100.0, 0.0, 100.0, 0.01).visibleWhen(() -> false);
|
||||||
|
this.positionY = new NumberSetting("Position Y", 45.0, 0.0, 100.0, 0.01).visibleWhen(() -> false);
|
||||||
|
this.scale = new NumberSetting("Scale", 1.0, 0.5, 2.0, 0.05).visibleWhen(() -> false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package openonyx.features.hud;
|
||||||
|
|
||||||
|
import openonyx.history.SettingGroup;
|
||||||
|
import openonyx.history.internal.BooleanSetting;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
public final class CustomGuiPart9 extends SettingGroup {
|
||||||
|
public final BooleanSetting smoothCaret;
|
||||||
|
public final NumberSetting duration;
|
||||||
|
public final NumberSetting hotbarLift = new NumberSetting("Hotbar lift", 14.0, 0.0, 32.0, 1.0)
|
||||||
|
.withSuffix(" px")
|
||||||
|
.describe("How far the hotbar moves up to make room for the chat box");
|
||||||
|
|
||||||
|
private CustomGuiPart9() {
|
||||||
|
super("Chat", true);
|
||||||
|
this.duration = new NumberSetting("Duration", 300.0, 80.0, 600.0, 10.0).withSuffix(" ms").describe("How long the chat takes to open and close");
|
||||||
|
this.smoothCaret = new BooleanSetting("Smooth caret", true).describe("The text cursor glides as you type and breathes instead of blinking");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
package openonyx.features.hud;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import meteordevelopment.orbit.EventHandler;
|
||||||
|
import net.minecraft.client.multiplayer.ServerData;
|
||||||
|
import openonyx.configuration.internal.RunTickEvent;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.features.ModuleCategory;
|
||||||
|
import openonyx.history.internal.BooleanSetting;
|
||||||
|
import openonyx.ipc.DiscordIpcSocket;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class DiscordRPC extends Module {
|
||||||
|
private volatile String L;
|
||||||
|
private long j;
|
||||||
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
private static final String h = "https://discord.gg/onyxmcclient";
|
||||||
|
private static final String l = "1543222663961382952";
|
||||||
|
public BooleanSetting elapsedTime;
|
||||||
|
private static final int d = 5;
|
||||||
|
private DiscordIpcSocket discordIpcSocket;
|
||||||
|
private static final String f = "onyx";
|
||||||
|
private String H;
|
||||||
|
public BooleanSetting showServer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDisable() {
|
||||||
|
DiscordRPC discordRPC1 = this;
|
||||||
|
ScheduledExecutorService scheduledExecutorServicex = discordRPC1.scheduledExecutorService;
|
||||||
|
DiscordIpcSocket discordIpcSocketx = discordRPC1.discordIpcSocket;
|
||||||
|
discordRPC1.scheduledExecutorService = null;
|
||||||
|
discordRPC1.discordIpcSocket = null;
|
||||||
|
if (scheduledExecutorServicex != null) {
|
||||||
|
scheduledExecutorServicex.execute(() -> {
|
||||||
|
if (discordIpcSocketx != null) {
|
||||||
|
discordIpcSocketx.L();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
scheduledExecutorServicex.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onEnable() {
|
||||||
|
this.j = System.currentTimeMillis() / 1000L;
|
||||||
|
this.H = null;
|
||||||
|
this.discordIpcSocket = new DiscordIpcSocket();
|
||||||
|
this.scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(runnable -> {
|
||||||
|
Thread thread = new Thread(runnable, "Onyx-DiscordRPC");
|
||||||
|
thread.setDaemon(true);
|
||||||
|
return thread;
|
||||||
|
});
|
||||||
|
this.scheduledExecutorService.scheduleWithFixedDelay(() -> {
|
||||||
|
DiscordRPC discordRPC2 = this;
|
||||||
|
DiscordIpcSocket discordIpcSocketx = discordRPC2.discordIpcSocket;
|
||||||
|
if (discordRPC2.discordIpcSocket != null) {
|
||||||
|
try {
|
||||||
|
if (!discordIpcSocketx.L()) {
|
||||||
|
if (!discordIpcSocketx.L("1543222663961382952")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
discordRPC2.H = null;
|
||||||
|
OnyxClient.LOGGER.info("Discord RPC: connected to Discord");
|
||||||
|
}
|
||||||
|
|
||||||
|
String string;
|
||||||
|
if (!(string = discordRPC2.i()).equals(discordRPC2.H)) {
|
||||||
|
discordIpcSocketx.L(1, d(string));
|
||||||
|
discordRPC2.H = string;
|
||||||
|
Logger logger = OnyxClient.LOGGER;
|
||||||
|
Object[] objects = new Object[1];
|
||||||
|
boolean bl = true;
|
||||||
|
objects[0] = string;
|
||||||
|
logger.info("Discord RPC: pushed activity {}", objects);
|
||||||
|
}
|
||||||
|
} catch (IOException iOException) {
|
||||||
|
discordIpcSocketx.L();
|
||||||
|
discordRPC2.H = null;
|
||||||
|
OnyxClient.LOGGER.warn("Discord RPC update failed; will reconnect", iOException);
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
OnyxClient.LOGGER.warn("Discord RPC tick failed", throwable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0L, 5L, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String I() {
|
||||||
|
DiscordRPC discordRPC1 = this;
|
||||||
|
if (mc.theWorld == null) {
|
||||||
|
return "In the Main Menu";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mc.isSingleplayer()) {
|
||||||
|
return "Playing Singleplayer";
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerData serverData;
|
||||||
|
return (serverData = mc.getCurrentServerData()) != null && discordRPC1.showServer.isEnabled()
|
||||||
|
? new StringBuilder().insert(0, "Playing on ").append(serverData.serverIP).toString()
|
||||||
|
: "Playing Multiplayer";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String i() {
|
||||||
|
DiscordRPC discordRPC1 = this;
|
||||||
|
StringBuilder stringBuilder;
|
||||||
|
(stringBuilder = new StringBuilder("{")).append("\"details\":\"").append(decrypt(discordRPC1.L)).append("\",");
|
||||||
|
stringBuilder.append("\"state\":\"").append(decrypt(new StringBuilder().insert(0, "Username: ").append(OnyxClient.L()).toString())).append("\",");
|
||||||
|
if (discordRPC1.elapsedTime.isEnabled()) {
|
||||||
|
stringBuilder.append("\"timestamps\":{\"start\":").append(discordRPC1.j).append("},");
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append("\"assets\":{").append("\"large_image\":\"").append("onyx").append("\",").append("\"large_text\":\"Onyx Client\"},");
|
||||||
|
stringBuilder.append("\"buttons\":[{\"label\":\"Join our Discord\",\"url\":\"").append("https://discord.gg/onyxmcclient").append("\"}]");
|
||||||
|
stringBuilder.append("}");
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiscordRPC() {
|
||||||
|
int i = --1;
|
||||||
|
super("DiscordRPC", "Shows Onyx as your Discord status", ModuleCategory.HUD);
|
||||||
|
this.showServer = new BooleanSetting("Show Server", true).describe("Reveal the current server IP in the status; off keeps it private");
|
||||||
|
this.elapsedTime = new BooleanSetting("Elapsed Time", true).describe("Show how long the client has been running");
|
||||||
|
this.L = "In the Main Menu";
|
||||||
|
this.setEnabled((boolean)i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onRunTick(RunTickEvent runTickEvent) {
|
||||||
|
this.L = this.I();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String d(String string) {
|
||||||
|
return new StringBuilder()
|
||||||
|
.insert(0, "{\"cmd\":\"SET_ACTIVITY\",\"nonce\":\"")
|
||||||
|
.append(UUID.randomUUID())
|
||||||
|
.append("\",\"args\":{\"pid\":")
|
||||||
|
.append(ProcessHandle.current().pid())
|
||||||
|
.append(",\"activity\":")
|
||||||
|
.append(string)
|
||||||
|
.append("}}")
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String decrypt(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(string1.length() + 8);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (int jx = i = 0; jx < string1.length(); jx = ++i) {
|
||||||
|
char c;
|
||||||
|
switch (c = string1.charAt(i)) {
|
||||||
|
case '\t':
|
||||||
|
while (false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append("\\t");
|
||||||
|
break;
|
||||||
|
case '\n':
|
||||||
|
stringBuilder.append("\\n");
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
stringBuilder.append("\\r");
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
stringBuilder.append("\\\"");
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
stringBuilder.append("\\\\");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (c < ' ') {
|
||||||
|
Object[] objects = new Object[1];
|
||||||
|
boolean bl = true;
|
||||||
|
objects[0] = Integer.valueOf(c);
|
||||||
|
stringBuilder.append(String.format("\\u%04x", objects));
|
||||||
|
} else {
|
||||||
|
stringBuilder.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package openonyx.features.hud;
|
||||||
|
|
||||||
|
import openonyx.history.DisplayNamed;
|
||||||
|
|
||||||
|
public enum FeatureSupport_342Mode implements DisplayNamed {
|
||||||
|
ICONS("Icons"),
|
||||||
|
BARS("Bars");
|
||||||
|
|
||||||
|
private final String f;
|
||||||
|
|
||||||
|
private static FeatureSupport_342Mode[] L() {
|
||||||
|
FeatureSupport_342Mode[] featureSupport_342Modes = new FeatureSupport_342Mode[2];
|
||||||
|
boolean bl = true;
|
||||||
|
featureSupport_342Modes[0] = ICONS;
|
||||||
|
featureSupport_342Modes[1] = BARS;
|
||||||
|
return featureSupport_342Modes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return this.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
FeatureSupport_342Mode(String string1) {
|
||||||
|
this.f = string1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
package openonyx.features.hud;
|
||||||
|
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiChat;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.features.ModuleCategory;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.RenderSupport_120;
|
||||||
|
import openonyx.render.group_d.Animation;
|
||||||
|
import openonyx.render.group_d.Easings;
|
||||||
|
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.AlphaLevels;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.theme.Palette;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
import openonyx.ui.UiSupport_545;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
public final class Keybinds extends Module {
|
||||||
|
private static final float N = 31.0F;
|
||||||
|
public NumberSetting positionY;
|
||||||
|
private boolean x;
|
||||||
|
private final UiSupport_545 uiSupport_545;
|
||||||
|
private static final float y = 100.0F;
|
||||||
|
private static final float n = 1.0F;
|
||||||
|
private float Y;
|
||||||
|
private static final float r = 16.0F;
|
||||||
|
private static final float W = 20.0F;
|
||||||
|
private final Map<Module, KeybindsPart> keybindsPartMap;
|
||||||
|
private static final float V = 6.0F;
|
||||||
|
private static final float R = 1.0F;
|
||||||
|
private float p;
|
||||||
|
private float t;
|
||||||
|
public NumberSetting scale = new NumberSetting("Scale", 0.85, 0.5, 2.0, 0.05).withSuffix("x").describe("Keybind list size");
|
||||||
|
private static final float E = 12.0F;
|
||||||
|
private static final int F = 3;
|
||||||
|
public NumberSetting positionX = new NumberSetting("Position X", 6.78, 0.0, 100.0, 0.01).visibleWhen(() -> false);
|
||||||
|
private static final float A = 6.0F;
|
||||||
|
private static final float K = 4.0F;
|
||||||
|
private final RenderSupport_184 renderSupport_184;
|
||||||
|
private boolean C;
|
||||||
|
private static final float J = 0.94F;
|
||||||
|
private boolean D;
|
||||||
|
private final Animation animation;
|
||||||
|
private static final float a = 10.0F;
|
||||||
|
private float k;
|
||||||
|
private final Animation animation2;
|
||||||
|
private RoundedShapesData2 roundedShapesData2;
|
||||||
|
private static final float L = 5.0F;
|
||||||
|
private final Animation animation3;
|
||||||
|
private static final float m = 5.0F;
|
||||||
|
private static final float h = 20.0F;
|
||||||
|
private long l;
|
||||||
|
private float I;
|
||||||
|
private static final float d = 5.0F;
|
||||||
|
private static final float i = 100.0F;
|
||||||
|
private static final float f = 3.0F;
|
||||||
|
private static final String H = "keybinds";
|
||||||
|
private float e;
|
||||||
|
|
||||||
|
private float L() {
|
||||||
|
Keybinds keybinds1 = this;
|
||||||
|
long lx = System.nanoTime();
|
||||||
|
float fx = keybinds1.l == 0L ? 16.0F : Math.min((float)(lx - keybinds1.l) / 1000000.0F, 100.0F);
|
||||||
|
keybinds1.l = lx;
|
||||||
|
return fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean L(double d, double e) {
|
||||||
|
return dx >= this.k && dx < this.k + this.I && ex >= this.p && ex < this.p + this.t;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onEnable() {
|
||||||
|
this.x = false;
|
||||||
|
this.l = 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String L(String string) {
|
||||||
|
String string2 = string;
|
||||||
|
String string1;
|
||||||
|
String[] strings;
|
||||||
|
if ((strings = (string1 = string2.trim().toUpperCase(Locale.ROOT)).split("\\s+")).length > 1) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(strings.length);
|
||||||
|
String[] strings1;
|
||||||
|
int ix = (strings1 = strings).length;
|
||||||
|
|
||||||
|
int j;
|
||||||
|
for (int kx = j = 0; kx < ix; kx = ++j) {
|
||||||
|
String string3;
|
||||||
|
if (!(string3 = strings1[j]).isEmpty()) {
|
||||||
|
stringBuilder.append(string3.charAt(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringBuilder.substring(0, Math.min(stringBuilder.length(), 3));
|
||||||
|
} else {
|
||||||
|
return string1.substring(0, Math.min(string1.length(), 3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(Render2D render2D, float f, float g) {
|
||||||
|
Keybinds keybinds1 = this;
|
||||||
|
float hx = keybinds1.L();
|
||||||
|
boolean bl = keybinds1.isEnabled() && mc.currentScreen instanceof GuiChat;
|
||||||
|
boolean bl2 = keybinds1.L(bl, hx);
|
||||||
|
float nx;
|
||||||
|
boolean bl3;
|
||||||
|
if (bl2) {
|
||||||
|
nx = 1.0F;
|
||||||
|
bl3 = bl2;
|
||||||
|
} else {
|
||||||
|
nx = 0.0F;
|
||||||
|
bl3 = bl2;
|
||||||
|
}
|
||||||
|
|
||||||
|
float mx;
|
||||||
|
boolean bl4;
|
||||||
|
if (bl3) {
|
||||||
|
mx = 300.0F;
|
||||||
|
bl4 = bl2;
|
||||||
|
} else {
|
||||||
|
mx = 200.0F;
|
||||||
|
bl4 = bl2;
|
||||||
|
}
|
||||||
|
|
||||||
|
keybinds1.animation.animateTo(nx, mx, bl4 ? Easings.EASING7 : Easings.EASING);
|
||||||
|
keybinds1.animation.update(hx);
|
||||||
|
if (keybinds1.keybindsPartMap.isEmpty() && keybinds1.animation.isFinished() && keybinds1.animation.getValue() <= 0.0F) {
|
||||||
|
keybinds1.h();
|
||||||
|
keybinds1.I = 0.0F;
|
||||||
|
keybinds1.t = 0.0F;
|
||||||
|
keybinds1.C = keybinds1.h();
|
||||||
|
} else {
|
||||||
|
Palette palette = ThemeManager.getPalette();
|
||||||
|
keybinds1.L(render2D, hx);
|
||||||
|
float ix = keybinds1.scale.getFloat() * (0.94F + 0.060000002F * keybinds1.animation.getValue());
|
||||||
|
keybinds1.I = keybinds1.animation3.getValue() * ix;
|
||||||
|
keybinds1.t = keybinds1.animation2.getValue() * ix;
|
||||||
|
float j = fx - keybinds1.I - 20.0F;
|
||||||
|
float kx = g - keybinds1.t - 20.0F;
|
||||||
|
keybinds1.k = 10.0F + L(keybinds1.positionX, j);
|
||||||
|
keybinds1.p = 10.0F + L(keybinds1.positionY, kx);
|
||||||
|
IconPaths.L("keybinds", keybinds1.k, keybinds1.p, keybinds1.I, keybinds1.t);
|
||||||
|
boolean bl1 = keybinds1.L(bl, j, kx, fx, g);
|
||||||
|
if (bl && bl1 && !keybinds1.D) {
|
||||||
|
float[] lx;
|
||||||
|
if ((lx = keybinds1.renderSupport_184.L(true))[0] != 0.0F || lx[1] != 0.0F) {
|
||||||
|
L(keybinds1.positionX, L(keybinds1.positionX, j) + lx[0], j);
|
||||||
|
L(keybinds1.positionY, L(keybinds1.positionY, kx) + lx[1], kx);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
keybinds1.renderSupport_184.L(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
keybinds1.k = 10.0F + L(keybinds1.positionX, j);
|
||||||
|
keybinds1.p = 10.0F + L(keybinds1.positionY, kx);
|
||||||
|
Keybinds keybinds2;
|
||||||
|
if (bl && bl1) {
|
||||||
|
bl3 = true;
|
||||||
|
keybinds2 = keybinds1;
|
||||||
|
} else {
|
||||||
|
bl3 = false;
|
||||||
|
keybinds2 = keybinds1;
|
||||||
|
}
|
||||||
|
|
||||||
|
keybinds1.uiSupport_545.L(hx, bl3, keybinds2.D);
|
||||||
|
if (keybinds1.D) {
|
||||||
|
RoundedShapes.L(render2D, fx, g, keybinds1.roundedShapesData2);
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderSupport_120.L();
|
||||||
|
render2D.pushAlpha(keybinds1.animation.getValue());
|
||||||
|
render2D.pushMatrix();
|
||||||
|
render2D.translate(keybinds1.k, keybinds1.p + (1.0F - keybinds1.animation.getValue()) * 5.0F);
|
||||||
|
render2D.scaleAround(ix, 0.0F, 0.0F);
|
||||||
|
keybinds1.L(render2D, palette);
|
||||||
|
render2D.popMatrix();
|
||||||
|
render2D.popAlpha();
|
||||||
|
keybinds1.h();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean l() {
|
||||||
|
return mc.thePlayer != null && mc.theWorld != null && (this.isEnabled() || this.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float L(NumberSetting numberSetting, float f) {
|
||||||
|
return fx <= 0.0F ? 0.0F : (float)(fx * numberSetting.getValue() / 100.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Keybinds() {
|
||||||
|
super("Keybinds", "Shows enabled modules with assigned keybinds", ModuleCategory.HUD);
|
||||||
|
this.positionY = new NumberSetting("Position Y", 18.79, 0.0, 100.0, 0.01).visibleWhen(() -> false);
|
||||||
|
this.keybindsPartMap = new IdentityHashMap<>();
|
||||||
|
this.animation = new Animation(0.0F);
|
||||||
|
this.animation3 = new Animation(38.0F);
|
||||||
|
this.animation2 = new Animation(57.0F);
|
||||||
|
this.uiSupport_545 = new UiSupport_545();
|
||||||
|
this.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2;
|
||||||
|
this.renderSupport_184 = new RenderSupport_184();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDisable() {
|
||||||
|
this.x = true;
|
||||||
|
this.D = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean h() {
|
||||||
|
return Mouse.isButtonDown(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(Render2D render2D, float f) {
|
||||||
|
Keybinds keybinds1 = this;
|
||||||
|
float g = 29.0F + render2D.getTextWidth(Fonts.FONT_STYLE9, "Keybinds");
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = OnyxClient.moduleManager.getModules().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
Module module = (Module)iterator.next();
|
||||||
|
if (keybinds1.keybindsPartMap.get(module) == null) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
float hx = Math.min(render2D.getTextWidth(Fonts.FONT_STYLE8, module.getName()), 100.0F);
|
||||||
|
g = Math.max(g, 38.0F + hx);
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ix = keybinds1.keybindsPartMap.size();
|
||||||
|
float j = 37.0F + ix * 20.0F + Math.max(0, ix - 1) * 4.0F;
|
||||||
|
keybinds1.animation3.animateTo(g, 300.0F, Easings.EASING2);
|
||||||
|
keybinds1.animation2.animateTo(j, 300.0F, Easings.EASING2);
|
||||||
|
keybinds1.animation3.update(fx);
|
||||||
|
keybinds1.animation2.update(fx);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(boolean bl, float f, float g, float h, float i) {
|
||||||
|
Keybinds keybinds1 = this;
|
||||||
|
float j = Minecraft.getScaledMouseX() * hx / mc.displayWidth;
|
||||||
|
float kx = ix - Minecraft.getScaledMouseY() * ix / mc.displayHeight - 1.0F;
|
||||||
|
boolean bl1 = keybinds1.h();
|
||||||
|
boolean bl2 = keybinds1.L(j, kx);
|
||||||
|
Keybinds keybinds2;
|
||||||
|
if (bl && bl1) {
|
||||||
|
if (!keybinds1.C && bl2) {
|
||||||
|
keybinds1.D = true;
|
||||||
|
keybinds1.Y = j - keybinds1.k;
|
||||||
|
keybinds1.e = kx - keybinds1.p;
|
||||||
|
}
|
||||||
|
|
||||||
|
keybinds2 = keybinds1;
|
||||||
|
} else {
|
||||||
|
keybinds2 = keybinds1;
|
||||||
|
keybinds1.D = false;
|
||||||
|
keybinds1.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2;
|
||||||
|
}
|
||||||
|
|
||||||
|
keybinds2.C = bl1;
|
||||||
|
if (keybinds1.D) {
|
||||||
|
keybinds1.roundedShapesData2 = RoundedShapes.L(j - keybinds1.Y, kx - keybinds1.e, keybinds1.I, keybinds1.t, hx, ix, 10.0F, IconPaths.L("keybinds"));
|
||||||
|
L(keybinds1.positionX, keybinds1.roundedShapesData2.x() - 10.0F, fx);
|
||||||
|
L(keybinds1.positionY, keybinds1.roundedShapesData2.y() - 10.0F, g);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bl2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(Render2D render2D, Palette palette) {
|
||||||
|
Keybinds keybinds1 = this;
|
||||||
|
float g = keybinds1.animation3.getValue();
|
||||||
|
float fx = keybinds1.animation2.getValue();
|
||||||
|
int ix = AlphaLevels.L(3, palette);
|
||||||
|
render2D.shadow(0.0F, 0.0F, g, fx, 12.0F, 3);
|
||||||
|
RenderSupport_120.L(render2D, 0.0F, 0.0F, g, fx, 12.0F, ix);
|
||||||
|
float j = 14.0F;
|
||||||
|
render2D.drawIcon("\ue312", 12.0F, j, 12.0F, palette.primary());
|
||||||
|
render2D.drawTextVCentered(Fonts.FONT_STYLE9, "Keybinds", 23.0F, j, palette.onSurface());
|
||||||
|
render2D.rect(6.0F, 25.0F, g - 12.0F, 1.0F, ThemeManager.withAlpha(palette.outlineVariant(), 0.7F));
|
||||||
|
float kx = 31.0F;
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = OnyxClient.moduleManager.getModules().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
Module module = (Module)iterator.next();
|
||||||
|
KeybindsPart keybindsPart;
|
||||||
|
if ((keybindsPart = keybinds1.keybindsPartMap.get(module)) == null) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
float hx = keybindsPart.animation.getValue();
|
||||||
|
render2D.pushAlpha(hx);
|
||||||
|
render2D.pushMatrix();
|
||||||
|
render2D.translate((1.0F - hx) * 5.0F, 0.0F);
|
||||||
|
render2D.roundedRect(6.0F, kx, 20.0F, 20.0F, 4.0F, palette.secondaryContainer());
|
||||||
|
render2D.drawTextCenteredVCentered(Fonts.FONT_STYLE8, L(keybindsPart.e), 16.0F, kx + 10.0F, palette.onSecondaryContainer());
|
||||||
|
String string = render2D.trimToWidth(Fonts.FONT_STYLE8, module.getName(), 100.0F);
|
||||||
|
render2D.drawTextVCentered(Fonts.FONT_STYLE8, string, 32.0F, kx + 10.0F, palette.onSurface());
|
||||||
|
render2D.popMatrix();
|
||||||
|
render2D.popAlpha();
|
||||||
|
kx += 24.0F;
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
keybinds1.uiSupport_545.L(render2D, 0.0F, 0.0F, g, fx, 12.0F, palette.onSurface());
|
||||||
|
render2D.roundedOutline(0.0F, 0.0F, g, fx, 12.0F, 1.0F, palette.outlineVariant());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void L(NumberSetting numberSetting, float f, float g) {
|
||||||
|
if (!(g <= 0.0F)) {
|
||||||
|
numberSetting.setValue(Math.clamp(fx / g, 0.0F, 1.0F) * 100.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void h() {
|
||||||
|
if (!this.isEnabled() && this.keybindsPartMap.isEmpty() && this.animation.isFinished() && !(this.animation.getValue() > 0.0F)) {
|
||||||
|
this.x = false;
|
||||||
|
this.l = 0L;
|
||||||
|
this.I = 0.0F;
|
||||||
|
this.t = 0.0F;
|
||||||
|
IconPaths.L("keybinds");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(boolean bl, float f) {
|
||||||
|
Keybinds keybinds1 = this;
|
||||||
|
boolean bl2 = false;
|
||||||
|
Iterator iterator = OnyxClient.moduleManager.getModules().iterator();
|
||||||
|
|
||||||
|
label79:
|
||||||
|
while (true) {
|
||||||
|
Iterator iterator1 = iterator;
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
Module module;
|
||||||
|
if ((module = (Module)iterator.next()) == keybinds1) {
|
||||||
|
continue label79;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module == OnyxClient.moduleManager.clickGUI) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
boolean bl1 = keybinds1.isEnabled() && module.getBind().isBound() && (bl || module.isEnabled());
|
||||||
|
KeybindsPart keybindsPart = keybinds1.keybindsPartMap.get(module);
|
||||||
|
if (bl1 && keybindsPart == null) {
|
||||||
|
keybindsPart = new KeybindsPart(module.getBind().getDisplayName());
|
||||||
|
keybinds1.keybindsPartMap.put(module, keybindsPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keybindsPart != null) {
|
||||||
|
if (module.getBind().isBound()) {
|
||||||
|
keybindsPart.e = module.getBind().getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
float hx;
|
||||||
|
boolean bl3;
|
||||||
|
if (bl1) {
|
||||||
|
hx = 1.0F;
|
||||||
|
bl3 = bl1;
|
||||||
|
} else {
|
||||||
|
hx = 0.0F;
|
||||||
|
bl3 = bl1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float g;
|
||||||
|
boolean bl4;
|
||||||
|
if (bl3) {
|
||||||
|
g = 150.0F;
|
||||||
|
bl4 = bl1;
|
||||||
|
} else {
|
||||||
|
g = 100.0F;
|
||||||
|
bl4 = bl1;
|
||||||
|
}
|
||||||
|
|
||||||
|
keybindsPart.animation.animateTo(hx, g, bl4 ? Easings.EASING7 : Easings.EASING);
|
||||||
|
keybindsPart.animation.update(fx);
|
||||||
|
if (bl1) {
|
||||||
|
bl2 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bl1 && keybindsPart.animation.isFinished() && keybindsPart.animation.getValue() <= 0.0F) {
|
||||||
|
keybinds1.keybindsPartMap.remove(module);
|
||||||
|
}
|
||||||
|
continue label79;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bl2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user