Upload files to "src/openonyx/events"
This commit is contained in:
1 parent
cb12563f5b
commit
21b3fbc342
5 files changed
+409
No files matched your search
@@ -0,0 +1,83 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
|
||||||
|
public class GeometryUtils implements MinecraftAccess {
|
||||||
|
private static final double e = 0.05;
|
||||||
|
|
||||||
|
public static double L(Entity entity) {
|
||||||
|
return mc.thePlayer == null ? Double.MAX_VALUE : L(entity.getEntityBoundingBox(), L());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 L(float f, float g) {
|
||||||
|
float j = MathHelper.cos(-f * (float) (Math.PI / 180.0) - (float) Math.PI);
|
||||||
|
float i = MathHelper.sin(-f * (float) (Math.PI / 180.0) - (float) Math.PI);
|
||||||
|
float h = -MathHelper.cos(-g * (float) (Math.PI / 180.0));
|
||||||
|
g = MathHelper.sin(-g * (float) (Math.PI / 180.0));
|
||||||
|
return new Vec3(i * h, g, j * h);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 L() {
|
||||||
|
return new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double L(double d, double e, double f) {
|
||||||
|
return ex + d * (f - ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 L(Vec3 vec3, AxisAlignedBB axisAlignedBB) {
|
||||||
|
return new Vec3(
|
||||||
|
MathHelper.clamp_double(vec3.xCoord, axisAlignedBB.minX, axisAlignedBB.maxX),
|
||||||
|
MathHelper.clamp_double(vec3.yCoord, axisAlignedBB.minY, axisAlignedBB.maxY),
|
||||||
|
MathHelper.clamp_double(vec3.zCoord, axisAlignedBB.minZ, axisAlignedBB.maxZ)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 L(Entity entity, double d, double e, double f, double g) {
|
||||||
|
Entity entity1 = entity;
|
||||||
|
Vec3 vec3 = L();
|
||||||
|
AxisAlignedBB axisAlignedBB;
|
||||||
|
double h = Math.min(
|
||||||
|
(axisAlignedBB = entity1.getEntityBoundingBox()).maxX - axisAlignedBB.minX,
|
||||||
|
Math.min(axisAlignedBB.maxY - axisAlignedBB.minY, axisAlignedBB.maxZ - axisAlignedBB.minZ)
|
||||||
|
);
|
||||||
|
AxisAlignedBB axisAlignedBB1;
|
||||||
|
double i;
|
||||||
|
Vec3 vec31 = (axisAlignedBB1 = axisAlignedBB.expand(-(i = Math.min(0.05, h * 0.25)), -i, -i)).isVecInside(vec3)
|
||||||
|
? L(axisAlignedBB1)
|
||||||
|
: L(vec3, axisAlignedBB1);
|
||||||
|
if (g <= 0.0) {
|
||||||
|
return vec31;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 = new Vec3(
|
||||||
|
L(d, axisAlignedBB1.minX, axisAlignedBB1.maxX), L(ex, axisAlignedBB1.minY, axisAlignedBB1.maxY), L(f, axisAlignedBB1.minZ, axisAlignedBB1.maxZ)
|
||||||
|
);
|
||||||
|
return L(vec31, vec3, g);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Vec3 L(Vec3 vec3, Vec3 vec31, double d) {
|
||||||
|
return new Vec3(L(d, vec3.xCoord, vec31.xCoord), L(d, vec3.yCoord, vec31.yCoord), L(d, vec3.zCoord, vec31.zCoord));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 L(Entity entity) {
|
||||||
|
return L(entity, 0.0, 0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3 L(AxisAlignedBB axisAlignedBB) {
|
||||||
|
return new Vec3(
|
||||||
|
(axisAlignedBB.minX + axisAlignedBB.maxX) * 0.5, (axisAlignedBB.minY + axisAlignedBB.maxY) * 0.5, (axisAlignedBB.minZ + axisAlignedBB.maxZ) * 0.5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double L(AxisAlignedBB axisAlignedBB, Vec3 vec3) {
|
||||||
|
double d = Math.max(Math.max(axisAlignedBB.minX - vec3.xCoord, 0.0), vec3.xCoord - axisAlignedBB.maxX);
|
||||||
|
double ex = Math.max(Math.max(axisAlignedBB.minY - vec3.yCoord, 0.0), vec3.yCoord - axisAlignedBB.maxY);
|
||||||
|
double f = Math.max(Math.max(axisAlignedBB.minZ - vec3.zCoord, 0.0), vec3.zCoord - axisAlignedBB.maxZ);
|
||||||
|
return d * d + ex * ex + f * f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import net.minecraft.client.multiplayer.ServerData;
|
||||||
|
import net.minecraft.scoreboard.ScoreObjective;
|
||||||
|
import net.minecraft.scoreboard.Scoreboard;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
|
||||||
|
public final class HypixelUtils {
|
||||||
|
private static final String H = "BED WARS";
|
||||||
|
private static final int e = 1;
|
||||||
|
|
||||||
|
public static boolean d() {
|
||||||
|
ServerData serverData;
|
||||||
|
return (serverData = MinecraftAccess.mc.getCurrentServerData()) != null
|
||||||
|
&& serverData.serverIP != null
|
||||||
|
&& serverData.serverIP.toLowerCase(Locale.ROOT).contains("hypixel.net");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String d(String string) {
|
||||||
|
return string == null ? "" : EnumChatFormatting.getTextWithoutFormattingCodes(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ScoreObjective L() {
|
||||||
|
if (MinecraftAccess.mc.theWorld == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scoreboard scoreboard;
|
||||||
|
return (scoreboard = MinecraftAccess.mc.theWorld.getScoreboard()) == null ? null : scoreboard.getObjectiveInDisplaySlot(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decrypt(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
int p = --2;
|
||||||
|
int q = 4 << 4 ^ 3;
|
||||||
|
String string2;
|
||||||
|
int r = (string2 = string1).length();
|
||||||
|
char[] ex = new char[r];
|
||||||
|
boolean bl = true;
|
||||||
|
int k;
|
||||||
|
int n = k = r - 1;
|
||||||
|
char[] c = ex;
|
||||||
|
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 boolean L() {
|
||||||
|
return d() && L().toUpperCase(Locale.ROOT).contains("BED WARS");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String L() {
|
||||||
|
ScoreObjective scoreObjective;
|
||||||
|
return (scoreObjective = L()) == null ? "" : d(scoreObjective.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
private HypixelUtils() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemArmor;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemSword;
|
||||||
|
import net.minecraft.item.ItemTool;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
|
||||||
|
public final class InventoryUtils {
|
||||||
|
public static final int h = 9;
|
||||||
|
public static final int l = 45;
|
||||||
|
public static final int I = 1;
|
||||||
|
public static final int d = 2;
|
||||||
|
public static final int i = 36;
|
||||||
|
public static final int f = 4;
|
||||||
|
public static final int H = 5;
|
||||||
|
public static final int e = 9;
|
||||||
|
|
||||||
|
private static void L(int i, int j, int k) {
|
||||||
|
int lx = ix;
|
||||||
|
Container container;
|
||||||
|
if ((container = L()) != null) {
|
||||||
|
MinecraftAccess.mc.playerController.windowClick(container.windowId, lx, j, k, MinecraftAccess.mc.thePlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double i(ItemStack itemStack) {
|
||||||
|
ItemStack itemStack1 = itemStack;
|
||||||
|
if (itemStack1 != null && itemStack1.getItem() != null) {
|
||||||
|
Item item;
|
||||||
|
double dx = (item = itemStack1.getItem()) instanceof ItemSword ? ((ItemSword)item).getDamageVsEntity() : 1.0;
|
||||||
|
double ex;
|
||||||
|
return (ex = dx + L(itemStack1, Enchantment.sharpness) * 1.25)
|
||||||
|
+ L(itemStack1, Enchantment.fireAspect) * 0.3
|
||||||
|
+ L(itemStack1, Enchantment.knockback) * 0.15
|
||||||
|
+ L(itemStack1, Enchantment.unbreaking) * 0.1;
|
||||||
|
} else {
|
||||||
|
return Double.NEGATIVE_INFINITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack L(int i) {
|
||||||
|
int j = ix;
|
||||||
|
Container container;
|
||||||
|
return (container = L()) != null && j >= 0 && j < container.inventorySlots.size() ? container.getSlot(j).getStack() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Container L() {
|
||||||
|
return MinecraftAccess.mc.thePlayer.inventoryContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int L(ItemStack itemStack, Enchantment enchantment) {
|
||||||
|
return EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void d(int i) {
|
||||||
|
L(ix, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double D(ItemStack itemStack) {
|
||||||
|
ItemStack itemStack1 = itemStack;
|
||||||
|
Item item;
|
||||||
|
if (itemStack1 != null && (item = itemStack1.getItem()) instanceof ItemArmor) {
|
||||||
|
ItemArmor itemArmor = (ItemArmor)item;
|
||||||
|
return L(itemStack1, itemArmor);
|
||||||
|
} else {
|
||||||
|
return Double.NEGATIVE_INFINITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int L(ItemStack itemStack) {
|
||||||
|
ItemStack itemStack1 = itemStack;
|
||||||
|
ItemArmor itemArmor;
|
||||||
|
Item item;
|
||||||
|
return itemStack1 != null && (item = itemStack1.getItem()) instanceof ItemArmor ? (itemArmor = (ItemArmor)item).armorType : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private InventoryUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void L(int i) {
|
||||||
|
L(ix, 1, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double L(ItemStack itemStack, ItemArmor itemArmor) {
|
||||||
|
double dx = itemArmor.damageReduceAmount;
|
||||||
|
return itemArmor.damageReduceAmount
|
||||||
|
+ L(itemStack, Enchantment.protection) * 1.25
|
||||||
|
+ L(itemStack, Enchantment.blastProtection) * 0.15
|
||||||
|
+ L(itemStack, Enchantment.fireProtection) * 0.15
|
||||||
|
+ L(itemStack, Enchantment.projectileProtection) * 0.15
|
||||||
|
+ L(itemStack, Enchantment.thorns) * 0.1
|
||||||
|
+ L(itemStack, Enchantment.unbreaking) * 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void L(int i, int j) {
|
||||||
|
L(ix, j, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double d(ItemStack itemStack) {
|
||||||
|
ItemStack itemStack1 = itemStack;
|
||||||
|
if (itemStack1 != null && itemStack1.getItem() != null) {
|
||||||
|
Item item;
|
||||||
|
if ((item = itemStack1.getItem()) instanceof ItemArmor) {
|
||||||
|
ItemArmor itemArmor = (ItemArmor)item;
|
||||||
|
return L(itemStack1, itemArmor);
|
||||||
|
} else if (item instanceof ItemSword) {
|
||||||
|
return i(itemStack1);
|
||||||
|
} else if (item instanceof ItemTool) {
|
||||||
|
return L(itemStack1);
|
||||||
|
} else {
|
||||||
|
return item instanceof ItemBlock ? itemStack1.stackSize : itemStack1.stackSize;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Double.NEGATIVE_INFINITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int L(int i) {
|
||||||
|
return 5 + ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double L(ItemStack itemStack) {
|
||||||
|
ItemStack itemStack1 = itemStack;
|
||||||
|
if (itemStack1 != null && itemStack1.getItem() != null) {
|
||||||
|
Item item;
|
||||||
|
double dx = (item = itemStack1.getItem()) instanceof ItemTool ? ((ItemTool)item).getToolMaterial().getEfficiencyOnProperMaterial() : 1.0;
|
||||||
|
double ex;
|
||||||
|
return (ex = dx + L(itemStack1, Enchantment.fortune) * 1.25)
|
||||||
|
+ L(itemStack1, Enchantment.efficiency) * 0.5
|
||||||
|
+ L(itemStack1, Enchantment.unbreaking) * 0.3;
|
||||||
|
} else {
|
||||||
|
return Double.NEGATIVE_INFINITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
|
||||||
|
public class MovementRotation implements MinecraftAccess {
|
||||||
|
private static boolean L = false;
|
||||||
|
private static EntityPlayerSP entityPlayerSP = null;
|
||||||
|
private static float m = 0.0F;
|
||||||
|
private static final float h = 50.0F;
|
||||||
|
private static float l = 0.0F;
|
||||||
|
private static float I = 0.0F;
|
||||||
|
private static float d = 0.0F;
|
||||||
|
private static float i = 0.0F;
|
||||||
|
private static float f = 0.0F;
|
||||||
|
private static float H = 0.0F;
|
||||||
|
private static float e = 0.0F;
|
||||||
|
|
||||||
|
private static float L() {
|
||||||
|
double dx = mc.thePlayer.posX - mc.thePlayer.prevPosX;
|
||||||
|
double ex = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;
|
||||||
|
float fx = m;
|
||||||
|
if ((float)(dx * dx + ex * ex) > 0.0025000002F) {
|
||||||
|
float g = (float)(MathHelper.atan2(ex, dx) * 180.0 / Math.PI) - 90.0F;
|
||||||
|
float hx = Math.abs(MathHelper.wrapAngleTo180_float(I) - g);
|
||||||
|
fx = 95.0F <= hx && hx < 265.0F ? g - 180.0F : g;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mc.thePlayer.swingProgress > 0.0F) {
|
||||||
|
fx = I;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ix = m + MathHelper.wrapAngleTo180_float(fx - m) * 0.3F;
|
||||||
|
float j;
|
||||||
|
if (Math.abs(j = MathHelper.wrapAngleTo180_float(I - ix)) > 50.0F) {
|
||||||
|
ix += j - Math.signum(j) * 50.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void L() {
|
||||||
|
if (mc.thePlayer != null) {
|
||||||
|
i = I;
|
||||||
|
l = e;
|
||||||
|
d = m;
|
||||||
|
I = H;
|
||||||
|
e = f;
|
||||||
|
m = L();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean L(Entity entity) {
|
||||||
|
return L && entity == mc.thePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float D(float f) {
|
||||||
|
return RotationMath.L(d, m, fx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float d(float f) {
|
||||||
|
return RotationMath.L(i, I, fx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float L(float f) {
|
||||||
|
return l + (e - l) * fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void L(float f, float g) {
|
||||||
|
H = fx;
|
||||||
|
f = g;
|
||||||
|
L = RotationManager.D();
|
||||||
|
if (entityPlayerSP != mc.thePlayer) {
|
||||||
|
entityPlayerSP = mc.thePlayer;
|
||||||
|
i = fx;
|
||||||
|
I = fx;
|
||||||
|
l = g;
|
||||||
|
e = g;
|
||||||
|
d = fx;
|
||||||
|
m = fx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package openonyx.events;
|
||||||
|
|
||||||
|
import openonyx.commands.Command;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
import openonyx.features.hud.Notifications;
|
||||||
|
import openonyx.features.hud.group_d.NotificationLevel;
|
||||||
|
|
||||||
|
public final class NotificationDispatcher implements MinecraftAccess {
|
||||||
|
public static void d(String string, String string1, NotificationLevel notificationLevel) {
|
||||||
|
mc.addScheduledTask(() -> {
|
||||||
|
Notifications.L(string, string1, notificationLevel);
|
||||||
|
if (notificationLevel != NotificationLevel.ERROR && notificationLevel != NotificationLevel.WARNING) {
|
||||||
|
Command.L(new StringBuilder().insert(0, string).append(": ").append(string1).toString());
|
||||||
|
} else {
|
||||||
|
Command.d(new StringBuilder().insert(0, string).append(": ").append(string1).toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private NotificationDispatcher() {
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user