Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/main/java/net/wurstclient/hacks/AttributeSwapHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.LeftClickListener;
import net.wurstclient.events.LeftClickListener.LeftClickEvent;
import net.wurstclient.events.PlayerAttacksEntityListener;
import net.wurstclient.events.UpdateListener;
import net.wurstclient.hack.Hack;
Expand All @@ -33,7 +37,7 @@
"auto swap", "auto shield break", "auto mace", "disable shield",
"item swap", "hotbar swap", "item saver", "durability saver"})
public final class AttributeSwapHack extends Hack
implements PlayerAttacksEntityListener, UpdateListener
implements LeftClickListener, PlayerAttacksEntityListener, UpdateListener
{
private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
"Simple: swaps to a fixed hotbar slot on attack.\n"
Expand Down Expand Up @@ -92,13 +96,15 @@ protected void onEnable()
awaitingBack = false;
originalSlot = -1;

EVENTS.add(LeftClickListener.class, this);
EVENTS.add(PlayerAttacksEntityListener.class, this);
EVENTS.add(UpdateListener.class, this);
}

@Override
protected void onDisable()
{
EVENTS.remove(LeftClickListener.class, this);
EVENTS.remove(PlayerAttacksEntityListener.class, this);
EVENTS.remove(UpdateListener.class, this);

Expand All @@ -111,6 +117,22 @@ protected void onDisable()
originalSlot = -1;
}

@Override
public void onLeftClick(LeftClickEvent event)
{
if(onlyWithKillAura.isChecked()
&& !WURST.getHax().killauraHack.isEnabled())
return;

if(MC.hitResult != null
&& MC.hitResult.getType() == HitResult.Type.BLOCK)
return;

Entity target = MC.hitResult instanceof EntityHitResult hit
? hit.getEntity() : null;
performSwap(target);
}

@Override
public void onPlayerAttacksEntity(Entity target)
{
Expand All @@ -119,6 +141,7 @@ public void onPlayerAttacksEntity(Entity target)
return;

performSwap(target);
WURST.getHax().maceDmgHack.doSmash();
}

@Override
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/net/wurstclient/hacks/KillauraHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import java.util.Comparator;
import java.util.function.ToDoubleFunction;
import java.util.stream.Stream;
import net.minecraft.core.component.DataComponents;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.PiercingWeapon;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.wurstclient.Category;
Expand Down Expand Up @@ -184,7 +187,14 @@ public void onHandleInput()
if(target == null)
return;

MC.gameMode.attack(MC.player, target);
ItemStack heldItem = MC.player.getMainHandItem();
PiercingWeapon piercingWeapon =
heldItem.get(DataComponents.PIERCING_WEAPON);
if(piercingWeapon != null
&& !WURST.getHax().attributeSwapHack.isEnabled())
MC.gameMode.piercingAttack(piercingWeapon);
else
MC.gameMode.attack(MC.player, target);
swingHand.swing(InteractionHand.MAIN_HAND);

target = null;
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/net/wurstclient/hacks/MaceDmgHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket.Pos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.Items;
import net.minecraft.world.phys.HitResult;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.events.PlayerAttacksEntityListener;
Expand All @@ -28,6 +27,8 @@ public final class MaceDmgHack extends Hack
"How high to fake before slamming. Height determines the damage boost.",
DEFAULT_HEIGHT, 1.6, 50, 0.1, ValueDisplay.DECIMAL);

private long lastSmashTick = -1;

public MaceDmgHack()
{
super("MaceDMG");
Expand All @@ -50,13 +51,20 @@ protected void onDisable()
@Override
public void onPlayerAttacksEntity(Entity target)
{
if(MC.hitResult == null
|| MC.hitResult.getType() != HitResult.Type.ENTITY)
doSmash();
}

public void doSmash()
{
if(!isEnabled() || MC.player == null || MC.player.connection == null)
return;

if(!MC.player.getMainHandItem().is(Items.MACE))
return;


long now = MC.player.tickCount;
if(now == lastSmashTick)
return;
lastSmashTick = now;
// See ServerGamePacketListenerImpl.handleMovePlayer()
// for why it's using these numbers.
// Also, let me know if you find a way to bypass that check.
Expand Down