diff --git a/src/main/java/net/wurstclient/hacks/AttributeSwapHack.java b/src/main/java/net/wurstclient/hacks/AttributeSwapHack.java index 96a7d8be7b..ce1cbb98e3 100644 --- a/src/main/java/net/wurstclient/hacks/AttributeSwapHack.java +++ b/src/main/java/net/wurstclient/hacks/AttributeSwapHack.java @@ -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; @@ -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 = new EnumSetting<>("Mode", "Simple: swaps to a fixed hotbar slot on attack.\n" @@ -92,6 +96,7 @@ protected void onEnable() awaitingBack = false; originalSlot = -1; + EVENTS.add(LeftClickListener.class, this); EVENTS.add(PlayerAttacksEntityListener.class, this); EVENTS.add(UpdateListener.class, this); } @@ -99,6 +104,7 @@ protected void onEnable() @Override protected void onDisable() { + EVENTS.remove(LeftClickListener.class, this); EVENTS.remove(PlayerAttacksEntityListener.class, this); EVENTS.remove(UpdateListener.class, this); @@ -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) { @@ -119,6 +141,7 @@ public void onPlayerAttacksEntity(Entity target) return; performSwap(target); + WURST.getHax().maceDmgHack.doSmash(); } @Override diff --git a/src/main/java/net/wurstclient/hacks/KillauraHack.java b/src/main/java/net/wurstclient/hacks/KillauraHack.java index c8f98d4876..01277aabeb 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraHack.java @@ -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; @@ -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; diff --git a/src/main/java/net/wurstclient/hacks/MaceDmgHack.java b/src/main/java/net/wurstclient/hacks/MaceDmgHack.java index 9234cd73dc..941f5559f2 100644 --- a/src/main/java/net/wurstclient/hacks/MaceDmgHack.java +++ b/src/main/java/net/wurstclient/hacks/MaceDmgHack.java @@ -10,11 +10,12 @@ 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.minecraft.world.phys.AABB; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.PlayerAttacksEntityListener; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; @@ -23,16 +24,26 @@ public final class MaceDmgHack extends Hack implements PlayerAttacksEntityListener { private static final double DEFAULT_HEIGHT = Math.sqrt(500); - + private static final double MIN_FALL = 1.6; + private static final double SCAN_STEP = 0.25; + private final SliderSetting height = new SliderSetting("Height", "How high to fake before slamming. Height determines the damage boost.", DEFAULT_HEIGHT, 1.6, 50, 0.1, ValueDisplay.DECIMAL); - + + private final CheckboxSetting caveMode = new CheckboxSetting("Cave mode", + "Scans for an air gap above you to fall through, so smashes work under" + + " a ceiling. Fully sealed spaces still can't be smashed.", + true); + + private long lastSmashTick = -1; + public MaceDmgHack() { super("MaceDMG"); setCategory(Category.COMBAT); addSetting(height); + addSetting(caveMode); } @Override @@ -50,22 +61,45 @@ 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. for(int i = 0; i < 4; i++) sendFakeY(0); - sendFakeY(height.getValue()); + sendFakeY(findFallOffset()); sendFakeY(0); } - + + private double findFallOffset() + { + double cap = height.getValue(); + if(!caveMode.isChecked() || MC.level == null) + return cap; + + for(double off = cap; off >= MIN_FALL; off -= SCAN_STEP) + { + AABB box = MC.player.getBoundingBox().move(0, off, 0); + if(MC.level.noCollision(MC.player, box)) + return off; + } + + return cap; + } + private void sendFakeY(double offset) { MC.player.connection