public void attackTargetEntityWithCurrentItem(Entity entity) { int i = inventory.getDamageVsEntity(entity); if (isPotionActive(Potion.damageBoost)) { i += 3 << getActivePotionEffect(Potion.damageBoost).getAmplifier(); } if (isPotionActive(Potion.weakness)) { i -= 2 << getActivePotionEffect(Potion.weakness).getAmplifier(); } int j = 0; int k = 0; if (entity instanceof EntityLiving) { k = EnchantmentHelper.getEnchantmentModifierLiving(inventory, (EntityLiving) entity); j += EnchantmentHelper.getKnockbackModifier(inventory, (EntityLiving) entity); } if (isSprinting()) { j++; } if (i > 0 || k > 0) { boolean flag = fallDistance > 0.0F && !onGround && !isOnLadder() && !isInWater() && !isPotionActive(Potion.blindness) && ridingEntity == null && (entity instanceof EntityLiving); if (flag) { i += rand.nextInt(i / 2 + 2); } i += k; boolean flag1 = entity.attackEntityFrom(DamageSource.causePlayerDamage(this), i); if (flag1) { if (j > 0) { entity.addVelocity( -MathHelper.sin((rotationYaw * 3.141593F) / 180F) * (float) j * 0.5F, 0.10000000000000001D, MathHelper.cos((rotationYaw * 3.141593F) / 180F) * (float) j * 0.5F); motionX *= 0.59999999999999998D; motionZ *= 0.59999999999999998D; setSprinting(false); } if (flag) { onCriticalHit(entity); } if (k > 0) { func_40183_c(entity); } if (i >= 18) { triggerAchievement(AchievementList.overkill); } } ItemStack itemstack = getCurrentEquippedItem(); if (itemstack != null && (entity instanceof EntityLiving)) { itemstack.hitEntity((EntityLiving) entity, this); if (itemstack.stackSize <= 0) { itemstack.onItemDestroyedByUse(this); destroyCurrentEquippedItem(); } } if (entity instanceof EntityLiving) { if (entity.isEntityAlive()) { alertWolves((EntityLiving) entity, true); } addStat(StatList.damageDealtStat, i); int l = EnchantmentHelper.getFireAspectModifier(inventory, (EntityLiving) entity); if (l > 0) { entity.setFire(l * 4); } } addExhaustion(0.3F); } }