Posted July 27, 20187 yr 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 Edited July 28, 20187 yr by Robertusxd solved
July 28, 20187 yr Author i found the solution, this.attacker.inventory.setPickedItemStack(this.getBestAttackItem()); is not working correctly and only showing you client side that u are holding that item. on the server i was hitting the monsters with bare hands.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.