Skip to content

Commit

Permalink
Improve ArrowDmgHack to deal more damage
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jun 28, 2024
1 parent e466599 commit f4a2e5b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/main/java/net/wurstclient/hacks/ArrowDmgHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket.Mode;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.PositionAndOnGround;
import net.minecraft.util.math.Vec3d;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
Expand Down Expand Up @@ -66,15 +66,25 @@ public void onStopUsingItem()
netHandler.sendPacket(
new ClientCommandC2SPacket(player, Mode.START_SPRINTING));

Vec3d lookVec = player.getRotationVec(1).multiply(strength.getValue());
double x = player.getX();
double y = player.getY();
double z = player.getZ();

netHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(
x - lookVec.x, y - 1e-10, z - lookVec.z, true));
netHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x,
y + 1e-10, z, false));
// See ServerPlayNetworkHandler.onPlayerMove()
// for why it's using these numbers.
// Also, let me know if you find a way to bypass that check in 1.21.
double adjustedStrength = strength.getValue() / 10.0 * Math.sqrt(500);
Vec3d lookVec = player.getRotationVec(1).multiply(adjustedStrength);
for(int i = 0; i < 4; i++)
sendPos(x, y, z, true);
sendPos(x - lookVec.x, y, z - lookVec.z, true);
sendPos(x, y, z, false);
}

private void sendPos(double x, double y, double z, boolean onGround)
{
ClientPlayNetworkHandler netHandler = MC.player.networkHandler;
netHandler.sendPacket(new PositionAndOnGround(x, y, z, onGround));
}

private boolean isValidItem(Item item)
Expand Down

0 comments on commit f4a2e5b

Please sign in to comment.