Alright, so, currently I'm making a hacked client myself and found myself searching for a code snippet of a 1.9/1.10 KillAura, and not finding one.
Ended up just making it myself, so, for everyone like me who are looking for how to do it:
Here's my code!
Before we start:
Most of the code stays pretty much the same as 1.8 KillAuras were.
Only change is that there's a wait time before attacking.
The code:
In the KillAura module class, make a new float 'cooldown':
Code:
float cooldown = 0;
Now, on each update, you're going to check whether or not this 'cooldown' has reached 0 yet, and if not, decrement it by 1. If it did, set it back to the cooldown the current tool has, and attack the surrounding mobs once.
Code:
public void onUpdate() {
//Check whether or not the current module is enabled. If your update method is only called when this is true, ignore this line.
if (!isEnabled()) return;
//Handle whether or not the player should attack
if (float cooldown > 0){
//There is still a cooldown active. Decrement cooldown by 1, and wait for the next update.
cooldown--;
return;
}else //The cooldown has expired. Put it back to original, and attack.
cooldown = mc.thePlayer.getCooldownPeriod(); //mc refers to the Minecraft object. getCooldownPeriod() returns the cooldown period of the item held by the player.
//Loops through all loaded player entities, checks whether they're alive or not, and attacks them
for (Entity entity : mc.theWorld.playerEntities){
if (entity.isEntityAlive(){
//Attacks the player using a packet
mc.thePlayer.connection.sendPacket(new CPacketUseEntity(entity));
mc.thePlayer.swingArm(EnumHand.MAIN_HAND);
}
}
}
There you go! That's it. To make it attack mobs instead of players, just let it loop through loadedEntityList instead, and check if it's an instance of LivingEntity.
Feel free to use this code, change it etc..
(btw adding those colours in was a damn pain ;-;)
Cheers!