mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 13:05:52 +08:00
[Feat] Derp
This commit is contained in:
1 parent
9f5ac18d79
commit
d5ffd01b63
3 files changed
+62
-1
No files matched your search
@@ -5,5 +5,6 @@ public enum ModuleCategory {
|
||||
COMBAT,
|
||||
MISC,
|
||||
MOVEMENT,
|
||||
PLAYER
|
||||
PLAYER,
|
||||
FUN
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package cn.xiaozhou233.orangex.module;
|
||||
|
||||
import cn.xiaozhou233.orangex.OrangeX;
|
||||
import cn.xiaozhou233.orangex.event.impl.EventKey;
|
||||
import cn.xiaozhou233.orangex.module.impl.fun.Derp;
|
||||
import cn.xiaozhou233.orangex.module.impl.misc.Test;
|
||||
import cn.xiaozhou233.orangex.module.impl.render.*;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -29,6 +30,7 @@ public class ModuleManager {
|
||||
|
||||
register(new Test());
|
||||
|
||||
register(new Derp());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.xiaozhou233.orangex.module.impl.fun;
|
||||
|
||||
import cn.xiaozhou233.orangex.event.impl.EventLoop;
|
||||
import cn.xiaozhou233.orangex.event.impl.EventPacketSend;
|
||||
import cn.xiaozhou233.orangex.module.Module;
|
||||
import cn.xiaozhou233.orangex.module.ModuleCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.play.client.C03PacketPlayer;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class Derp extends Module {
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
private float yaw = 0f;
|
||||
|
||||
public Derp() {
|
||||
super("Derp", ModuleCategory.FUN);
|
||||
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onLoop(EventLoop event) {
|
||||
yaw += 20f;
|
||||
if (yaw > 180f) yaw -= 360f;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPacketSend(EventPacketSend event) {
|
||||
// C03PacketPlayer Only
|
||||
if (!(event.getPacket() instanceof C03PacketPlayer))
|
||||
return;
|
||||
if (mc.thePlayer == null)
|
||||
return;
|
||||
|
||||
C03PacketPlayer packet = (C03PacketPlayer) event.getPacket();
|
||||
setYawPitch(packet, yaw, mc.thePlayer.rotationPitch);
|
||||
|
||||
mc.thePlayer.renderYawOffset = yaw;
|
||||
mc.thePlayer.rotationYawHead = yaw;
|
||||
}
|
||||
|
||||
private void setYawPitch(C03PacketPlayer packet, float yaw, float pitch) {
|
||||
try {
|
||||
Field yawField = C03PacketPlayer.class.getDeclaredField("yaw");
|
||||
Field pitchField = C03PacketPlayer.class.getDeclaredField("pitch");
|
||||
|
||||
yawField.setAccessible(true);
|
||||
pitchField.setAccessible(true);
|
||||
|
||||
yawField.setFloat(packet, yaw);
|
||||
pitchField.setFloat(packet, pitch);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user