some information: i have applied an AITask to the EntityPlayerSP that attacks every EntityMob that gets within attack range.
it works fine but for some reason the automated attacks take 10+ hits to kill a mob with a diamond sword.
private void performAttack(EntityLivingBase target) {
this.lastAttackTick = Minecraft.getMinecraft().world.getTotalWorldTime();
this.attacker.inventory.setPickedItemStack(this.getBestAttackItem());
this.attacker.swingArm(EnumHand.MAIN_HAND);
Minecraft.getMinecraft().playerController.attackEntity(this.attacker, target);
}
this is the code that performs the attack. the field lastAttackTick is used to make sure that i only attack when its supposed to deal full damage. before i used
if(this.attacker.getCooledAttackStrength(0F) == 1)
but i had the same problem with that.
getBestAttackItem() returns the ItemStack with the most ATTACK_DAMAGE in the players inventory.
i hope i offered enough information and someone know what the problem is
thanks in advance