Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-224949

Blocks placed next to bounding box when slowly moving are getting canceled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.5, 21w18a, 21w19a, 21w20a, 1.17 Pre-release 1, 1.17 Pre-release 2, 1.17 Pre-release 3, 1.17 Pre-release 4, 1.17 Pre-release 5, 1.17 Release Candidate 1, 1.17 Release Candidate 2, 1.17, 1.17.1 Pre-release 1, 1.17.1 Pre-release 2, 1.17.1 Pre-release 3, 1.17.1 Release Candidate 1, 1.17.1 Release Candidate 2, 1.17.1, 21w37a, 21w38a, 21w40a, 21w43a, 1.18 Pre-release 1, 1.18 Pre-release 4, 1.18 Pre-release 5, 1.18 Release Candidate 3, 1.18, 1.18.1 Pre-release 1, 1.18.1, 22w03a, 22w06a
    • None
    • Confirmed
    • Block states, Networking
    • Normal
    • Platform

      When you place a block close to your bounding box when you're slowly moving backward the block gets canceled by the server.

      Steps to reproduce
      1. Make sure you move very slow, less than 0.03 blocks per tick. I will use cobweb and sneak for this.
      2. Move backward.
      3. Try to place the block as close as possible to your bounding box.
      using cobweb.mp4

      Observed results
      The server thinks you're placing the block inside yourself and therefore cancels it.

      Expected results
      Block should be placed.

      Code analysis
      At net.minecraft.client.player.localplayer.sendPosition() you can see that the client won't send its position to the server unless the player moved at least 0.03 blocks or when 20 ticks have passed.

      This means that the bounding box from the server can be off by max 0.03 blocks.

      final double double4 = this.getX() - this.xLast;
      final double double5 = this.getY() - this.yLast1;
      final double double6 = this.getZ() - this.zLast;
      
      ++this.positionReminder;
      
      boolean boolean4 = double4 * double4 + double5 * double5 + double6 * double6 > 9.0E-4 || this.positionReminder >= 20;

      There is no good reason for this, you want the server to have the same location as the client.

      Suggested fix
      Send the position at every move.

      final double double4 = this.getX() - this.xLast;
      final double double5 = this.getY() - this.yLast1;
      final double double6 = this.getZ() - this.zLast;
      
      ++this.positionReminder;
      
      boolean boolean4 = double4 * double4 + double5 * double5 + double6 * double6 > 0 || this.positionReminder >= 20;
        

      Notes
      This may have been implemented with the thought of not sending the position for very small moves (floating-point precision or very small moves <0.0001), however this already exists, if the clients motion is less than 0.003 it will be set to 0.

      This isn't a duplicate of MC-95720, MC-95720 is about the inventory desync caused by an invalid block placement. This report is about why the invalid block placement happens in the first place.

      Off topic
      This 0.03 is also the reason why making an unbypassable anticheat movement-wise is very hard.

            Unassigned Unassigned
            Laurenss Laurens
            Votes:
            23 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              CHK: