Upload files to "src/openonyx/events"
This commit is contained in:
1 parent
1337b576d4
commit
cb12563f5b
5 files changed
+306
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
record BenchmarkScenario(String label, List<String> off, Float yaw, Float pitch) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public final class ChatFormattingUtils {
|
||||||
|
private static final Pattern PATTERN = Pattern.compile("(?i)§[0-9A-FK-OR]");
|
||||||
|
|
||||||
|
public static String L(String string) {
|
||||||
|
if (string != null && string.indexOf(167) >= 0) {
|
||||||
|
return PATTERN.matcher(string).replaceAll("").replace("§", "");
|
||||||
|
} else {
|
||||||
|
return string == null ? "" : string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChatFormattingUtils() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.util.ChatComponentStyle;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import openonyx.features.player.NameChanger;
|
||||||
|
|
||||||
|
public final class ChatTransformer {
|
||||||
|
public static String decrypt(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
int k = --5 << 4;
|
||||||
|
String string2;
|
||||||
|
int n = (string2 = string1).length();
|
||||||
|
char[] e = new char[n];
|
||||||
|
boolean bl = true;
|
||||||
|
int i;
|
||||||
|
int m = i = n - 1;
|
||||||
|
char[] c = e;
|
||||||
|
byte d = 96;
|
||||||
|
k = m;
|
||||||
|
byte b = 103;
|
||||||
|
|
||||||
|
while (k >= 0) {
|
||||||
|
int l = i;
|
||||||
|
int j = string2.charAt(i);
|
||||||
|
i--;
|
||||||
|
c[l] = (char)(j ^ b);
|
||||||
|
if (i < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
j = i--;
|
||||||
|
c[j] = (char)(string2.charAt(j) ^ d);
|
||||||
|
k = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String L(String string, String string1, String string2) {
|
||||||
|
return !string.isEmpty() && string.contains(string1)
|
||||||
|
? Pattern.compile(new StringBuilder().insert(0, "\\b").append(Pattern.quote(string1)).append("\\b").toString())
|
||||||
|
.matcher(string)
|
||||||
|
.replaceAll(Matcher.quoteReplacement(string2))
|
||||||
|
: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IChatComponent L(IChatComponent iChatComponent, String string, String string1) {
|
||||||
|
IChatComponent iChatComponent1 = iChatComponent;
|
||||||
|
ChatComponentStyle chatComponentStyle;
|
||||||
|
ChatComponentStyle chatComponentStyle1;
|
||||||
|
if (iChatComponent1 instanceof ChatComponentText chatComponentText) {
|
||||||
|
chatComponentStyle1 = chatComponentStyle = new ChatComponentText(L(chatComponentText.getChatComponentText_TextValue(), string, string1));
|
||||||
|
} else {
|
||||||
|
if (!(iChatComponent1 instanceof ChatComponentTranslation)) {
|
||||||
|
return iChatComponent1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatComponentTranslation chatComponentTranslation;
|
||||||
|
Object[] objects;
|
||||||
|
Object[] objects2 = new Object[(objects = (chatComponentTranslation = (ChatComponentTranslation)iChatComponent1).getFormatArgs()).length];
|
||||||
|
boolean bl = true;
|
||||||
|
Object[] objects1 = objects2;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (int j = i = 0; j < objects.length; j = ++i) {
|
||||||
|
Object object;
|
||||||
|
if ((object = objects[i]) instanceof IChatComponent) {
|
||||||
|
IChatComponent iChatComponent2 = (IChatComponent)object;
|
||||||
|
objects1[i] = L(iChatComponent2, string, string1);
|
||||||
|
} else if (object instanceof String string2) {
|
||||||
|
objects1[i] = L(string2, string, string1);
|
||||||
|
} else {
|
||||||
|
objects1[i] = object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chatComponentStyle1 = chatComponentStyle = new ChatComponentTranslation(chatComponentTranslation.getKey(), objects1);
|
||||||
|
}
|
||||||
|
|
||||||
|
chatComponentStyle1.setChatStyle(iChatComponent1.getChatStyle());
|
||||||
|
Iterator iterator = iChatComponent1.getSiblings().iterator();
|
||||||
|
Iterator iterator1 = iterator;
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
IChatComponent iChatComponent3 = (IChatComponent)iterator.next();
|
||||||
|
iterator1 = iterator;
|
||||||
|
chatComponentStyle.appendSibling(L(iChatComponent3, string, string1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return chatComponentStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IChatComponent L(IChatComponent iChatComponent) {
|
||||||
|
IChatComponent iChatComponent1 = iChatComponent;
|
||||||
|
if (!NameChanger.I()) {
|
||||||
|
return iChatComponent1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String string = Minecraft.getMinecraft().thePlayer.getGameProfile().getName();
|
||||||
|
String string1 = NameChanger.i();
|
||||||
|
return !string.isEmpty() && !string1.isEmpty() ? L(iChatComponent1, string, string1) : iChatComponent1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChatTransformer() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemArmor;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
|
public class EntityRelationUtils {
|
||||||
|
private static Integer L(ItemStack itemStack) {
|
||||||
|
ItemStack itemStack1 = itemStack;
|
||||||
|
Item item;
|
||||||
|
if (itemStack1 == null || !((item = itemStack1.getItem()) instanceof ItemArmor)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemArmor itemArmor;
|
||||||
|
return !(itemArmor = (ItemArmor)item).hasColor(itemStack1) ? null : itemArmor.getColor(itemStack1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decrypt(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
int o = 5 >> 1 << 3 ^ 2;
|
||||||
|
int p = 4 << 4 ^ 13;
|
||||||
|
int q = 3 << 3 ^ 6;
|
||||||
|
String string2;
|
||||||
|
int r = (string2 = string1).length();
|
||||||
|
char[] d = new char[r];
|
||||||
|
boolean bl = true;
|
||||||
|
int k;
|
||||||
|
int m = k = r - 1;
|
||||||
|
char[] c = d;
|
||||||
|
int j = q;
|
||||||
|
int l = m;
|
||||||
|
int i = o;
|
||||||
|
|
||||||
|
while (l >= 0) {
|
||||||
|
p = k;
|
||||||
|
int n = string2.charAt(k);
|
||||||
|
k--;
|
||||||
|
c[p] = (char)(n ^ i);
|
||||||
|
if (k < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = k--;
|
||||||
|
c[n] = (char)(string2.charAt(n) ^ j);
|
||||||
|
l = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean D(EntityPlayer entityPlayer, EntityPlayer entityPlayer1) {
|
||||||
|
EntityPlayer entityPlayer2 = entityPlayer;
|
||||||
|
|
||||||
|
for (int j = i = 1; j <= 4; j = ++i) {
|
||||||
|
Integer integer = L(entityPlayer2.getEquipmentInSlot(i));
|
||||||
|
Integer integer1 = L(entityPlayer1.getEquipmentInSlot(i));
|
||||||
|
if (integer != null && integer.equals(integer1)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean d(EntityPlayer entityPlayer, EntityPlayer entityPlayer1) {
|
||||||
|
EntityPlayer entityPlayer2 = entityPlayer;
|
||||||
|
EnumChatFormatting enumChatFormatting = entityPlayer2.getDisplayName().getChatStyle().getColor();
|
||||||
|
EnumChatFormatting enumChatFormatting1 = entityPlayer1.getDisplayName().getChatStyle().getColor();
|
||||||
|
return enumChatFormatting != null && enumChatFormatting == enumChatFormatting1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean L(EntityPlayer entityPlayer) {
|
||||||
|
EntityPlayer entityPlayer1 = entityPlayer;
|
||||||
|
|
||||||
|
for (int j = i = 1; j <= 4; j = ++i) {
|
||||||
|
if (L(entityPlayer1.getEquipmentInSlot(i)) != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean L(EntityPlayer entityPlayer, EntityPlayer entityPlayer1) {
|
||||||
|
if (entityPlayer == null || entityPlayer1 == null || entityPlayer == entityPlayer1) {
|
||||||
|
return false;
|
||||||
|
} else if (!L(entityPlayer)) {
|
||||||
|
return false;
|
||||||
|
} else if (entityPlayer.isOnSameTeam(entityPlayer1)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return d(entityPlayer, entityPlayer1) ? true : D(entityPlayer, entityPlayer1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import java.awt.FileDialog;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import openonyx.core.OnyxClient;
|
||||||
|
|
||||||
|
public final class FileDialogUtils {
|
||||||
|
private FileDialogUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decrypt(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
int p = (--2 ^ 5) << 4 ^ 10;
|
||||||
|
int q = (2 ^ 5) << 4 ^ 4;
|
||||||
|
String string2;
|
||||||
|
int r = (string2 = string1).length();
|
||||||
|
char[] e = new char[r];
|
||||||
|
boolean bl = true;
|
||||||
|
int k;
|
||||||
|
int n = k = r - 1;
|
||||||
|
char[] c = e;
|
||||||
|
int j = q;
|
||||||
|
int o = 5;
|
||||||
|
int l = n;
|
||||||
|
int i = p;
|
||||||
|
|
||||||
|
while (l >= 0) {
|
||||||
|
int m = k;
|
||||||
|
char d = string2.charAt(k);
|
||||||
|
k--;
|
||||||
|
c[m] = (char)(d ^ i);
|
||||||
|
if (k < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
o = k--;
|
||||||
|
c[o] = (char)(string2.charAt(o) ^ j);
|
||||||
|
l = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void d(String string, String string1, Consumer<String> consumer) {
|
||||||
|
Thread thread = new Thread(() -> {
|
||||||
|
String string4 = string;
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileDialog fileDialog = new FileDialog((Frame)null, string4, 0);
|
||||||
|
fileDialog.setFile("*.png");
|
||||||
|
File file;
|
||||||
|
if (!string1.isEmpty() && (file = new File(string1)).getParentFile() != null) {
|
||||||
|
fileDialog.setDirectory(file.getParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
fileDialog.setVisible(true);
|
||||||
|
String string5 = fileDialog.getDirectory();
|
||||||
|
string1 = fileDialog.getFile();
|
||||||
|
if (string5 != null && string1 != null) {
|
||||||
|
consumer.accept(new File(string5, string1).getAbsolutePath());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
OnyxClient.LOGGER.warn("File dialog failed - type the path in by hand instead", throwable);
|
||||||
|
}
|
||||||
|
}, "onyx-file-dialog");
|
||||||
|
thread.setDaemon(true);
|
||||||
|
thread.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user