Upload files to "src/openonyx/features/render"
This commit is contained in:
1 parent
f809352c54
commit
009aefdc2c
5 files changed
+703
No files matched your search
@@ -0,0 +1,639 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||||
|
import net.minecraft.scoreboard.Team;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
import openonyx.events.ChatFormattingUtils;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.features.ModuleCategory;
|
||||||
|
import openonyx.features.ModuleManager;
|
||||||
|
import openonyx.features.combat.AntiBot;
|
||||||
|
import openonyx.features.player.NameChanger;
|
||||||
|
import openonyx.history.internal.ActionSetting;
|
||||||
|
import openonyx.history.internal.BooleanSetting;
|
||||||
|
import openonyx.history.internal.ColorSetting;
|
||||||
|
import openonyx.history.internal.KeybindSetting;
|
||||||
|
import openonyx.history.internal.MultiSelectSetting;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
import openonyx.render.EntityProjection;
|
||||||
|
import openonyx.render.EntityProjectionData2;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.WorldToScreen;
|
||||||
|
import openonyx.render.group_e.FontStyle;
|
||||||
|
import openonyx.theme.Fonts;
|
||||||
|
import openonyx.ui.NametagEditor;
|
||||||
|
|
||||||
|
public class ESP extends Module {
|
||||||
|
public KeybindSetting peekKey;
|
||||||
|
public ColorSetting background;
|
||||||
|
public NumberSetting z;
|
||||||
|
public BooleanSetting enchantPeek;
|
||||||
|
private static final int s = 4;
|
||||||
|
private static final float Z = 3.0F;
|
||||||
|
private static final int[] O;
|
||||||
|
private static final int N = -38302;
|
||||||
|
public BooleanSetting equipmentFirst;
|
||||||
|
private static final float x = 16.0F;
|
||||||
|
private static final int u = -15253;
|
||||||
|
private static final float y = 70.0F;
|
||||||
|
private static final float n = 0.6F;
|
||||||
|
private static final float Y = 3.0F;
|
||||||
|
private static final float r = 4.0F;
|
||||||
|
public NumberSetting nameFreeX;
|
||||||
|
public ActionSetting editLayout = new ActionSetting("Edit layout", () -> mc.displayGuiScreen(new NametagEditor(mc.currentScreen)))
|
||||||
|
.describe("Drag the name and equipment around the player");
|
||||||
|
public NumberSetting equipmentFreeY;
|
||||||
|
public BooleanSetting equipment;
|
||||||
|
public static final int p = 1;
|
||||||
|
public MultiSelectSetting<SlotsMode> slots;
|
||||||
|
public static final int b = 1;
|
||||||
|
private static final int E = 3;
|
||||||
|
public BooleanSetting freeLayout;
|
||||||
|
public NumberSetting equipmentFreeX;
|
||||||
|
private static final float A = 10.0F;
|
||||||
|
private static final float K = 2.0F;
|
||||||
|
private static final float B = 4.0F;
|
||||||
|
private static final int C = -6560885;
|
||||||
|
private final Render2D render2D;
|
||||||
|
public MultiSelectSetting<NameDetailsMode> nameDetails;
|
||||||
|
public NumberSetting nameZone;
|
||||||
|
public static final float a = 22.0F;
|
||||||
|
public ColorSetting textColor;
|
||||||
|
public static final int g = 0;
|
||||||
|
public static final float M = 2.0F;
|
||||||
|
private static final float L = 1.1F;
|
||||||
|
public NumberSetting nameFreeY;
|
||||||
|
private static final float m = 12.0F;
|
||||||
|
public static final int h = 2;
|
||||||
|
private static final float l = 1.0F;
|
||||||
|
public NumberSetting equipmentZone;
|
||||||
|
public BooleanSetting names = new BooleanSetting("Names", true);
|
||||||
|
private static final float i = 3.0F;
|
||||||
|
public static final int f = 3;
|
||||||
|
public static final int H = 0;
|
||||||
|
public NumberSetting scale;
|
||||||
|
|
||||||
|
public float[] L(int i, float f, boolean bl) {
|
||||||
|
int j;
|
||||||
|
float gx = ((j = Math.max(ix, 1)) * 22.0F + (j - 1) * 2.0F) * fx;
|
||||||
|
fx = 22.0F * fx;
|
||||||
|
if (bl) {
|
||||||
|
float[] hx = new float[2];
|
||||||
|
boolean bl1 = true;
|
||||||
|
hx[0] = gx;
|
||||||
|
hx[1] = fx;
|
||||||
|
return hx;
|
||||||
|
} else {
|
||||||
|
float[] k = new float[2];
|
||||||
|
boolean bl2 = true;
|
||||||
|
k[0] = fx;
|
||||||
|
k[1] = gx;
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> D() {
|
||||||
|
ArrayList arrayList = new ArrayList(4);
|
||||||
|
|
||||||
|
int ix;
|
||||||
|
for (int j = ix = 0; j < 4; j = ix) {
|
||||||
|
ix++;
|
||||||
|
arrayList.add(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
int[] ix = new int[16];
|
||||||
|
boolean bl = true;
|
||||||
|
ix[0] = 0;
|
||||||
|
ix[1] = 170;
|
||||||
|
ix[2] = 43520;
|
||||||
|
ix[3] = 43690;
|
||||||
|
ix[4] = 11141120;
|
||||||
|
ix[5] = 11141290;
|
||||||
|
ix[6] = 16755200;
|
||||||
|
ix[7] = 11184810;
|
||||||
|
ix[8] = 5592405;
|
||||||
|
ix[9] = 5592575;
|
||||||
|
ix[10] = 5635925;
|
||||||
|
ix[11] = 5636095;
|
||||||
|
ix[12] = 16733525;
|
||||||
|
ix[13] = 16733695;
|
||||||
|
ix[14] = 16777045;
|
||||||
|
ix[15] = 16777215;
|
||||||
|
O = ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int L(float f) {
|
||||||
|
float gx = fx;
|
||||||
|
return (fx = Math.clamp(gx, 0.0F, 1.0F)) < 0.5F ? L(-38302, -15253, fx * 2.0F) : L(-15253, -6560885, (fx - 0.5F) * 2.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String d(String string) {
|
||||||
|
return ChatFormattingUtils.L(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ESPData2> L(Render2D render2D, EntityPlayer entityPlayer, float f, float g, float h, float i, float j, float k, boolean bl) {
|
||||||
|
float lx = this.L(ix);
|
||||||
|
float mx = fx + hx;
|
||||||
|
float nx = gx + ix;
|
||||||
|
hx = fx + hx / 2.0F;
|
||||||
|
float o = gx + ix / 2.0F;
|
||||||
|
boolean bl1 = this.names.isEnabled();
|
||||||
|
List list;
|
||||||
|
int px = !(list = this.d(entityPlayer)).isEmpty() ? list.size() : (bl ? 4 : 0);
|
||||||
|
bl = this.equipment.isEnabled() && px > 0;
|
||||||
|
list = new ArrayList(2);
|
||||||
|
if (this.freeLayout.isEnabled()) {
|
||||||
|
if (bl1) {
|
||||||
|
float[] w = this.L(render2Dx, entityPlayer, lx);
|
||||||
|
list.add(new ESPData2(0, hx + this.nameFreeX.getFloat() * ix, o + this.nameFreeY.getFloat() * ix, w[0], w[1], false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bl) {
|
||||||
|
float[] xx = this.L(px, lx, false);
|
||||||
|
list.add(new ESPData2(1, hx + this.equipmentFreeX.getFloat() * ix, o + this.equipmentFreeY.getFloat() * ix, xx[0], xx[1], false));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
} else {
|
||||||
|
float q = 12.0F * lx;
|
||||||
|
hx = 10.0F * lx;
|
||||||
|
|
||||||
|
for (int bd = v = 0; bd < 4; bd = ++v) {
|
||||||
|
boolean bl2 = v == 0 || v == 3;
|
||||||
|
boolean bl3 = bl1 && this.nameZone.getInt() == v;
|
||||||
|
boolean bl4 = bl && this.equipmentZone.getInt() == v;
|
||||||
|
if (bl3 || bl4) {
|
||||||
|
ArrayList arrayList = new ArrayList(2);
|
||||||
|
ArrayList arrayList1 = new ArrayList(2);
|
||||||
|
int rx = bl3 && bl4 && this.equipmentFirst.isEnabled();
|
||||||
|
if (rx) {
|
||||||
|
arrayList.add(1);
|
||||||
|
arrayList1.add(this.L(px, lx, bl2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bl3) {
|
||||||
|
arrayList.add(0);
|
||||||
|
arrayList1.add(this.L(render2Dx, entityPlayer, lx));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bl4 && !rx) {
|
||||||
|
arrayList.add(1);
|
||||||
|
arrayList1.add(this.L(px, lx, bl2));
|
||||||
|
}
|
||||||
|
|
||||||
|
float yx = hx * (arrayList1.size() - 1);
|
||||||
|
|
||||||
|
for (Iterator iterator1 = iterator = arrayList1.iterator(); iterator1.hasNext(); iterator1 = iterator) {
|
||||||
|
float[] bb = (float[])iterator.next();
|
||||||
|
yx += bb[1];
|
||||||
|
}
|
||||||
|
float ba = switch (v) {
|
||||||
|
case 0 -> {
|
||||||
|
while (false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
yield gx - q - yx;
|
||||||
|
}
|
||||||
|
case 3 -> nx + q;
|
||||||
|
default -> o - yx / 2.0F;
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int bc = rx = 0; bc < arrayList1.size(); bc = rx) {
|
||||||
|
float zx = ((float[])arrayList1.get(rx))[0];
|
||||||
|
float sx = ((float[])arrayList1.get(rx))[1];
|
||||||
|
float t = ba + sx / 2.0F;
|
||||||
|
|
||||||
|
float ux = switch (v) {
|
||||||
|
case 1 -> {
|
||||||
|
while (false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
yield fx - q - zx / 2.0F;
|
||||||
|
}
|
||||||
|
case 2 -> mx + q + zx / 2.0F;
|
||||||
|
case 3 -> k;
|
||||||
|
default -> j;
|
||||||
|
};
|
||||||
|
list.add(new ESPData2((Integer)arrayList.get(rx), ux, t, zx, sx, bl2));
|
||||||
|
rx++;
|
||||||
|
ba += sx + hx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int d(EntityPlayer entityPlayer) {
|
||||||
|
NetworkPlayerInfo networkPlayerInfo;
|
||||||
|
return (networkPlayerInfo = this.L(entityPlayer)) == null ? 0 : Math.max(0, networkPlayerInfo.getResponseTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L(Render2D render2D, List<ESPData> list) {
|
||||||
|
float fx = 0.0F;
|
||||||
|
|
||||||
|
int ix;
|
||||||
|
for (int j = ix = 0; j < list.size(); j = ix) {
|
||||||
|
if (ix > 0) {
|
||||||
|
fx += 4.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontStyle fontStyle = ((ESPData)list.get(ix)).style();
|
||||||
|
String string = ((ESPData)list.get(ix)).text();
|
||||||
|
ix++;
|
||||||
|
fx += render2Dx.getTextWidth(fontStyle, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> L(ItemStack itemStack) {
|
||||||
|
if (itemStack == null) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map map = EnchantmentHelper.getEnchantments(itemStack);
|
||||||
|
ArrayList arrayList = new ArrayList(map.size());
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = map.entrySet().iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
Entry entry;
|
||||||
|
Enchantment enchantment;
|
||||||
|
if ((enchantment = Enchantment.getEnchantmentById((Integer)(entry = (Entry)iterator.next()).getKey())) == null) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
arrayList.add(
|
||||||
|
new StringBuilder().insert(0, L(d(enchantment.getTranslatedName(1)).replaceAll("\\s+[IVXLCDM]+$", ""))).append(entry.getValue()).toString()
|
||||||
|
);
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean L(EntityPlayer entityPlayer) {
|
||||||
|
if (!this.isEnabled() || mc.thePlayer == null || mc.theWorld == null) {
|
||||||
|
return false;
|
||||||
|
} else if (!entityPlayer.isEntityAlive() || entityPlayer.isSpectator()) {
|
||||||
|
return false;
|
||||||
|
} else if (AntiBot.L((Entity)entityPlayer)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return entityPlayer == mc.thePlayer && mc.gameSettings.thirdPersonView == 0
|
||||||
|
? false
|
||||||
|
: mc.thePlayer.getDistanceSqToEntity(entityPlayer) <= this.z.getValue() * this.z.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> d(EntityPlayer entityPlayer) {
|
||||||
|
ESP eSP1 = this;
|
||||||
|
ArrayList arrayList = new ArrayList(SlotsMode.values().length);
|
||||||
|
SlotsMode[] slotsModes;
|
||||||
|
int j = (slotsModes = SlotsMode.values()).length;
|
||||||
|
|
||||||
|
int ix;
|
||||||
|
for (int k = ix = 0; k < j; k = ++ix) {
|
||||||
|
SlotsMode slotsMode = slotsModes[ix];
|
||||||
|
ItemStack itemStack;
|
||||||
|
if (eSP1.slots.contains(slotsMode) && (itemStack = entityPlayer.getEquipmentInSlot(slotsMode.L())) != null) {
|
||||||
|
arrayList.add(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(Render2D render2D, EntityPlayer entityPlayer, float f, float g, float h) {
|
||||||
|
List list = this.L(entityPlayer);
|
||||||
|
float ix = this.L(render2Dx, list) + 8.0F;
|
||||||
|
float j = Fonts.FONT_STYLE11.lineHeight() + 4.0F;
|
||||||
|
render2Dx.pushMatrix();
|
||||||
|
render2Dx.translate(fx - ix * hx / 2.0F, gx - j * hx / 2.0F);
|
||||||
|
render2Dx.scaleAround(hx, 0.0F, 0.0F);
|
||||||
|
render2Dx.roundedRect(0.0F, 0.0F, ix, j, 8.0F, this.background.getValue());
|
||||||
|
float k = 4.0F;
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = list.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
ESPData eSPData = (ESPData)iterator.next();
|
||||||
|
iterator1 = iterator;
|
||||||
|
render2Dx.drawTextVCentered(eSPData.style(), eSPData.text(), k, j / 2.0F, eSPData.color());
|
||||||
|
k += render2Dx.getTextWidth(eSPData.style(), eSPData.text()) + 4.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
render2Dx.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
private NetworkPlayerInfo L(EntityPlayer entityPlayer) {
|
||||||
|
return mc.getNetHandler() == null ? null : mc.getNetHandler().getPlayerInfo(entityPlayer.getUniqueID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(Render2D render2D, EntityPlayer entityPlayer, float f, float g, float h, float i, float j, float k, boolean bl) {
|
||||||
|
float lx = this.L(ix);
|
||||||
|
List list;
|
||||||
|
List list1 = (list = this.d(entityPlayer)).isEmpty() && bl ? this.D() : list;
|
||||||
|
Iterator iterator = this.L(render2Dx, entityPlayer, fx, gx, hx, ix, j, k, bl).iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
ESPData2 eSPData2;
|
||||||
|
if ((eSPData2 = (ESPData2)iterator.next()).type() == 0) {
|
||||||
|
this.L(render2Dx, entityPlayer, eSPData2.centerX(), eSPData2.centerY(), lx);
|
||||||
|
} else {
|
||||||
|
this.L(render2Dx, entityPlayer, eSPData2.centerX(), eSPData2.centerY(), lx, list1, eSPData2.horizontal());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float L(float f) {
|
||||||
|
return this.scale.getFloat() * Math.clamp(fx / 70.0F, 0.6F, 1.1F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String L(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
String[] strings;
|
||||||
|
if ((strings = string1.split(" ")).length == 1) {
|
||||||
|
return strings[0].substring(0, Math.min(3, strings[0].length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(strings.length);
|
||||||
|
String[] strings1;
|
||||||
|
int j = (strings1 = strings).length;
|
||||||
|
|
||||||
|
int ix;
|
||||||
|
for (int k = ix = 0; k < j; k = ++ix) {
|
||||||
|
String string2;
|
||||||
|
if (!(string2 = strings1[ix]).isEmpty()) {
|
||||||
|
stringBuilder.append(string2.charAt(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean L(EntityLivingBase entityLivingBase) {
|
||||||
|
EntityLivingBase entityLivingBase1 = entityLivingBase;
|
||||||
|
ModuleManager moduleManager = OnyxClient.moduleManager;
|
||||||
|
ESP eSP;
|
||||||
|
return OnyxClient.moduleManager != null && entityLivingBase1 instanceof EntityPlayer
|
||||||
|
? (eSP = moduleManager.esp).names.isEnabled() && eSP.L((EntityPlayer)entityLivingBase1)
|
||||||
|
: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int L(int i, int j, float f) {
|
||||||
|
int k = ix;
|
||||||
|
int lx = -16777216;
|
||||||
|
|
||||||
|
for (byte c = bx = 0; c <= 16; c = bx) {
|
||||||
|
int mx = k >> bx & 0xFF;
|
||||||
|
int nx = j >> bx & 0xFF;
|
||||||
|
int o = Math.round(mx + (nx - mx) * fx);
|
||||||
|
byte d = bx;
|
||||||
|
bx += 8;
|
||||||
|
lx |= o << d;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean k() {
|
||||||
|
return this.equipment.isEnabled() && this.enchantPeek.isEnabled() && this.peekKey.isBound() && this.peekKey.isPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int L(EntityPlayer entityPlayer) {
|
||||||
|
Team team;
|
||||||
|
int ix;
|
||||||
|
return (team = entityPlayer.getTeam()) instanceof ScorePlayerTeam && (ix = ((ScorePlayerTeam)team).getChatFormat().getColorIndex()) >= 0 && ix < O.length
|
||||||
|
? 0xFF000000 | O[ix]
|
||||||
|
: this.textColor.getOpaque();
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] L(Render2D render2D, EntityPlayer entityPlayer, float f) {
|
||||||
|
float gx = this.L(render2Dx, this.L(entityPlayer)) + 8.0F;
|
||||||
|
float hx = Fonts.FONT_STYLE11.lineHeight() + 4.0F;
|
||||||
|
float[] ix = new float[2];
|
||||||
|
boolean bl = true;
|
||||||
|
ix[0] = gx * fx;
|
||||||
|
ix[1] = hx * fx;
|
||||||
|
return ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(Render2D render2D, EntityPlayer entityPlayer, float f, float g, float h, List<ItemStack> list, boolean bl) {
|
||||||
|
int lx;
|
||||||
|
float ix = (lx = list.size()) * 22.0F + (lx - 1) * 2.0F;
|
||||||
|
float j = bl ? ix : 22.0F;
|
||||||
|
float k = bl ? 22.0F : ix;
|
||||||
|
int q = 0;
|
||||||
|
render2Dx.pushMatrix();
|
||||||
|
render2Dx.translate(fx - j * hx / 2.0F, gx - k * hx / 2.0F);
|
||||||
|
render2Dx.scaleAround(hx, 0.0F, 0.0F);
|
||||||
|
|
||||||
|
for (int mx = 0; q < lx; q = mx) {
|
||||||
|
gx = bl ? mx * 24.0F : 0.0F;
|
||||||
|
hx = bl ? 0.0F : mx * 24.0F;
|
||||||
|
render2Dx.roundedRect(gx, hx, 22.0F, 22.0F, 8.0F, this.background.getValue());
|
||||||
|
render2Dx.pushMatrix();
|
||||||
|
render2Dx.translate(gx + 3.0F, hx + 3.0F);
|
||||||
|
ItemStack itemStack = (ItemStack)list.get(mx);
|
||||||
|
mx++;
|
||||||
|
render2Dx.drawItem(itemStack, 0.0F, 0.0F);
|
||||||
|
render2Dx.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
int nx;
|
||||||
|
if (this.k()) {
|
||||||
|
for (int o = nx = 0; o < lx; o = ++nx) {
|
||||||
|
ItemStack itemStack1 = (ItemStack)list.get(nx);
|
||||||
|
float rx;
|
||||||
|
boolean bl1;
|
||||||
|
if (bl) {
|
||||||
|
rx = nx * 24.0F;
|
||||||
|
bl1 = bl;
|
||||||
|
} else {
|
||||||
|
rx = 0.0F;
|
||||||
|
bl1 = bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
float px;
|
||||||
|
boolean bl2;
|
||||||
|
if (bl1) {
|
||||||
|
px = 0.0F;
|
||||||
|
bl2 = bl;
|
||||||
|
} else {
|
||||||
|
px = nx * 24.0F;
|
||||||
|
bl2 = bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.L(render2Dx, itemStack1, rx, px, bl2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render2Dx.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void L(Render2D render2D, ItemStack itemStack, float f, float g, boolean bl) {
|
||||||
|
ESP eSP1 = this;
|
||||||
|
List list;
|
||||||
|
if (!(list = eSP1.L(itemStack)).isEmpty()) {
|
||||||
|
float hx = Fonts.FONT_STYLE13.lineHeight() + 2.0F;
|
||||||
|
float ix = 0.0F;
|
||||||
|
|
||||||
|
for (Iterator iterator1 = iterator = list.iterator(); iterator1.hasNext(); iterator1 = iterator) {
|
||||||
|
String string = (String)iterator.next();
|
||||||
|
ix = Math.max(ix, render2Dx.getTextWidth(Fonts.FONT_STYLE13, string));
|
||||||
|
}
|
||||||
|
|
||||||
|
float j = ix + 6.0F;
|
||||||
|
float lx = list.size() * hx;
|
||||||
|
fx = bl ? fx + (22.0F - j) / 2.0F : fx + 22.0F + 3.0F;
|
||||||
|
gx = bl ? gx + 22.0F + 3.0F : gx + (22.0F - lx) / 2.0F;
|
||||||
|
int mx = 0;
|
||||||
|
render2Dx.roundedRect(fx, gx, j, lx, 4.0F, eSP1.background.getValue());
|
||||||
|
|
||||||
|
for (int k = 0; mx < list.size(); mx = k) {
|
||||||
|
FontStyle fontStyle = Fonts.FONT_STYLE13;
|
||||||
|
String string1 = (String)list.get(k);
|
||||||
|
float nx = fx + j / 2.0F;
|
||||||
|
float o = gx + hx * (k + 0.5F);
|
||||||
|
k++;
|
||||||
|
render2Dx.drawTextCenteredVCentered(fontStyle, string1, nx, o, eSP1.textColor.getOpaque());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ESP() {
|
||||||
|
super("ESP", "A player's name and equipment, positioned around them", ModuleCategory.RENDER);
|
||||||
|
NameDetailsMode[] nameDetailsModes = new NameDetailsMode[0];
|
||||||
|
boolean bl = true;
|
||||||
|
this.nameDetails = new MultiSelectSetting<>("Name details", NameDetailsMode.class, nameDetailsModes)
|
||||||
|
.describe("Extra readouts carried on the name plate")
|
||||||
|
.visibleWhen(this.names);
|
||||||
|
this.equipment = new BooleanSetting("Equipment", true);
|
||||||
|
this.slots = new MultiSelectSetting<>("Slots", SlotsMode.class, SlotsMode.values()).describe("Equipment pieces to show").visibleWhen(this.equipment);
|
||||||
|
this.enchantPeek = new BooleanSetting("Enchant peek", true)
|
||||||
|
.describe("Hold a key to list the enchantments on every shown item")
|
||||||
|
.visibleWhen(this.equipment);
|
||||||
|
this.peekKey = new KeybindSetting("Peek key", 56).describe("Held to reveal enchantments").visibleWhen(this.enchantPeek);
|
||||||
|
this.z = new NumberSetting("Distance", 256.0, 8.0, 256.0, 8.0).withSuffix(" m").describe("Maximum distance at which player ESP is shown");
|
||||||
|
this.scale = new NumberSetting("Scale", 1.0, 0.5, 2.0, 0.05).withSuffix("x");
|
||||||
|
this.textColor = new ColorSetting("Text color", -1);
|
||||||
|
this.background = new ColorSetting("Background", -1609033185).L();
|
||||||
|
this.nameZone = new NumberSetting("Name zone", 0.0, 0.0, 3.0, 1.0).visibleWhen(() -> false);
|
||||||
|
this.equipmentZone = new NumberSetting("Equipment zone", 3.0, 0.0, 3.0, 1.0).visibleWhen(() -> false);
|
||||||
|
this.freeLayout = new BooleanSetting("Free layout", false).visibleWhen(() -> false);
|
||||||
|
this.equipmentFirst = new BooleanSetting("Equipment first", false).visibleWhen(() -> false);
|
||||||
|
this.nameFreeX = new NumberSetting("Name free X", 0.0, -2.0, 2.0, 1.0E-4).visibleWhen(() -> false);
|
||||||
|
this.nameFreeY = new NumberSetting("Name free Y", -0.72, -2.0, 2.0, 1.0E-4).visibleWhen(() -> false);
|
||||||
|
this.equipmentFreeX = new NumberSetting("Equipment free X", -0.6, -2.0, 2.0, 1.0E-4).visibleWhen(() -> false);
|
||||||
|
this.equipmentFreeY = new NumberSetting("Equipment free Y", 0.0, -2.0, 2.0, 1.0E-4).visibleWhen(() -> false);
|
||||||
|
this.render2D = new Render2D().withoutCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String L(EntityPlayer entityPlayer) {
|
||||||
|
String string;
|
||||||
|
ScorePlayerTeam scorePlayerTeam;
|
||||||
|
Team team;
|
||||||
|
if ((team = entityPlayer.getTeam()) instanceof ScorePlayerTeam
|
||||||
|
&& !(string = d((scorePlayerTeam = (ScorePlayerTeam)team).getColorPrefix()).trim()).isEmpty()) {
|
||||||
|
return string;
|
||||||
|
} else {
|
||||||
|
NetworkPlayerInfo networkPlayerInfo;
|
||||||
|
if ((networkPlayerInfo = this.L(entityPlayer)) != null && networkPlayerInfo.getDisplayName() != null) {
|
||||||
|
int ix;
|
||||||
|
return (ix = (string = d(networkPlayerInfo.getDisplayName().getFormattedText())).indexOf(d(entityPlayer.getName()))) <= 0
|
||||||
|
? ""
|
||||||
|
: string.substring(0, ix).trim();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ESPData> L(EntityPlayer entityPlayer) {
|
||||||
|
ArrayList arrayList = new ArrayList(4);
|
||||||
|
int ix = this.textColor.getOpaque();
|
||||||
|
String string;
|
||||||
|
if (this.nameDetails.contains(NameDetailsMode.RANK) && !(string = this.L(entityPlayer)).isEmpty()) {
|
||||||
|
arrayList.add(new ESPData(Fonts.FONT_STYLE13, string, this.L(entityPlayer)));
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayList.add(new ESPData(Fonts.FONT_STYLE11, d(NameChanger.L(entityPlayer)), ix));
|
||||||
|
if (this.nameDetails.contains(NameDetailsMode.HEALTH)) {
|
||||||
|
float gx = entityPlayer.getHealth() + entityPlayer.getAbsorptionAmount();
|
||||||
|
float fx = Math.max(1.0F, entityPlayer.getMaxHealth());
|
||||||
|
arrayList.add(new ESPData(Fonts.FONT_STYLE13, Math.round(gx) + "hp", L(entityPlayer.getHealth() / fx)));
|
||||||
|
}
|
||||||
|
|
||||||
|
int j;
|
||||||
|
if (this.nameDetails.contains(NameDetailsMode.PING) && (j = this.d(entityPlayer)) > 0) {
|
||||||
|
arrayList.add(new ESPData(Fonts.FONT_STYLE13, j + "ms", ix));
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(float f) {
|
||||||
|
ESP eSP1 = this;
|
||||||
|
if (eSP1.isEnabled() && mc.thePlayer != null && mc.theWorld != null) {
|
||||||
|
if (WorldToScreen.L()) {
|
||||||
|
ScaledResolution scaledResolution = new ScaledResolution(mc);
|
||||||
|
float hx = scaledResolution.getScaledWidth();
|
||||||
|
float gx = scaledResolution.getScaledHeight();
|
||||||
|
ArrayList arrayList;
|
||||||
|
(arrayList = new ArrayList<>(mc.theWorld.playerEntities))
|
||||||
|
.sort(Comparator.<EntityPlayer>comparingDouble(entityPlayer -> mc.thePlayer.getDistanceSqToEntity(entityPlayerx)).reversed());
|
||||||
|
eSP1.render2D.beginFrame();
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = arrayList.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
EntityPlayer entityPlayer = (EntityPlayer)iterator.next();
|
||||||
|
if (!eSP1.L(entityPlayer)) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
EntityProjectionData2 entityProjectionData2;
|
||||||
|
if ((entityProjectionData2 = EntityProjection.L(entityPlayer, fx, hx, gx)) == null) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
eSP1.L(
|
||||||
|
eSP1.render2D,
|
||||||
|
entityPlayer,
|
||||||
|
entityProjectionData2.left(),
|
||||||
|
entityProjectionData2.top(),
|
||||||
|
entityProjectionData2.width(),
|
||||||
|
entityProjectionData2.height(),
|
||||||
|
entityProjectionData2.topCenterX(),
|
||||||
|
entityProjectionData2.bottomCenterX(),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eSP1.render2D.clearScissors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import openonyx.render.group_e.FontStyle;
|
||||||
|
|
||||||
|
record ESPData(FontStyle style, String text, int color) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
public record ESPData2(int type, float centerX, float centerY, float width, float height, boolean horizontal) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import openonyx.history.DisplayNamed;
|
||||||
|
|
||||||
|
public enum EffectMode implements DisplayNamed {
|
||||||
|
SMOKE("Smoke"),
|
||||||
|
GLINT("Glint");
|
||||||
|
|
||||||
|
private final String i;
|
||||||
|
|
||||||
|
EffectMode(String string1) {
|
||||||
|
this.i = string1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return this.i;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static EffectMode[] L() {
|
||||||
|
EffectMode[] effectModes = new EffectMode[2];
|
||||||
|
boolean bl = true;
|
||||||
|
effectModes[0] = GLINT;
|
||||||
|
effectModes[1] = SMOKE;
|
||||||
|
return effectModes;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import openonyx.history.DisplayNamed;
|
||||||
|
|
||||||
|
public enum FeatureSupport_327Mode implements DisplayNamed {
|
||||||
|
GROW("Grow from centre"),
|
||||||
|
FILL("Fill");
|
||||||
|
|
||||||
|
private final String H;
|
||||||
|
|
||||||
|
private static FeatureSupport_327Mode[] L() {
|
||||||
|
FeatureSupport_327Mode[] featureSupport_327Modes = new FeatureSupport_327Mode[2];
|
||||||
|
boolean bl = true;
|
||||||
|
featureSupport_327Modes[0] = FILL;
|
||||||
|
featureSupport_327Modes[1] = GROW;
|
||||||
|
return featureSupport_327Modes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return this.H;
|
||||||
|
}
|
||||||
|
|
||||||
|
FeatureSupport_327Mode(String string1) {
|
||||||
|
this.H = string1;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user