Jump to content

[1.12.2][solved]automated attacks dealing less damage


Robertusxd

Recommended Posts

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 by Robertusxd
solved
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.