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

Minecarts snap to sloped rails at the wrong height

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 24w36a
    • Community Consensus
    • Minecart
    • Important
    • Platform

      Since 24w34a, in the "Minecart Improvements" Experiment: Minecarts snap to positions on sloped rails as if the rails are sloped the opposite direction.

      See attachments "test_setup", "align_carts", and "snap_carts" for visual showcase of the bug. When the cart falls above the higher part of the rail, it snaps lower in the block, and when the cart falls above the lower part of the rail, it snaps higher in the block.

       

      The cause of this bug is a effectively a flipped sign in the math; a certain vector is added when it should be subtracted. The attached image called "excerpt" (taken from net.minecraft.world.entity.vehicle.NewMinecartBehavior#adjustToRails) shows the error highlighted. In that image: bl5 is true when the rail below the cart is sloped. Changing the highlighted method to subtract(vec34) — or equivalently add(vec34.reverse()) — fixes the snapping height issue.

      See the "fixed_snapping" image to see what the behavior looks like when the fix is applied (done in 24w34a using a fabric mixin).

        1. align_carts.png
          align_carts.png
          651 kB
        2. excerpt.png
          excerpt.png
          18 kB
        3. fixed_snapping.png
          fixed_snapping.png
          528 kB
        4. snap_carts.png
          snap_carts.png
          659 kB
        5. test_setup.png
          test_setup.png
          647 kB

            Unassigned Unassigned
            enbyd enbyd
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: