Upload files to "src/openonyx/ui"
This commit is contained in:
1 parent
9dff1477a3
commit
76fec33638
5 files changed
+1218
No files matched your search
@@ -0,0 +1,410 @@
|
|||||||
|
package openonyx.ui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
import openonyx.features.render.ESP;
|
||||||
|
import openonyx.features.render.ESPData2;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_d.Animation;
|
||||||
|
import openonyx.render.group_d.Easings;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
import openonyx.ui.internal.UiButton;
|
||||||
|
import openonyx.ui.internal.UiButtonMode;
|
||||||
|
|
||||||
|
public class NametagEditor extends GuiScreen {
|
||||||
|
private float R;
|
||||||
|
private final Render2D render2D;
|
||||||
|
private static final float t = 3.0F;
|
||||||
|
private static final float b = 16.0F;
|
||||||
|
private static final int E = 2;
|
||||||
|
private static final int F = 0;
|
||||||
|
private static final float G = 16.0F;
|
||||||
|
private final Animation animation;
|
||||||
|
private final ESP esp;
|
||||||
|
private float B;
|
||||||
|
private long C;
|
||||||
|
private float[] J;
|
||||||
|
private int D;
|
||||||
|
private final UiButton uiButton;
|
||||||
|
private float a;
|
||||||
|
private float k;
|
||||||
|
private final Animation animation2;
|
||||||
|
private final Animation animation3;
|
||||||
|
private static final float L = 100.0F;
|
||||||
|
private final Animation animation4;
|
||||||
|
private final UiButton uiButton2;
|
||||||
|
private float h;
|
||||||
|
private final UiButton uiButton3;
|
||||||
|
private float[] I;
|
||||||
|
private float d;
|
||||||
|
private final GuiScreen guiScreen;
|
||||||
|
private float f;
|
||||||
|
private static final int H = 1;
|
||||||
|
private boolean e;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesGuiPauseGame() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(float[] f, boolean bl, String string) {
|
||||||
|
int i = bl ? ThemeManager.getPalette().primary() : ThemeManager.withAlpha(ThemeManager.getPalette().onSurface(), 0.4F);
|
||||||
|
float g = fx[0] - 3.0F;
|
||||||
|
float hx = fx[1] - 3.0F;
|
||||||
|
float j = fx[2] + 6.0F;
|
||||||
|
float kx = fx[3] + 6.0F;
|
||||||
|
float l;
|
||||||
|
int m;
|
||||||
|
if (bl) {
|
||||||
|
l = 1.5F;
|
||||||
|
m = i;
|
||||||
|
} else {
|
||||||
|
l = 1.0F;
|
||||||
|
m = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.render2D.roundedOutline(g, hx, j, kx, 8.0F, l, m);
|
||||||
|
if (bl) {
|
||||||
|
this.render2D.drawTextCentered(Fonts.FONT_STYLE2, string, fx[0] + fx[2] / 2.0F, fx[1] - 3.0F - 3.0F - Fonts.FONT_STYLE2.lineHeight(), i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void d(int i, int j) {
|
||||||
|
NametagEditor nametagEditor1 = this;
|
||||||
|
float g = nametagEditor1.esp.L(nametagEditor1.h);
|
||||||
|
List list1;
|
||||||
|
List list = (list1 = nametagEditor1.esp.d(nametagEditor1.mc.thePlayer)).isEmpty() ? nametagEditor1.esp.D() : list1;
|
||||||
|
ESPData2 eSPData22 = null;
|
||||||
|
ESPData2 eSPData2 = null;
|
||||||
|
float fx = nametagEditor1.a + nametagEditor1.B / 2.0F;
|
||||||
|
Iterator iterator = nametagEditor1.esp
|
||||||
|
.L(nametagEditor1.render2D, nametagEditor1.mc.thePlayer, nametagEditor1.a, nametagEditor1.d, nametagEditor1.B, nametagEditor1.h, fx, fx, true)
|
||||||
|
.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
ESPData2 eSPData21;
|
||||||
|
if ((eSPData21 = (ESPData2)iterator.next()).type() == 0) {
|
||||||
|
eSPData22 = eSPData21;
|
||||||
|
} else {
|
||||||
|
eSPData2 = eSPData21;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nametagEditor1.I = nametagEditor1.J = null;
|
||||||
|
if (eSPData22 != null) {
|
||||||
|
boolean bl = !nametagEditor1.e || nametagEditor1.esp.freeLayout.isEnabled() && nametagEditor1.D == 1;
|
||||||
|
float kx = nametagEditor1.L(nametagEditor1.animation4, eSPData22.centerX(), bl);
|
||||||
|
float hx = nametagEditor1.L(nametagEditor1.animation, eSPData22.centerY(), bl);
|
||||||
|
nametagEditor1.esp.L(nametagEditor1.render2D, nametagEditor1.mc.thePlayer, kx, hx, g);
|
||||||
|
float[] o = new float[4];
|
||||||
|
boolean bl3 = true;
|
||||||
|
o[0] = kx - eSPData22.width() / 2.0F;
|
||||||
|
o[1] = hx - eSPData22.height() / 2.0F;
|
||||||
|
o[2] = eSPData22.width();
|
||||||
|
o[3] = eSPData22.height();
|
||||||
|
nametagEditor1.J = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eSPData2 != null) {
|
||||||
|
boolean bl1 = !nametagEditor1.e || nametagEditor1.esp.freeLayout.isEnabled() && nametagEditor1.D == 2;
|
||||||
|
float l = nametagEditor1.L(nametagEditor1.animation3, eSPData2.centerX(), bl1);
|
||||||
|
float m = nametagEditor1.L(nametagEditor1.animation2, eSPData2.centerY(), bl1);
|
||||||
|
nametagEditor1.esp.L(nametagEditor1.render2D, nametagEditor1.mc.thePlayer, l, m, g, list, eSPData2.horizontal());
|
||||||
|
float[] n = new float[4];
|
||||||
|
boolean bl2 = true;
|
||||||
|
n[0] = l - eSPData2.width() / 2.0F;
|
||||||
|
n[1] = m - eSPData2.height() / 2.0F;
|
||||||
|
n[2] = eSPData2.width();
|
||||||
|
n[3] = eSPData2.height();
|
||||||
|
nametagEditor1.I = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
nametagEditor1.e = true;
|
||||||
|
if (nametagEditor1.J != null) {
|
||||||
|
nametagEditor1.L(nametagEditor1.J, nametagEditor1.L(1, nametagEditor1.J, i, j), "Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nametagEditor1.I != null) {
|
||||||
|
nametagEditor1.L(nametagEditor1.I, nametagEditor1.L(2, nametagEditor1.I, i, j), "Equipment");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nametagEditor1.D != 0 && !nametagEditor1.esp.freeLayout.isEnabled()) {
|
||||||
|
nametagEditor1.L();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public NametagEditor(GuiScreen guiScreen) {
|
||||||
|
this.esp = OnyxClient.moduleManager.esp;
|
||||||
|
this.render2D = new Render2D();
|
||||||
|
this.uiButton = new UiButton(UiButtonMode.OUTLINED, "Reset", () -> {
|
||||||
|
this.esp.nameZone.reset();
|
||||||
|
this.esp.equipmentZone.reset();
|
||||||
|
this.esp.nameFreeX.reset();
|
||||||
|
this.esp.nameFreeY.reset();
|
||||||
|
this.esp.equipmentFreeX.reset();
|
||||||
|
this.esp.equipmentFreeY.reset();
|
||||||
|
this.esp.equipmentFirst.setValue(false);
|
||||||
|
this.esp.freeLayout.setValue(false);
|
||||||
|
this.uiButton2.L("Unlock");
|
||||||
|
});
|
||||||
|
this.uiButton2 = new UiButton(UiButtonMode.TONAL, "Unlock", () -> {
|
||||||
|
this.esp.freeLayout.toggle();
|
||||||
|
this.uiButton2.L(this.esp.freeLayout.isEnabled() ? "Snap to slots" : "Unlock");
|
||||||
|
});
|
||||||
|
this.uiButton3 = new UiButton(UiButtonMode.FILLED, "Done", () -> this.mc.displayGuiScreen(this.guiScreen));
|
||||||
|
this.D = 0;
|
||||||
|
this.animation4 = new Animation(0.0F);
|
||||||
|
this.animation = new Animation(0.0F);
|
||||||
|
this.animation3 = new Animation(0.0F);
|
||||||
|
this.animation2 = new Animation(0.0F);
|
||||||
|
this.guiScreen = guiScreenx;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L(Animation animation, float f, boolean bl) {
|
||||||
|
Animation animation1;
|
||||||
|
if (bl) {
|
||||||
|
animationx.set(fx);
|
||||||
|
animation1 = animationx;
|
||||||
|
} else {
|
||||||
|
if (Math.abs(animationx.getTarget() - fx) > 0.01F) {
|
||||||
|
animationx.animateTo(fx, 200.0F, Easings.EASING2);
|
||||||
|
}
|
||||||
|
|
||||||
|
animation1 = animationx;
|
||||||
|
}
|
||||||
|
|
||||||
|
animation1.update(this.R);
|
||||||
|
return animationx.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int L(float f, float g) {
|
||||||
|
float hx = this.a + this.B / 2.0F;
|
||||||
|
float i = this.d + this.h / 2.0F;
|
||||||
|
fx = (fx - hx) / (this.B / 2.0F + 1.0F);
|
||||||
|
if (Math.abs(g = (g - i) / (this.h / 2.0F + 1.0F)) >= Math.abs(fx)) {
|
||||||
|
return g < 0.0F ? 0 : 3;
|
||||||
|
} else {
|
||||||
|
return fx < 0.0F ? 1 : 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(int i, float[] f, float g, float h) {
|
||||||
|
this.D = i;
|
||||||
|
this.k = g - (fx[0] + fx[2] / 2.0F);
|
||||||
|
this.f = hx - (fx[1] + fx[3] / 2.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(int i, float[] f, int j, int k) {
|
||||||
|
return this.D == i ? true : this.D == 0 && L(fx, j, kx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClickMove(int i, int j, int k, long l) {
|
||||||
|
if (this.D != 0) {
|
||||||
|
this.L((float)i, (float)j);
|
||||||
|
} else {
|
||||||
|
super.mouseClickMove(i, j, kx, l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(int i, int j) {
|
||||||
|
this.render2D.drawTextCentered(Fonts.FONT_STYLE14, "ESP layout", this.width / 2.0F, 22.0F, ThemeManager.getPalette().onSurface());
|
||||||
|
this.render2D
|
||||||
|
.drawTextCentered(
|
||||||
|
Fonts.FONT_STYLE2,
|
||||||
|
"Drag the name and equipment around the player",
|
||||||
|
this.width / 2.0F,
|
||||||
|
44.0F,
|
||||||
|
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.85F)
|
||||||
|
);
|
||||||
|
RenderContext renderContext = new RenderContext(this.render2D, this.R, i, j);
|
||||||
|
this.uiButton.update(renderContext);
|
||||||
|
this.uiButton2.update(renderContext);
|
||||||
|
this.uiButton3.update(renderContext);
|
||||||
|
this.uiButton.render(renderContext);
|
||||||
|
this.uiButton2.render(renderContext);
|
||||||
|
this.uiButton3.render(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(float f, float g) {
|
||||||
|
NametagEditor nametagEditor1 = this;
|
||||||
|
if (!(nametagEditor1.B <= 0.0F) && !(nametagEditor1.h <= 0.0F)) {
|
||||||
|
if (nametagEditor1.esp.freeLayout.isEnabled()) {
|
||||||
|
float hx = nametagEditor1.a + nametagEditor1.B / 2.0F;
|
||||||
|
float j = nametagEditor1.d + nametagEditor1.h / 2.0F;
|
||||||
|
NumberSetting numberSetting2 = nametagEditor1.D == 1 ? nametagEditor1.esp.nameFreeX : nametagEditor1.esp.equipmentFreeX;
|
||||||
|
NumberSetting numberSetting1 = nametagEditor1.D == 1 ? nametagEditor1.esp.nameFreeY : nametagEditor1.esp.equipmentFreeY;
|
||||||
|
numberSetting2.setValue((double)((fx - nametagEditor1.k - hx) / nametagEditor1.h));
|
||||||
|
numberSetting1.setValue((double)((g - nametagEditor1.f - j) / nametagEditor1.h));
|
||||||
|
} else {
|
||||||
|
int i = nametagEditor1.L((float)fx, g);
|
||||||
|
NumberSetting numberSetting = nametagEditor1.D == 1 ? nametagEditor1.esp.nameZone : nametagEditor1.esp.equipmentZone;
|
||||||
|
numberSetting.setValue((double)i);
|
||||||
|
nametagEditor1.L(i, g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(int i, float f) {
|
||||||
|
if (this.esp.names.isEnabled() && this.esp.equipment.isEnabled()) {
|
||||||
|
if ((this.D == 1 ? this.esp.equipmentZone : this.esp.nameZone).getInt() == i) {
|
||||||
|
float[] g = this.D == 1 ? this.I : this.J;
|
||||||
|
if (g != null) {
|
||||||
|
float hx = g[1] + g[3] / 2.0F;
|
||||||
|
boolean bl = fx - this.f < hx;
|
||||||
|
boolean bl1 = this.D == 1 ? bl : !bl;
|
||||||
|
this.esp.equipmentFirst.setValue(!bl1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
this.C = 0L;
|
||||||
|
this.uiButton2.L(this.esp.freeLayout.isEnabled() ? "Snap to slots" : "Unlock");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void l() {
|
||||||
|
this.render2D.clearScissors();
|
||||||
|
GuiInventory.drawEntityOnScreen(this.width / 2, (int)(this.d + this.h), (int)(this.h * 0.5F), 0.0F, 0.0F, this.mc.thePlayer);
|
||||||
|
this.render2D.beginFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(float f, float g) {
|
||||||
|
if (this.J != null && L(this.J, fx, g)) {
|
||||||
|
this.L(1, this.J, fx, g);
|
||||||
|
return true;
|
||||||
|
} else if (this.I != null && L(this.I, fx, g)) {
|
||||||
|
this.L(2, this.I, fx, g);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void I() {
|
||||||
|
NametagEditor nametagEditor1 = this;
|
||||||
|
float i = 118.0F;
|
||||||
|
float fx = 10.0F;
|
||||||
|
float g = i * 3.0F + fx * 2.0F;
|
||||||
|
g = nametagEditor1.width / 2.0F - g / 2.0F;
|
||||||
|
float hx = nametagEditor1.height - 46.0F;
|
||||||
|
nametagEditor1.uiButton.setBounds(g, hx, i, 30.0F);
|
||||||
|
nametagEditor1.uiButton2.setBounds(g + i + fx, hx, i, 30.0F);
|
||||||
|
nametagEditor1.uiButton3.setBounds(g + (i + fx) * 2.0F, hx, i, 30.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void i() {
|
||||||
|
NametagEditor nametagEditor1 = this;
|
||||||
|
float fx = nametagEditor1.mc.thePlayer.width / nametagEditor1.mc.thePlayer.height;
|
||||||
|
nametagEditor1.h = nametagEditor1.height * 0.5F;
|
||||||
|
nametagEditor1.d = nametagEditor1.height / 2.0F - nametagEditor1.h / 2.0F;
|
||||||
|
nametagEditor1.B = nametagEditor1.h * fx;
|
||||||
|
nametagEditor1.a = nametagEditor1.width / 2.0F - nametagEditor1.B / 2.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseReleased(int i, int j, int k) {
|
||||||
|
this.D = 0;
|
||||||
|
this.uiButton.mouseReleased(i, j, kx);
|
||||||
|
this.uiButton2.mouseReleased(i, j, kx);
|
||||||
|
this.uiButton3.mouseReleased(i, j, kx);
|
||||||
|
super.mouseReleased(i, j, kx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char c, int i) throws IOException {
|
||||||
|
if (i == 1) {
|
||||||
|
this.D();
|
||||||
|
} else {
|
||||||
|
super.keyTyped(c, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L() {
|
||||||
|
long l = System.nanoTime();
|
||||||
|
if (this.C == 0L) {
|
||||||
|
this.C = l;
|
||||||
|
return 16.0F;
|
||||||
|
} else {
|
||||||
|
float fx = (float)(l - this.C) / 1000000.0F;
|
||||||
|
this.C = l;
|
||||||
|
return Math.min(fx, 100.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int i, int j, float f) {
|
||||||
|
this.R = this.L();
|
||||||
|
this.I();
|
||||||
|
this.render2D.beginFrame();
|
||||||
|
NametagEditor nametagEditor1;
|
||||||
|
if (this.mc.theWorld != null) {
|
||||||
|
this.render2D.rect(0.0F, 0.0F, this.width, this.height, ThemeManager.scrim(0.55F));
|
||||||
|
nametagEditor1 = this;
|
||||||
|
} else {
|
||||||
|
this.render2D.L(0.0F, 0.0F, this.width, this.height);
|
||||||
|
nametagEditor1 = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nametagEditor1.mc.thePlayer != null) {
|
||||||
|
this.i();
|
||||||
|
this.l();
|
||||||
|
this.d(i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.L(i, j);
|
||||||
|
this.render2D.clearScissors();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean L(float[] f, float g, float h) {
|
||||||
|
return g >= fx[0] && g <= fx[0] + fx[2] && hx >= fx[1] && hx <= fx[1] + fx[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(int i, int j, float f, float g) {
|
||||||
|
boolean bl = i == j;
|
||||||
|
j = bl ? ThemeManager.getPalette().primary() : ThemeManager.withAlpha(ThemeManager.getPalette().onSurface(), 0.3F);
|
||||||
|
float hx;
|
||||||
|
int kx;
|
||||||
|
if (bl) {
|
||||||
|
hx = 4.0F;
|
||||||
|
kx = j;
|
||||||
|
} else {
|
||||||
|
hx = 2.5F;
|
||||||
|
kx = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.render2D.circle(fx, g, hx, kx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int i, int j, int k) throws IOException {
|
||||||
|
if (kx != 0 || !this.L((float)i, (float)j)) {
|
||||||
|
if (!this.uiButton.mouseClicked(i, j, kx)) {
|
||||||
|
if (!this.uiButton2.mouseClicked(i, j, kx)) {
|
||||||
|
if (!this.uiButton3.mouseClicked(i, j, kx)) {
|
||||||
|
super.mouseClicked(i, j, kx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L() {
|
||||||
|
NametagEditor nametagEditor1 = this;
|
||||||
|
int i = (nametagEditor1.D == 1 ? nametagEditor1.esp.nameZone : nametagEditor1.esp.equipmentZone).getInt();
|
||||||
|
float fx = nametagEditor1.a + nametagEditor1.B / 2.0F;
|
||||||
|
float g = nametagEditor1.d + nametagEditor1.h / 2.0F;
|
||||||
|
nametagEditor1.L(0, i, fx, nametagEditor1.d - 16.0F);
|
||||||
|
nametagEditor1.L(3, i, fx, nametagEditor1.d + nametagEditor1.h + 16.0F);
|
||||||
|
nametagEditor1.L(1, i, nametagEditor1.a - 16.0F, g);
|
||||||
|
nametagEditor1.L(2, i, nametagEditor1.a + nametagEditor1.B + 16.0F, g);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package openonyx.ui;
|
||||||
|
|
||||||
|
import openonyx.input.CharInput;
|
||||||
|
import openonyx.input.KeyInput;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.RenderSupport_120;
|
||||||
|
import openonyx.theme.AlphaLevels;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.ui.internal.ProxyEditor;
|
||||||
|
import openonyx.ui.internal.UiSupport_571;
|
||||||
|
import openonyx.ui.internal.UiSupport_602;
|
||||||
|
|
||||||
|
public class ProxyPanel extends UiComponent {
|
||||||
|
private static final float M = 12.0F;
|
||||||
|
private final UiSupport_602 uiSupport_602;
|
||||||
|
private static final float j = 420.0F;
|
||||||
|
private final ProxyEditor proxyEditor = new ProxyEditor();
|
||||||
|
private static final float h = 4.0F;
|
||||||
|
private static final String l = "Proxy";
|
||||||
|
private float I;
|
||||||
|
private final UiSupport_571 uiSupport_571 = new UiSupport_571();
|
||||||
|
private static final float H = 46.0F;
|
||||||
|
|
||||||
|
private float l() {
|
||||||
|
return this.d + 23.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float h() {
|
||||||
|
return this.d + this.i / 2.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void d() {
|
||||||
|
this.proxyEditor.I();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean charTyped(CharInput charInput) {
|
||||||
|
return this.proxyEditor.charTyped(charInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void L() {
|
||||||
|
this.uiSupport_602.setBounds(this.f + this.e - 12.0F - 30.0F, this.l() - 15.0F, 30.0F, 30.0F);
|
||||||
|
this.proxyEditor.setBounds(this.f + 12.0F, this.d + 46.0F, this.e - 24.0F, this.i - 46.0F - 12.0F);
|
||||||
|
this.uiSupport_571.setBounds(this.f, this.d, this.e, this.i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(float f) {
|
||||||
|
this.I = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(float f, float g, int i) {
|
||||||
|
return super.mouseClicked(f, g, i) || this.contains(f, g);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(RenderContext renderContext) {
|
||||||
|
super.update(renderContext);
|
||||||
|
this.uiSupport_571.update(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(float f, float g) {
|
||||||
|
this.setBounds(Math.round((f - this.e) / 2.0F), Math.round((g - this.i) / 2.0F), this.e, this.i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderContext renderContext) {
|
||||||
|
Render2D render2D = renderContext.render2D;
|
||||||
|
Render2D render2D1 = renderContext.render2D;
|
||||||
|
render2D.pushAlpha(this.I);
|
||||||
|
render2D.shadow(this.f, this.d, this.e, this.i, 28.0F, 3);
|
||||||
|
RenderSupport_120.L(render2D, this.f, this.d, this.e, this.i, 28.0F, AlphaLevels.L(2, renderContext.palette()));
|
||||||
|
render2D.popAlpha();
|
||||||
|
render2D.pushAlpha(this.I);
|
||||||
|
render2D.drawTextVCentered(Fonts.getFontstylE18(), "Proxy", this.f + 12.0F + 4.0F, this.l(), renderContext.palette().onSurface());
|
||||||
|
super.render(renderContext);
|
||||||
|
render2D1.popAlpha();
|
||||||
|
this.uiSupport_571.render(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProxyPanel(Runnable runnable) {
|
||||||
|
this.I = 1.0F;
|
||||||
|
this.e = 420.0F;
|
||||||
|
this.i = 46.0F + ProxyEditor.I() + 12.0F;
|
||||||
|
this.uiSupport_602 = new UiSupport_602("\ue5cd", runnable);
|
||||||
|
this.proxyEditor.d(this.uiSupport_571::L);
|
||||||
|
this.proxyEditor.L(string -> this.uiSupport_571.L(string, "\ue001"));
|
||||||
|
this.uiComponents.add(this.uiSupport_602);
|
||||||
|
this.uiComponents.add(this.proxyEditor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyTyped(KeyInput keyInput) {
|
||||||
|
return this.proxyEditor.keyTyped(keyInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float I() {
|
||||||
|
return this.f + this.e / 2.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package openonyx.ui;
|
||||||
|
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.theme.Palette;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
|
||||||
|
public final class RenderContext {
|
||||||
|
public final float i;
|
||||||
|
public final float f;
|
||||||
|
public final float H;
|
||||||
|
public final Render2D render2D;
|
||||||
|
|
||||||
|
public Palette palette() {
|
||||||
|
return ThemeManager.getPalette();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RenderContext(Render2D render2D, float f, float g, float h) {
|
||||||
|
this.render2D = render2Dx;
|
||||||
|
this.i = fx;
|
||||||
|
this.H = g;
|
||||||
|
this.f = h;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package openonyx.ui;
|
||||||
|
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_d.Animation;
|
||||||
|
import openonyx.render.group_d.Easings;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
|
||||||
|
public abstract class ScrollList extends UiComponent {
|
||||||
|
protected int j;
|
||||||
|
protected float m;
|
||||||
|
protected final Animation animation;
|
||||||
|
protected final Animation animation2;
|
||||||
|
protected float I;
|
||||||
|
private float H;
|
||||||
|
|
||||||
|
protected void h(RenderContext renderContext) {
|
||||||
|
ScrollList scrollList1 = this;
|
||||||
|
UiComponent uiComponent;
|
||||||
|
if ((uiComponent = scrollList1.L()) != null) {
|
||||||
|
renderContext.render2D
|
||||||
|
.roundedOutline(uiComponent.d(), uiComponent.D(), uiComponent.i(), uiComponent.L(), scrollList1.I(), 2.0F, renderContext.palette().primary());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean L(int i, int j) {
|
||||||
|
if (this.uiComponents.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int k = Math.max(1, this.L());
|
||||||
|
if ((i = i + jx * k) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.j = this.j < 0 ? (i > 0 ? 0 : this.uiComponents.size() - 1) : Math.clamp(this.j + i, 0, this.uiComponents.size() - 1);
|
||||||
|
this.d();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseScrolled(float f, float g, double d) {
|
||||||
|
if (!this.contains(f, g)) {
|
||||||
|
return super.mouseScrolled(f, g, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((f = Math.max(0.0F, this.I - this.i)) <= 0.0F) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.m = Math.clamp(this.m - (float)d * 32.0F, 0.0F, f);
|
||||||
|
this.H = 0.0F;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int d() {
|
||||||
|
return this.j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void D() {
|
||||||
|
this.j = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int L() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(RenderContext renderContext) {
|
||||||
|
ScrollList scrollList1 = this;
|
||||||
|
scrollList1.i(renderContext);
|
||||||
|
float f = Math.max(0.0F, scrollList1.I - scrollList1.i);
|
||||||
|
scrollList1.m = Math.clamp(scrollList1.m, 0.0F, f);
|
||||||
|
if (scrollList1.animation.getTarget() != scrollList1.m) {
|
||||||
|
scrollList1.animation.animateTo(scrollList1.m, 250.0F, Easings.EASING5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scrollList1.j >= scrollList1.uiComponents.size()) {
|
||||||
|
scrollList1.j = scrollList1.uiComponents.isEmpty() ? -1 : scrollList1.uiComponents.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollList1.animation.update(renderContext.i);
|
||||||
|
scrollList1.H = scrollList1.H + renderContext.i;
|
||||||
|
boolean bl = f > 0.0F && (scrollList1.h || scrollList1.H < 900.0F);
|
||||||
|
if (scrollList1.animation2.getTarget() != (bl ? 1.0F : 0.0F)) {
|
||||||
|
scrollList1.animation2.animateTo(bl ? 1.0F : 0.0F, 200.0F, Easings.EASING6);
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollList1.animation2.update(renderContext.i);
|
||||||
|
scrollList1.update(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void I(RenderContext renderContext) {
|
||||||
|
ScrollList scrollList1 = this;
|
||||||
|
float f = scrollList1.animation2.getValue();
|
||||||
|
float i = Math.max(0.0F, scrollList1.I - scrollList1.i);
|
||||||
|
if (!(f <= 0.01F) && !(i <= 0.0F)) {
|
||||||
|
float g = scrollList1.i - 8.0F;
|
||||||
|
float h = Math.max(24.0F, g * (scrollList1.i / scrollList1.I));
|
||||||
|
float jx = scrollList1.d + 4.0F + (g - h) * (scrollList1.animation.getValue() / i);
|
||||||
|
renderContext.render2D
|
||||||
|
.roundedRect(
|
||||||
|
scrollList1.f + scrollList1.e - 7.0F, jx, 4.0F, h, Float.MAX_VALUE, ThemeManager.withAlpha(renderContext.palette().outlineVariant(), f * 0.8F)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScrollList() {
|
||||||
|
int i = -4 >> 2;
|
||||||
|
super();
|
||||||
|
this.animation = new Animation(0.0F);
|
||||||
|
this.animation2 = new Animation(0.0F);
|
||||||
|
this.j = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void d() {
|
||||||
|
ScrollList scrollList1 = this;
|
||||||
|
UiComponent uiComponent;
|
||||||
|
if ((uiComponent = scrollList1.L()) != null) {
|
||||||
|
float f;
|
||||||
|
float g = (f = uiComponent.D() + scrollList1.animation.getValue() - scrollList1.d) + uiComponent.L();
|
||||||
|
if (f < scrollList1.m) {
|
||||||
|
scrollList1.m = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g > scrollList1.m + scrollList1.i) {
|
||||||
|
scrollList1.m = g - scrollList1.i;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollList1.H = 0.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float I() {
|
||||||
|
return 12.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void i(RenderContext renderContext);
|
||||||
|
|
||||||
|
public UiComponent L() {
|
||||||
|
return this.j >= 0 && this.j < this.uiComponents.size() ? this.uiComponents.get(this.j) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderContext renderContext) {
|
||||||
|
Render2D render2D = renderContext.render2D;
|
||||||
|
render2D.pushScissor(this.f, this.d, this.e, this.i);
|
||||||
|
this.D(renderContext);
|
||||||
|
super.render(renderContext);
|
||||||
|
this.h(renderContext);
|
||||||
|
render2D.popScissor();
|
||||||
|
this.I(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void D(RenderContext renderContext) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,528 @@
|
|||||||
|
package openonyx.ui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
import openonyx.features.hud.TargetHUD;
|
||||||
|
import openonyx.features.hud.TargetHUDData;
|
||||||
|
import openonyx.features.hud.TargetHUDData2;
|
||||||
|
import openonyx.features.hud.internal.TargetHudTextSettings;
|
||||||
|
import openonyx.input.CharInput;
|
||||||
|
import openonyx.input.KeyInput;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.group_v.RoundedShapes;
|
||||||
|
import openonyx.render.group_v.RoundedShapesData2;
|
||||||
|
import openonyx.theme.AlphaLevels;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.theme.ThemeManager;
|
||||||
|
import openonyx.ui.internal.SettingControl;
|
||||||
|
import openonyx.ui.internal.SettingList;
|
||||||
|
import openonyx.ui.internal.UiButton;
|
||||||
|
import openonyx.ui.internal.UiButtonMode;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
public class TargetHudEditor extends GuiScreen {
|
||||||
|
private final GuiScreen x;
|
||||||
|
private static final float u = 16.0F;
|
||||||
|
private float y;
|
||||||
|
private static final float n = 2.0F;
|
||||||
|
private static final float Y = 12.0F;
|
||||||
|
private static final float r = 100.0F;
|
||||||
|
private static final float W = 46.0F;
|
||||||
|
private float P;
|
||||||
|
private final UiButton uiButton;
|
||||||
|
private static final float R = 210.0F;
|
||||||
|
private TargetHudTextSettings targetHudTextSettings;
|
||||||
|
private final List<float[]> list;
|
||||||
|
private static final float b = 9.0F;
|
||||||
|
private final TargetHUD targetHUD;
|
||||||
|
private float F;
|
||||||
|
private float G;
|
||||||
|
private static final float A = 20.0F;
|
||||||
|
private long K;
|
||||||
|
private float B;
|
||||||
|
private final SettingList settingList;
|
||||||
|
private float J;
|
||||||
|
private static final float D = 120.0F;
|
||||||
|
private float c;
|
||||||
|
private static final float a = 10.0F;
|
||||||
|
private TargetHudTextSettings targetHudTextSettings2;
|
||||||
|
private static final float g = 2.4F;
|
||||||
|
private static final float M = 12.0F;
|
||||||
|
private float L;
|
||||||
|
private RoundedShapesData2 roundedShapesData2;
|
||||||
|
private float m;
|
||||||
|
private TargetHUDData2 targetHUDData2;
|
||||||
|
private final UiButton uiButton2;
|
||||||
|
private float I;
|
||||||
|
private float d;
|
||||||
|
private float i;
|
||||||
|
private float f;
|
||||||
|
private static final float H = 5.0F;
|
||||||
|
private final Render2D render2D;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char c, int i) throws IOException {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
KeyInput keyInput = new KeyInput(ix, 0, 0, cx);
|
||||||
|
Iterator iterator1 = targetHudEditor1.settingList.getSettingControls().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
if (((SettingControl)iterator1.next()).keyTyped(keyInput)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cx >= ' ') {
|
||||||
|
CharInput charInput = new CharInput(cx, 0);
|
||||||
|
Iterator iterator = targetHudEditor1.settingList.getSettingControls().iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
if (((SettingControl)iterator.next()).charTyped(charInput)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ix == 1) {
|
||||||
|
targetHudEditor1.d();
|
||||||
|
} else {
|
||||||
|
targetHudEditor1.keyTyped(cx, ix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
this.K = 0L;
|
||||||
|
if (this.targetHudTextSettings == null) {
|
||||||
|
this.targetHudTextSettings = this.targetHUD.D().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.L();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
this.targetHUD.h();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void D() {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
float h = 100.0F;
|
||||||
|
float fx = targetHudEditor1.width - 210.0F - 12.0F;
|
||||||
|
float gx = targetHudEditor1.height - 46.0F + 10.0F;
|
||||||
|
targetHudEditor1.uiButton2.setBounds(fx, gx, h, 30.0F);
|
||||||
|
targetHudEditor1.uiButton.setBounds(fx + h + 10.0F, gx, h, 30.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMouseInput() throws IOException {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
int ix;
|
||||||
|
if ((ix = Mouse.getEventDWheel()) != 0) {
|
||||||
|
ScaledResolution scaledResolution = new ScaledResolution(targetHudEditor1.mc);
|
||||||
|
float fx = (float)(Mouse.getEventX() * scaledResolution.getScaledWidth()) / targetHudEditor1.mc.displayWidth;
|
||||||
|
float gx = scaledResolution.getScaledHeight()
|
||||||
|
- (float)(Mouse.getEventY() * scaledResolution.getScaledHeight()) / targetHudEditor1.mc.displayHeight
|
||||||
|
- 1.0F;
|
||||||
|
if (fx >= targetHudEditor1.width - 210.0F - 12.0F && gx >= targetHudEditor1.c && gx < targetHudEditor1.c + targetHudEditor1.f) {
|
||||||
|
targetHudEditor1.F = Math.clamp(targetHudEditor1.F - ix / 120.0F * 40.0F, 0.0F, Math.max(0.0F, targetHudEditor1.m - targetHudEditor1.f));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
targetHudEditor1.handleMouseInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<float[]> L(TargetHudTextSettings targetHudTextSettings) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
ArrayList arrayList = new ArrayList();
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = targetHudEditor1.targetHUDData2.parts().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
TargetHUDData targetHUDData;
|
||||||
|
if ((targetHUDData = (TargetHUDData)iterator.next()).settings() == targetHudTextSettingsx) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
float[] fx = new float[4];
|
||||||
|
boolean bl = true;
|
||||||
|
fx[0] = targetHUDData.x();
|
||||||
|
fx[1] = targetHUDData.y();
|
||||||
|
fx[2] = targetHUDData.width();
|
||||||
|
fx[3] = targetHUDData.height();
|
||||||
|
arrayList.add(fx);
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float[] L(TargetHUDData targetHUDData) {
|
||||||
|
float[] fx = new float[4];
|
||||||
|
boolean bl = true;
|
||||||
|
fx[0] = this.B + targetHUDData.x() * 2.4F;
|
||||||
|
fx[1] = this.J + targetHUDData.y() * 2.4F;
|
||||||
|
fx[2] = Math.max(targetHUDData.width(), 1.0F) * 2.4F;
|
||||||
|
fx[3] = Math.max(targetHUDData.height(), 1.0F) * 2.4F;
|
||||||
|
return fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseReleased(int i, int j, int k) {
|
||||||
|
this.targetHudTextSettings2 = null;
|
||||||
|
this.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2;
|
||||||
|
|
||||||
|
Iterator iterator;
|
||||||
|
for (Iterator iterator1 = iterator = this.settingList.getSettingControls().iterator(); iterator1.hasNext(); iterator1 = iterator) {
|
||||||
|
((SettingControl)iterator.next()).mouseReleased(ix, j, k);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.uiButton2.mouseReleased(ix, j, k);
|
||||||
|
this.uiButton.mouseReleased(ix, j, k);
|
||||||
|
super.mouseReleased(ix, j, k);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TargetHUDData L(TargetHudTextSettings targetHudTextSettings) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
Iterator iterator = targetHudEditor1.targetHUDData2.parts().iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
TargetHUDData targetHUDData;
|
||||||
|
if ((targetHUDData = (TargetHUDData)iterator.next()).settings() == targetHudTextSettingsx) {
|
||||||
|
return targetHUDData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L() {
|
||||||
|
long l = System.nanoTime();
|
||||||
|
if (this.K == 0L) {
|
||||||
|
this.K = l;
|
||||||
|
return 16.0F;
|
||||||
|
} else {
|
||||||
|
float fx = (float)(l - this.K) / 1000000.0F;
|
||||||
|
this.K = l;
|
||||||
|
return Math.min(fx, 100.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean L(float[] f, float g, float h) {
|
||||||
|
return gx >= fx[0] && gx <= fx[0] + fx[2] && h >= fx[1] && h <= fx[1] + fx[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(float f, float g) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
if (targetHudEditor1.targetHUDData2 != null) {
|
||||||
|
TargetHUDData targetHUDData;
|
||||||
|
if ((targetHUDData = targetHudEditor1.L(targetHudEditor1.targetHudTextSettings2)) != null) {
|
||||||
|
fx = (fx - targetHudEditor1.d - targetHudEditor1.B) / 2.4F;
|
||||||
|
gx = (gx - targetHudEditor1.i - targetHudEditor1.J) / 2.4F;
|
||||||
|
targetHudEditor1.roundedShapesData2 = RoundedShapes.L(
|
||||||
|
fx,
|
||||||
|
gx,
|
||||||
|
targetHUDData.width(),
|
||||||
|
targetHUDData.height(),
|
||||||
|
targetHudEditor1.targetHUDData2.width(),
|
||||||
|
targetHudEditor1.targetHUDData2.height(),
|
||||||
|
0.0F,
|
||||||
|
targetHudEditor1.L(targetHudEditor1.targetHudTextSettings2)
|
||||||
|
);
|
||||||
|
targetHudEditor1.targetHudTextSettings2.offsetX.setValue((double)(targetHudEditor1.roundedShapesData2.x() - targetHudEditor1.L));
|
||||||
|
targetHudEditor1.targetHudTextSettings2.offsetY.setValue((double)(targetHudEditor1.roundedShapesData2.y() - targetHudEditor1.I));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void d(int i, int j) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
float fx = targetHudEditor1.width - 210.0F - 12.0F;
|
||||||
|
float h = 12.0F;
|
||||||
|
float gx = targetHudEditor1.height - 46.0F;
|
||||||
|
targetHudEditor1.render2D.roundedRect(fx, h, 210.0F, gx - h, 16.0F, AlphaLevels.L(2, ThemeManager.getPalette()));
|
||||||
|
float k = h + 12.0F;
|
||||||
|
targetHudEditor1.render2D.drawTextTop(Fonts.FONT_STYLE18, "Elements", fx + 12.0F, k, ThemeManager.getPalette().onSurface());
|
||||||
|
float l = k + (Fonts.FONT_STYLE18.lineHeight() + 4.0F);
|
||||||
|
float mx = targetHudEditor1.L(fx + 12.0F, l, 186.0F, ix, j) + 8.0F;
|
||||||
|
targetHudEditor1.render2D.rect(fx + 12.0F, mx, 186.0F, 1.0F, ThemeManager.getPalette().outlineVariant());
|
||||||
|
float nx;
|
||||||
|
targetHudEditor1.c = nx = mx + 10.0F;
|
||||||
|
targetHudEditor1.f = Math.max(0.0F, gx - 12.0F - targetHudEditor1.c);
|
||||||
|
RenderContext renderContext = new RenderContext(targetHudEditor1.render2D, targetHudEditor1.G, ix, j);
|
||||||
|
float o = fx + 12.0F;
|
||||||
|
fx = 186.0F;
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator2 = iterator = targetHudEditor1.settingList.getSettingControls().iterator();
|
||||||
|
|
||||||
|
while (iterator2.hasNext()) {
|
||||||
|
SettingControl settingControl = (SettingControl)iterator.next();
|
||||||
|
iterator2 = iterator;
|
||||||
|
settingControl.update(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
targetHudEditor1.m = targetHudEditor1.settingList.layout(o, targetHudEditor1.c - targetHudEditor1.F, fx);
|
||||||
|
targetHudEditor1.F = Math.clamp(targetHudEditor1.F, 0.0F, Math.max(0.0F, targetHudEditor1.m - targetHudEditor1.f));
|
||||||
|
targetHudEditor1.m = targetHudEditor1.settingList.layout(o, targetHudEditor1.c - targetHudEditor1.F, fx);
|
||||||
|
targetHudEditor1.render2D.pushScissor(o, targetHudEditor1.c, fx, targetHudEditor1.f);
|
||||||
|
targetHudEditor1.settingList.drawDividers(targetHudEditor1.render2D, o, fx, ThemeManager.getPalette().outlineVariant(), 1.0F);
|
||||||
|
Iterator iterator1;
|
||||||
|
iterator2 = iterator1 = targetHudEditor1.settingList.getSettingControls().iterator();
|
||||||
|
|
||||||
|
while (iterator2.hasNext()) {
|
||||||
|
SettingControl settingControl1 = (SettingControl)iterator1.next();
|
||||||
|
iterator2 = iterator1;
|
||||||
|
settingControl1.render(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
targetHudEditor1.render2D.popScissor();
|
||||||
|
targetHudEditor1.D();
|
||||||
|
targetHudEditor1.uiButton2.update(renderContext);
|
||||||
|
targetHudEditor1.uiButton.update(renderContext);
|
||||||
|
targetHudEditor1.uiButton2.render(renderContext);
|
||||||
|
targetHudEditor1.uiButton.render(renderContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L(float f, float g, float h, int i, int j) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
targetHudEditor1.list.clear();
|
||||||
|
float nx = fx;
|
||||||
|
gx = gx;
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = targetHudEditor1.targetHUD.D().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
TargetHudTextSettings targetHudTextSettingsx;
|
||||||
|
String string = (targetHudTextSettingsx = (TargetHudTextSettings)iterator.next()).getTargetHudElement().getDisplayName();
|
||||||
|
float k = targetHudEditor1.render2D.getTextWidth(Fonts.FONT_STYLE2, string) + 18.0F;
|
||||||
|
if (nx > fx && nx + k > fx + h) {
|
||||||
|
nx = fx;
|
||||||
|
gx += 25.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l = targetHudTextSettingsx == targetHudEditor1.targetHudTextSettings;
|
||||||
|
boolean bl = ix >= nx && ix < nx + k && j >= gx && j < gx + 20.0F;
|
||||||
|
int mx = l ? ThemeManager.getPalette().secondaryContainer() : ThemeManager.withAlpha(ThemeManager.getPalette().onSurface(), bl ? 0.1F : 0.04F);
|
||||||
|
l = l
|
||||||
|
? ThemeManager.getPalette().onSecondaryContainer()
|
||||||
|
: ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), targetHudTextSettingsx.h() ? 1.0F : 0.45F);
|
||||||
|
iterator1 = iterator;
|
||||||
|
targetHudEditor1.render2D.roundedRect(nx, gx, k, 20.0F, Float.MAX_VALUE, mx);
|
||||||
|
targetHudEditor1.render2D.drawTextCenteredVCentered(Fonts.FONT_STYLE2, string, nx + k / 2.0F, gx + 10.0F, l);
|
||||||
|
float[] o = new float[4];
|
||||||
|
boolean bl1 = true;
|
||||||
|
o[0] = nx;
|
||||||
|
o[1] = gx;
|
||||||
|
o[2] = k;
|
||||||
|
o[3] = 20.0F;
|
||||||
|
targetHudEditor1.list.add(o);
|
||||||
|
nx += k + 5.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gx + 20.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesGuiPauseGame() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int i, int j, int k) throws IOException {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
int l;
|
||||||
|
if (k == 0) {
|
||||||
|
for (int mx = l = 0; mx < targetHudEditor1.list.size(); mx = ++l) {
|
||||||
|
if (L(targetHudEditor1.list.get(l), ix, j)) {
|
||||||
|
targetHudEditor1.L(targetHudEditor1.targetHUD.D().get(l));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator iterator = targetHudEditor1.settingList.getSettingControls().iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
if (((SettingControl)iterator.next()).mouseClicked(ix, j, k)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!targetHudEditor1.uiButton2.mouseClicked(ix, j, k)) {
|
||||||
|
if (!targetHudEditor1.uiButton.mouseClicked(ix, j, k)) {
|
||||||
|
if (k != 0 || !targetHudEditor1.L((float)ix, (float)j)) {
|
||||||
|
targetHudEditor1.mouseClicked(ix, j, k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(TargetHUDData targetHUDData, int i, int j) {
|
||||||
|
boolean bl = targetHUDData.settings() == this.targetHudTextSettings;
|
||||||
|
float[] fx = this.L(targetHUDData);
|
||||||
|
boolean bl1 = bl || this.targetHudTextSettings2 == null && L(fx, ix, j);
|
||||||
|
if (bl1) {
|
||||||
|
ix = bl ? ThemeManager.getPalette().primary() : ThemeManager.withAlpha(ThemeManager.getPalette().onSurface(), 0.45F);
|
||||||
|
float gx = fx[0] - 2.0F;
|
||||||
|
float h = fx[1] - 2.0F;
|
||||||
|
float k = fx[2] + 4.0F;
|
||||||
|
float l = fx[3] + 4.0F;
|
||||||
|
float mx;
|
||||||
|
int nx;
|
||||||
|
if (bl) {
|
||||||
|
mx = 1.5F;
|
||||||
|
nx = ix;
|
||||||
|
} else {
|
||||||
|
mx = 1.0F;
|
||||||
|
nx = ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.render2D.roundedOutline(gx, h, k, l, 4.0F, mx, nx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(TargetHudTextSettings targetHudTextSettings) {
|
||||||
|
if (this.targetHudTextSettings != targetHudTextSettingsx) {
|
||||||
|
this.targetHudTextSettings = targetHudTextSettingsx;
|
||||||
|
this.L();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L() {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
targetHudEditor1.settingList.clear();
|
||||||
|
targetHudEditor1.F = 0.0F;
|
||||||
|
if (targetHudEditor1.targetHudTextSettings != null) {
|
||||||
|
ArrayList arrayList;
|
||||||
|
(arrayList = new ArrayList()).add(targetHudEditor1.targetHudTextSettings.getEnabled());
|
||||||
|
arrayList.addAll(targetHudEditor1.targetHudTextSettings.getSettings());
|
||||||
|
targetHudEditor1.settingList.setSettings(arrayList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TargetHudEditor(GuiScreen guiScreen) {
|
||||||
|
this.targetHUD = OnyxClient.moduleManager.targetHUD;
|
||||||
|
this.render2D = new Render2D();
|
||||||
|
this.settingList = new SettingList();
|
||||||
|
this.uiButton2 = new UiButton(UiButtonMode.OUTLINED, "Reset", () -> {
|
||||||
|
if (this.targetHudTextSettings != null) {
|
||||||
|
this.targetHudTextSettings.i();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.uiButton = new UiButton(UiButtonMode.FILLED, "Done", () -> this.mc.displayGuiScreen(this.x));
|
||||||
|
this.roundedShapesData2 = RoundedShapes.ROUNDED_SHAPES_DATA2;
|
||||||
|
this.list = new ArrayList<>();
|
||||||
|
this.x = guiScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(int i, int j) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
targetHudEditor1.y = targetHudEditor1.targetHUDData2.width() * 2.4F;
|
||||||
|
targetHudEditor1.P = targetHudEditor1.targetHUDData2.height() * 2.4F;
|
||||||
|
targetHudEditor1.B = (targetHudEditor1.width - 210.0F - 12.0F) / 2.0F - targetHudEditor1.y / 2.0F;
|
||||||
|
targetHudEditor1.J = targetHudEditor1.height / 2.0F - targetHudEditor1.P / 2.0F;
|
||||||
|
targetHudEditor1.render2D.pushMatrix();
|
||||||
|
targetHudEditor1.render2D.translate(targetHudEditor1.B, targetHudEditor1.J);
|
||||||
|
targetHudEditor1.render2D.scaleAround(2.4F, 0.0F, 0.0F);
|
||||||
|
targetHudEditor1.targetHUD.L(targetHudEditor1.render2D, ThemeManager.getPalette(), targetHudEditor1.targetHUDData2, false);
|
||||||
|
if (targetHudEditor1.targetHudTextSettings2 != null) {
|
||||||
|
RoundedShapes.L(
|
||||||
|
targetHudEditor1.render2D, targetHudEditor1.targetHUDData2.width(), targetHudEditor1.targetHUDData2.height(), targetHudEditor1.roundedShapesData2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
targetHudEditor1.render2D.popMatrix();
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = targetHudEditor1.targetHUDData2.parts().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
TargetHUDData targetHUDData = (TargetHUDData)iterator.next();
|
||||||
|
iterator1 = iterator;
|
||||||
|
targetHudEditor1.L(targetHUDData, ix, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int i, int j, float f) {
|
||||||
|
this.G = this.L();
|
||||||
|
this.render2D.beginFrame();
|
||||||
|
TargetHudEditor targetHudEditor1;
|
||||||
|
if (this.mc.theWorld != null) {
|
||||||
|
this.render2D.rect(0.0F, 0.0F, this.width, this.height, ThemeManager.scrim(0.55F));
|
||||||
|
targetHudEditor1 = this;
|
||||||
|
} else {
|
||||||
|
this.render2D.L(0.0F, 0.0F, this.width, this.height);
|
||||||
|
targetHudEditor1 = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetHudEditor1.targetHUDData2 = this.targetHUD.L(this.render2D, ThemeManager.getPalette(), this.G);
|
||||||
|
fx = this.width - 210.0F - 12.0F;
|
||||||
|
this.render2D.drawTextCentered(Fonts.FONT_STYLE14, "Target HUD", fx / 2.0F, 22.0F, ThemeManager.getPalette().onSurface());
|
||||||
|
String string;
|
||||||
|
float gx;
|
||||||
|
if (this.targetHUDData2 == null) {
|
||||||
|
string = "Join a world to preview the card";
|
||||||
|
gx = fx;
|
||||||
|
} else {
|
||||||
|
string = "Drag an element to move it, or pick one to edit";
|
||||||
|
gx = fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.render2D.drawTextCentered(Fonts.FONT_STYLE2, string, gx / 2.0F, 44.0F, ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.85F));
|
||||||
|
if (this.targetHUDData2 != null) {
|
||||||
|
this.L(ix, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.d(ix, j);
|
||||||
|
this.render2D.clearScissors();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(float f, float g) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
if (targetHudEditor1.targetHUDData2 == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ix;
|
||||||
|
List listx;
|
||||||
|
for (int j = ix = (listx = targetHudEditor1.targetHUDData2.parts()).size() - 1; j >= 0; j = --ix) {
|
||||||
|
TargetHUDData targetHUDData = (TargetHUDData)listx.get(ix);
|
||||||
|
float[] h;
|
||||||
|
if (L(h = targetHudEditor1.L(targetHUDData), fx, gx)) {
|
||||||
|
targetHudEditor1.L(targetHUDData.settings());
|
||||||
|
targetHudEditor1.targetHudTextSettings2 = targetHUDData.settings();
|
||||||
|
targetHudEditor1.d = fx - h[0];
|
||||||
|
targetHudEditor1.i = gx - h[1];
|
||||||
|
targetHudEditor1.L = targetHUDData.x() - targetHUDData.settings().offsetX.getFloat();
|
||||||
|
targetHudEditor1.I = targetHUDData.y() - targetHUDData.settings().offsetY.getFloat();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClickMove(int i, int j, int k, long l) {
|
||||||
|
TargetHudEditor targetHudEditor1 = this;
|
||||||
|
if (targetHudEditor1.targetHudTextSettings2 != null) {
|
||||||
|
targetHudEditor1.L((float)ix, (float)j);
|
||||||
|
} else {
|
||||||
|
Iterator iterator = targetHudEditor1.settingList.getSettingControls().iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
if (((SettingControl)iterator.next()).mouseDragged(ix, j, k, 0.0F, 0.0F)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
targetHudEditor1.mouseClickMove(ix, j, k, l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user