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

Nether portals place players two blocks beside the portal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.8.4
    • Minecraft 1.8.1-pre3, Minecraft 1.8.1-pre4, Minecraft 1.8.1-pre5, Minecraft 1.8.1, Minecraft 1.8.2-pre1, Minecraft 1.8.2-pre2, Minecraft 1.8.2-pre3, Minecraft 1.8.2-pre4, Minecraft 1.8.2-pre5, Minecraft 1.8.2-pre6, Minecraft 1.8.2-pre7, Minecraft 1.8.2, Minecraft 1.8.3
    • None
    • Confirmed

      If you walk into a nether portal, you don't spawn at the right position in the nether and the other way around. You always spawn some blocks beside the portal and get suffocated if there is a wall.

      To recreate the bug, i created a fresh world, built a nether portal and go through it. Then i got stuck in the netherrack some blocks under and beside the portal. But the portal was created just fine. When i wanted to go back to the overworld, i spawned 2 blocks in front of the portal in the overworld.


      Adapted from anomie x's comment:
      On 1.8.3, the cause of this issue is located in the class named "adv", which handles portal travel:
      In the code for placing the player there's a bit like this, which seems to be for adjusting the X/Z position from the corner portal-block of the destination portal to more closely match where the entity entered the source portal. var31 is X, var33 is Z.

      adv.java
               if(var16.b().k() == cr.a.a) {
                  var31 += (double)var16.b().g(); // !!!
                  var33 = var18 + (1.0D - var1.aG().a) * (double)var16.d() * (double)var16.b().e().c().a();
               } else {
                  var31 = var18 + (1.0D - var1.aG().a) * (double)var16.d() * (double)var16.b().e().c().a();
                  var33 += (double)var16.b().i(); // !!!
               }
      

      The lines I've commented with "!!!" are the problem, they move the entity 1 block in the "facing" direction of the portal without bothering to check for ground underneath, blocks in the way, or anything else. Modding the class to remove those two lines restores the expected behavior of spawning within the destination portal itself.

        1. 006 Portal Spawn Over Lava Ocean BOOM Your DEAD.jpg
          444 kB
          Alpha Wolf
        2. 2014-10-23_21.39.19.png
          350 kB
          Kumasasa
        3. 2014-10-31_10.55.57.png
          572 kB
          gzurti
        4. 2014-10-31_10.56.12.png
          683 kB
          gzurti
        5. 2014-10-31_10.56.29.png
          641 kB
          gzurti
        6. 2014-10-31_10.56.32.png
          767 kB
          gzurti
        7. 2015-02-02_22.27.08.png
          1.44 MB
          gzurti
        8. Hot Welcome to the Nether.jpg
          364 kB
          Alpha Wolf

            dinnerbone [Mojang] Nathan Adams
            blaba Jens Pott
            Votes:
            72 Vote for this issue
            Watchers:
            26 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: