Skip to content

Commit b9e4384

Browse files
committed
manually handle attack packet and cooldown to avoid triggering vanilla attack override listener in rotation manager
1 parent 87b5535 commit b9e4384

File tree

1 file changed

+9
-3
lines changed
  • src/main/kotlin/com/lambda/module/modules/combat

1 file changed

+9
-3
lines changed

src/main/kotlin/com/lambda/module/modules/combat/KillAura.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ import com.lambda.util.math.random
3838
import com.lambda.util.player.SlotUtils.hotbar
3939
import net.minecraft.entity.LivingEntity
4040
import net.minecraft.item.ItemStack
41+
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket
4142
import net.minecraft.util.Hand
43+
import net.minecraft.world.GameMode
4244

4345
object KillAura : Module(
4446
name = "KillAura",
@@ -107,10 +109,10 @@ object KillAura : Module(
107109
// Wait until the rotation has a hit result on the entity
108110
if (rotate) runSafeAutomated {
109111
val rotationRequest = RotationRequest(lookAtEntity(entity)?.rotation ?: return@listen, this@KillAura).submit()
110-
val canContinue = !rotationRequest.done || entity !== prevEntity || !validServerRot
112+
val cantContinue = !rotationRequest.done || entity !== prevEntity || !validServerRot
111113
prevEntity = entity
112114
validServerRot = rotationRequest.done
113-
if (canContinue) return@listen
115+
if (cantContinue) return@listen
114116
}
115117

116118
if (swap) {
@@ -131,7 +133,11 @@ object KillAura : Module(
131133
}
132134

133135
// Attack
134-
interaction.attackEntity(player, target)
136+
connection.sendPacket(PlayerInteractEntityC2SPacket.attack(target, player.isSneaking))
137+
if (interaction.gameMode != GameMode.SPECTATOR) {
138+
player.attack(target)
139+
player.resetTicksSince()
140+
}
135141
if (interactConfig.swing) player.swingHand(Hand.MAIN_HAND)
136142

137143
lastAttackTime = System.currentTimeMillis()

0 commit comments

Comments
 (0)