Jump to content

Recommended Posts

Posted

This code, in an item's onItemRightClick:

log.info("onItemRightClick: getPosition {}, getPositionEyes {}, getPositionVector {}, player entity {}", playerIn.getPosition(), playerIn.getPositionEyes(1), playerIn.getPositionVector(), playerIn);

Result:

[19:38:54] [Client thread/INFO] [PosTest]: onItemRightClick: getPosition BlockPos{x=582, y=4, z=137}, getPositionEyes (581.5160287599339, 5.620000004768372, 136.53055861822787), getPositionVector (581.5160287599339, 4.0, 136.53055861822787), player entity EntityPlayerSP['Player921'/132, l='MpServer', x=581.52, y=4.00, z=136.53]
[19:38:54] [server thread/INFO] [PosTest]: onItemRightClick: getPosition BlockPos{x=581, y=4, z=136}, getPositionEyes (581.5160287599339, 5.620000004768372, 136.53055861822787), getPositionVector (581.5160287599339, 4.0, 136.53055861822787), player entity EntityPlayerMP['Player921'/132, l='New World', x=581.52, y=4.00, z=136.53]

As you can see with the output of getPositionVector the client and server agree exactly on where the player is. Yet the output of getPosition is off.

 

The implementation in EntityPlayerSP:

    public BlockPos getPosition()
    {
        return new BlockPos(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D);
    }

And in EntityPlayerMP:

    public BlockPos getPosition()
    {
        return new BlockPos(this.posX, this.posY + 0.5D, this.posZ);
    }

I guess this is a bug in Minecraft itself? Or is there a point to it?

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.