Skip to content

Commit

Permalink
AntiForceLook
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisTestUser committed Sep 8, 2023
1 parent d608163 commit d40106b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/hack/HackList.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public final class HackList implements UpdateListener
public final AntiCactusHack antiCactusHack = new AntiCactusHack();
public final AntiEntityPushHack antiEntityPushHack =
new AntiEntityPushHack();
public final AntiForceLookHack antiForceLookHack = new AntiForceLookHack();
public final AntiHungerHack antiHungerHack = new AntiHungerHack();
public final AntiKnockbackHack antiKnockbackHack = new AntiKnockbackHack();
public final AntiSpamHack antiSpamHack = new AntiSpamHack();
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/net/wurstclient/hacks/AntiForceLookHack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2014-2023 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.hacks;

import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.PacketOutputListener;
import net.wurstclient.hack.Hack;
import net.wurstclient.mixin.PlayerPositionLookS2CPacketAccessor;

@SearchTags({"anti force look", "no rotate"})
public final class AntiForceLookHack extends Hack implements PacketOutputListener
{
public AntiForceLookHack()
{
super("AntiForceLook");
setCategory(Category.MOVEMENT);
}

@Override
public void onEnable()
{
EVENTS.add(PacketOutputListener.class, this);
}

@Override
public void onDisable()
{
EVENTS.remove(PacketOutputListener.class, this);
}

@Override
public void onSentPacket(PacketOutputEvent event)
{
if(event.getPacket() instanceof PlayerPositionLookS2CPacket)
{
PlayerPositionLookS2CPacketAccessor packet = (PlayerPositionLookS2CPacketAccessor)event.getPacket();
packet.setYaw(MC.player.getYaw());
packet.setPitch(MC.player.getPitch());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2014-2023 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;

import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;

@Mixin(PlayerPositionLookS2CPacket.class)
public interface PlayerPositionLookS2CPacketAccessor
{
@Mutable
@Accessor("yaw")
void setYaw(float yaw);

@Mutable
@Accessor("pitch")
void setPitch(float pitch);
}
1 change: 1 addition & 0 deletions src/main/resources/assets/wurst/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"description.wurst.hack.antiblind": "Prevents blindness and darkness effects.\nIncompatible with OptiFine.",
"description.wurst.hack.anticactus": "Protects you from cactus damage.",
"description.wurst.hack.antientitypush": "Prevents you from getting pushed by players and mobs.",
"description.wurst.hack.antiforcelook": "Prevents the server from changing your yaw and pitch. This usually means you are triggering the anticheat.",
"description.wurst.hack.antihunger": "Slows down your hunger when you are walking.",
"description.wurst.hack.antiknockback": "Prevents you from taking knockback from players and mobs.",
"description.wurst.hack.antispam": "Blocks chat spam by adding a counter to repeated messages.",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/wurst.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"PackScreenMixin",
"PlayerEntityMixin",
"PlayerInventoryMixin",
"PlayerPositionLookS2CPacketAccessor",
"PlayerSkinProviderMixin",
"PowderSnowBlockMixin",
"RenderTickCounterMixin",
Expand Down

0 comments on commit d40106b

Please sign in to comment.