2

I looked up a bunch of websites online, and answers vary from 3-5 (https://hypixel.net/threads/minecraft-maximum-attack-range.180414/). Some say client side is 3 blocks and server side is 6, so it can vary between 3-6 (https://www.spigotmc.org/threads/anyone-know-the-maximum-hit-distance.245846/).

From my experience, on all servers I played on (12+), my anecdotal data is averaging 2-3 blocks, with 3 probably being the maximum. But I haven't done an experiment with a player standing still, asking them their F3 coordinates, and comparing them with my F3 coordinates while making sure I'm able to hit them, and then subtracting the difference to find the distance I can hit them at. I would think that would be the most accurate way to measure it and probably include ping at current time just in case that becomes a variable.

4
  • It amazes me that this question doesn't have a definitive answer yet. This has been a question for so long.
    – Corsaka
    Sep 25 '20 at 8:15
  • @Corsaka This has been tweaked quite a bit over time, different weapons have different reach, and the numbers aren't a round number of blocks. I could give the numbers for combat snapshots as they've been revealed when the snapshots were released, but when the last tweak to vanilla ranges was made? ¯\_(ツ)_/¯
    – SF.
    Sep 25 '20 at 8:29
  • @SF. Wait, since when have different weapons had different reach? I think the main problem is that we just don't know what the reach is; it's always been speculation. I need to go find another minecraft account and test this out.
    – Corsaka
    Sep 25 '20 at 8:30
  • @Corsaka: I might be mistaken on that point too - they definitely do in the combat snapshots (the hoe has the longest!).
    – SF.
    Sep 25 '20 at 8:32
1

Normal

Its three blocks.

Optifine & Fast Math

If you have Optifine installed with Fast Math enabled, your range will slightly vary (but only like 0.0003 more or less).

From Head

Bare in mind the distance is counted from the head, which means that if someone is below you they might be able to hit you (there is head is near your feet) but you may not be able to hit them (your head is up higher).

1

Clients can only hit an entity if it is "moused over", which is calculated using a ray from the client's eye location. The short answer is that this ray travels for 3 blocks.

The client calculates if the entity is "moused over" with the following method:

//EntityRenderer.java
/**
 * Gets the block or object that is being moused over.
 */
public void getMouseOver(float partialTicks)
{
    Entity entity = this.mc.getRenderViewEntity();

    if (entity != null)
    {
        if (this.mc.world != null)
        {
            this.mc.mcProfiler.startSection("pick");
            this.mc.pointedEntity = null;
            double d0 = (double)this.mc.playerController.getBlockReachDistance();
            this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks);
            Vec3d vec3d = entity.getPositionEyes(partialTicks);
            boolean flag = false;
            int i = 3;
            double d1 = d0;

            if (this.mc.playerController.extendedReach())
            {
                d1 = 6.0D;
                d0 = d1;
            }
            else
            {
                if (d0 > 3.0D)
                {
                    flag = true;
                }
            }

            if (this.mc.objectMouseOver != null)
            {
                d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3d);
            }

            Vec3d vec3d1 = entity.getLook(1.0F);
            Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0);
            this.pointedEntity = null;
            Vec3d vec3d3 = null;
            float f = 1.0F;
            List<Entity> list = this.mc.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0).expand(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>()
            {
                public boolean apply(@Nullable Entity p_apply_1_)
                {
                    return p_apply_1_ != null && p_apply_1_.canBeCollidedWith();
                }
            }));
            double d2 = d1;

            for (int j = 0; j < list.size(); ++j)
            {
                Entity entity1 = list.get(j);
                AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz((double)entity1.getCollisionBorderSize());
                RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2);

                if (axisalignedbb.isVecInside(vec3d))
                {
                    if (d2 >= 0.0D)
                    {
                        this.pointedEntity = entity1;
                        vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec;
                        d2 = 0.0D;
                    }
                }
                else if (raytraceresult != null)
                {
                    double d3 = vec3d.distanceTo(raytraceresult.hitVec);

                    if (d3 < d2 || d2 == 0.0D)
                    {
                        if (entity1.getLowestRidingEntity() == entity.getLowestRidingEntity())
                        {
                            if (d2 == 0.0D)
                            {
                                this.pointedEntity = entity1;
                                vec3d3 = raytraceresult.hitVec;
                            }
                        }
                        else
                        {
                            this.pointedEntity = entity1;
                            vec3d3 = raytraceresult.hitVec;
                            d2 = d3;
                        }
                    }
                }
            }

            if (this.pointedEntity != null && flag && vec3d.distanceTo(vec3d3) > 3.0D)
            {
                this.pointedEntity = null;
                this.mc.objectMouseOver = new RayTraceResult(RayTraceResult.Type.MISS, vec3d3, (EnumFacing)null, new BlockPos(vec3d3));
            }

            if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null))
            {
                this.mc.objectMouseOver = new RayTraceResult(this.pointedEntity, vec3d3);

                if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame)
                {
                    this.mc.pointedEntity = this.pointedEntity;
                }
            }

            this.mc.mcProfiler.endSection();
        }
    }
}


 //Taken from Entity.java
 public RayTraceResult rayTrace(double blockReachDistance, float partialTicks)
{
    Vec3d vec3d = this.getPositionEyes(partialTicks);
    Vec3d vec3d1 = this.getLook(partialTicks);
    Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * blockReachDistance, vec3d1.yCoord * blockReachDistance, vec3d1.zCoord * blockReachDistance);
    return this.world.rayTraceBlocks(vec3d, vec3d2, false, false, true);
}
0

You can hit someone in PvP from 3 blocks away.

3
  • 1
    This answer would be improved with a source or evidence. Did this answer come from testing in-game, from the game files, or from an article somewhere?
    – Kadima
    Nov 2 '20 at 19:32
  • Me and my friends when we do PvP we alaways hit from about 3 blocks away and it makes sense. But i also searched it up before answering just to make sure Nov 2 '20 at 19:35
  • @amazingruler1 Please provide the source that told you this information. Nov 3 '20 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.