55
66package com .dark .zewo2 .Utils ;
77
8- import meteordevelopment .meteorclient .utils .player .ChatUtils ;
9- import net .minecraft .client .MinecraftClient ;
10- import net .minecraft .client .network .ClientPlayerEntity ;
11- import net .minecraft .client .world .ClientWorld ;
12- import net .minecraft .entity .Entity ;
13- import net .minecraft .item .Item ;
14- import net .minecraft .item .ItemStack ;
15- import net .minecraft .nbt .StringNbtReader ;
16- import net .minecraft .network .ClientConnection ;
17- import net .minecraft .network .packet .c2s .play .PlayerMoveC2SPacket ;
18- import net .minecraft .network .packet .c2s .play .VehicleMoveC2SPacket ;
19- import net .minecraft .text .Text ;
20- import net .minecraft .util .math .Box ;
21- import net .minecraft .util .math .MathHelper ;
22- import net .minecraft .util .math .Vec2f ;
23- import net .minecraft .util .math .Vec3d ;
24-
25- import java .security .MessageDigest ;
26- import java .util .Arrays ;
27- import java .util .List ;
28- import java .util .Random ;
29-
30- import static meteordevelopment .meteorclient .MeteorClient .LOG ;
31- import static meteordevelopment .meteorclient .MeteorClient .mc ;
32-
338public class JinxUtils {
349
3510 public static void sleep (long ms ) {
@@ -38,122 +13,6 @@ public static void sleep(long ms) {
3813 } catch (Exception ignored ) {
3914 }
4015 }
41- public static void sendSignedMessage (String message ) {
42- if (message .startsWith ("/" )) mc .player .sendMessage (Text .of (message .substring (1 )), false );
43- else mc .player .networkHandler .sendChatMessage (message );
44- }
45-
46- public static String generateMessage (int amount ) {
47- StringBuilder message = new StringBuilder ();
48- for (int i = 0 ; i < amount ; i ++) message .append ((char ) (0x4e00 + (int ) (Math .random () * (0x9fa5 - 0x4e00 + 1 ))));
49- return message .toString ();
50- }
51-
52- public static String randomString (int amount ) {
53- StringBuilder message = new StringBuilder ();
54- String [] chars = new String []{"a" , "b" , "c" , "d" , "e" , "f" , "g" , "h" , "i" , "j" , "k" , "l" , "m" , "n" , "o" , "p" , "q" , "r" , "s" , "t" , "u" , "v" , "w" , "x" , "y" , "z" };
55- for (int i = 0 ; i < amount ; i ++) message .append (chars [new Random ().nextInt (chars .length )]);
56- return message .toString ();
57- }
58-
59- public static Vec3d randomPosBetween (int min , int max ) {
60- int x = new Random ().nextInt (min , max );
61- int y = 255 ;
62- int z = new Random ().nextInt (min , max );
63- return new Vec3d (x , y , z );
64- }
65-
66- public static Vec3d pickRandomPos () {
67- int x = new Random ().nextInt (16777215 );
68- int y = 255 ;
69- int z = new Random ().nextInt (16777215 );
70- return new Vec3d (x , y , z );
71- }
72-
73- public static Vec2f getPitchYawFromOtherEntity (Vec3d eyePos , Vec3d targetV3 ) {
74- double vec = 57.2957763671875 ;
75- Vec3d target = targetV3 .subtract (eyePos );
76- double square = Math .sqrt (target .x * target .x + target .z * target .z );
77- float pitch = MathHelper .wrapDegrees ((float ) (-(MathHelper .atan2 (target .y , square ) * vec )));
78- float yaw = MathHelper .wrapDegrees ((float ) (MathHelper .atan2 (target .z , target .x ) * vec ) - 90.0F );
79- return new Vec2f (pitch , yaw );
80- }
81-
82- public static Vec3d relativeToAbsolute (Vec3d absRootPos , Vec2f rotation , Vec3d relative ) {
83- double xOffset = relative .x ;
84- double yOffset = relative .y ;
85- double zOffset = relative .z ;
86- float rot = 0.017453292F ;
87- float f = MathHelper .cos ((rotation .y + 90.0F ) * rot );
88- float g = MathHelper .sin ((rotation .y + 90.0F ) * rot );
89- float h = MathHelper .cos (-rotation .x * rot );
90- float i = MathHelper .sin (-rotation .x * rot );
91- float j = MathHelper .cos ((-rotation .x + 90.0F ) * rot );
92- float k = MathHelper .sin ((-rotation .x + 90.0F ) * rot );
93- Vec3d vec3d2 = new Vec3d (f * h , i , g * h );
94- Vec3d vec3d3 = new Vec3d (f * j , k , g * j );
95- Vec3d vec3d4 = vec3d2 .crossProduct (vec3d3 ).multiply (-1.0D );
96- double d = vec3d2 .x * zOffset + vec3d3 .x * yOffset + vec3d4 .x * xOffset ;
97- double e = vec3d2 .y * zOffset + vec3d3 .y * yOffset + vec3d4 .y * xOffset ;
98- double l = vec3d2 .z * zOffset + vec3d3 .z * yOffset + vec3d4 .z * xOffset ;
99- return new Vec3d (absRootPos .x + d , absRootPos .y + e , absRootPos .z + l );
100- }
101-
102- public static double distance (Vec3d vec1 , Vec3d vec2 ) {
103- double dX = vec2 .x - vec1 .x ;
104- double dY = vec2 .y - vec1 .y ;
105- double dZ = vec2 .z - vec1 .z ;
106- return Math .sqrt (dX * dX + dY * dY + dZ * dZ );
107- }
108-
109- public static double [] directionSpeed (double speed ) {
110- float forward = mc .player .forwardSpeed ;
111- float side = mc .player .sidewaysSpeed ;
112- float yaw = mc .player .prevYaw + (mc .player .getYaw () - mc .player .prevYaw );
113- if (forward != 0.0f ) {
114- if (side > 0.0f ) yaw += ((forward > 0.0f ) ? -45 : 45 );
115- else if (side < 0.0f ) yaw += ((forward > 0.0f ) ? 45 : -45 );
116- side = 0.0f ;
117- if (forward > 0.0f ) forward = 1.0f ;
118- else if (forward < 0.0f ) forward = -1.0f ;
119- }
120- double sin = Math .sin (Math .toRadians (yaw + 90.0F ));
121- double cos = Math .cos (Math .toRadians (yaw + 90.0F ));
122- double dx = forward * speed * cos + side * speed * sin ;
123- double dz = forward * speed * sin - side * speed * cos ;
124- return new double []{dx , dz };
125- }
126-
127- public static double roundCoordinates (double coord ) {
128- coord = Math .round (coord * 100.0 ) / 100.0 ;
129- coord = Math .nextAfter (coord , coord + Math .signum (coord ));
130- if ((int ) (coord * 1000.0 ) % 10.0 != 0.0 ) coord = Math .ceil (coord );
131- return coord ;
132- }
133-
134- public static String getHWID () {
135- try {
136- String toEncrypt = System .getenv ("COMPUTERNAME" ) + System .getProperty ("user.name" ) + System .getenv ("PROCESSOR_IDENTIFIER" ) + System .getenv ("PROCESSOR_LEVEL" );
137- MessageDigest md = MessageDigest .getInstance ("MD5" );
138- md .update (toEncrypt .getBytes ());
139- StringBuffer hexString = new StringBuffer ();
140-
141- byte byteData [] = md .digest ();
142-
143- for (byte aByteData : byteData ) {
144- String hex = Integer .toHexString (0xff & aByteData );
145- if (hex .length () == 1 ) hexString .append ('0' );
146- hexString .append (hex );
147- }
148-
149- LOG .info (hexString .toString ());
150- return hexString .toString ();
151- } catch (Exception e ) {
152- e .printStackTrace ();
153- LOG .info ("ERROR HWID" );
154- return "Error" ;
155- }
156- }
15716
15817 public static int rainbowColors (int colors ) {
15918 int color = 0 ;
0 commit comments