Updated NoAfk

This commit is contained in:
noil 2020-12-09 13:21:11 -05:00
parent 1c24d1cc1a
commit 54cb5445e7

View File

@ -5,6 +5,7 @@ import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.network.EventSendPacket;
import me.rigamortis.seppuku.api.event.player.EventUpdateWalkingPlayer;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.client.CPacketPlayer;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
@ -15,6 +16,9 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
*/
public final class NoAfkModule extends Module {
public final Value<Integer> yawOffset = new Value<Integer>("Yaw", new String[]{"yaw", "y"}, "The yaw to alternate each tick.", 1, 0, 180, 1);
public final Value<Integer> pitchOffset = new Value<Integer>("Pitch", new String[]{"pitch", "x"}, "The pitch to alternate each tick.", 0, 0, 90, 1);
public NoAfkModule() {
super("NoAFK", new String[]{"AntiAFK"}, "Prevents you from being kicked while idle", "NONE", -1, ModuleType.MISC);
}
@ -24,8 +28,14 @@ public final class NoAfkModule extends Module {
if (event.getStage() == EventStageable.EventStage.PRE) {
final Minecraft mc = Minecraft.getMinecraft();
float yaw = mc.player.rotationYaw;
yaw += (1 * Math.sin(mc.player.ticksExisted / Math.PI));
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(yaw, mc.player.rotationPitch);
float pitch = mc.player.rotationPitch;
if (this.yawOffset.getValue() > 0) {
yaw += (this.yawOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));
}
if (this.pitchOffset.getValue() > 0) {
pitch += (this.pitchOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));
}
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(yaw, pitch);
}
}
@ -35,7 +45,12 @@ public final class NoAfkModule extends Module {
if (event.getPacket() instanceof CPacketPlayer.Rotation) {
if (Minecraft.getMinecraft().player.getRidingEntity() != null) {
final CPacketPlayer.Rotation packet = (CPacketPlayer.Rotation) event.getPacket();
packet.yaw += (1 * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI));
if (this.yawOffset.getValue() > 0) {
packet.yaw += (this.yawOffset.getValue() * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI));
}
if (this.pitchOffset.getValue() > 0) {
packet.pitch += (this.pitchOffset.getValue() * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI));
}
}
}
}