Bukkit
  1. Bukkit
  2. BUKKIT-4591

Recent commit fixing VehicleExitEvent has broken dismounting arrows.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Resolution: Inactive
    • Affects Version/s: CraftBukkit 1.6.2-R0.1, CraftBukkit 1.6.2-R1.0
    • Fix Version/s: None
    • Component/s: Entities, Events
    • Security Level: Public (Viewable by everyone)
    • Labels:
    • Environment:
      Windows/Linux, Java 7.
    • CB Version String:
      #2813 (Or higher)
    • Confirmation Status:
      Unconfirmed

      Description

      Basically, since the recent commit about fixing VehicleExitEvent, dismounting an arrow has caused you to be kicked with the message 'Nope!'.

      This is causing issues with a lot of chair plugins, that now need to use this method for chairs seeing as the sitting animation was broken in 1.6.2. An issue on CraftBook's issue tracker has been following this issue and may shed some extra light. http://youtrack.sk89q.com/issue/CRAFTBOOK-2645#comment=67-4432

      To test this, CraftBook dev builds contain chairs that WORK on bukkit builds prior to that commit, but don't work on any bukkit builds after that commit was made. A link to the CraftBook dev builds is: http://build.sk89q.com/job/CraftBook/

      Edit: The commit that is being referred to: https://github.com/Bukkit/CraftBukkit/commit/2482f53aa8368cd8a127d09ddf57c3ad32941839

      Thanks,

      Me4502

        Activity

        Hide
        me4502 added a comment -

        Confirmed in the beta that was just released.

        Show
        me4502 added a comment - Confirmed in the beta that was just released.
        Hide
        Chris Naude added a comment - - edited

        I did a little bit of debugging using protocollib. When I intercept the player look and move packets I can see the Y is NaN when ejecting from an arrow.

        23:53:48 [INFO] Intercepted message: 25.975217963522667 65.0 86.71514673024468
        23:53:49 [INFO] Intercepted message: 25.913934239658733 65.0 86.70074896537686
        23:53:49 [INFO] Intercepted message: 25.88047332254245 65.0 86.69288778484594
        23:53:49 [INFO] Intercepted message: 25.84678194250988 65.0 86.69288778484594
        23:53:49 [INFO] Intercepted message: 25.84678194250988 65.0 86.69288778484594
        23:53:50 [INFO] Intercepted message: 23.0 NaN 86.0

        The code I used to display the NaN.

        ProtocolLibrary.getProtocolManager().addPacketListener(

        new PacketAdapter(PacketAdapter.params(this,
        Packets.Client.PLAYER_LOOK_MOVE).clientSide()) {
        @Override

        public void onPacketReceiving(PacketEvent event)

        { PacketContainer packet = event.getPacket(); double X = packet.getDoubles().read(0); double Y = packet.getDoubles().read(1); double Z = packet.getDoubles().read(2); System.out.println("Intercepted message: " + X + " " + Y + " " + Z); }

        });

        Show
        Chris Naude added a comment - - edited I did a little bit of debugging using protocollib. When I intercept the player look and move packets I can see the Y is NaN when ejecting from an arrow. 23:53:48 [INFO] Intercepted message: 25.975217963522667 65.0 86.71514673024468 23:53:49 [INFO] Intercepted message: 25.913934239658733 65.0 86.70074896537686 23:53:49 [INFO] Intercepted message: 25.88047332254245 65.0 86.69288778484594 23:53:49 [INFO] Intercepted message: 25.84678194250988 65.0 86.69288778484594 23:53:49 [INFO] Intercepted message: 25.84678194250988 65.0 86.69288778484594 23:53:50 [INFO] Intercepted message: 23.0 NaN 86.0 The code I used to display the NaN. ProtocolLibrary.getProtocolManager().addPacketListener( new PacketAdapter(PacketAdapter.params(this, Packets.Client.PLAYER_LOOK_MOVE).clientSide()) { @Override public void onPacketReceiving(PacketEvent event) { PacketContainer packet = event.getPacket(); double X = packet.getDoubles().read(0); double Y = packet.getDoubles().read(1); double Z = packet.getDoubles().read(2); System.out.println("Intercepted message: " + X + " " + Y + " " + Z); } });
        Hide
        evilmidget38 (Nate Mortensen) added a comment - - edited

        I found the issue causing this. I'm too lazy to rewrite what I typed in IRC, so I'll just copy paste my messages:

        <evilmidget38> https://github.com/Bukkit/CraftBukkit/blob/2482f53aa8368cd8a127d09ddf57c3ad32941839/src/main/java/net/minecraft/server/Entity.java#L1414
        <evilmidget38> We cause EntityHumans to dismount through that method, rather than their normal method, which means they normally don't do that teleportation there.
        <evilmidget38> That teleport is dependent upon "this.vehicle.boundingBox.b", which for arrows seems to be NaN
        <evilmidget38> So when people dismount an arrow, they're teleported to a y value of NaN, and then kicked from the server when they tell the server their new location is NaN

        I'm currently working on a fix for this.

        EDIT: So, I found the root of the issue. Spawning an arrow with zero velocity causes it to divide by zero and assign a value of NaN to motX, motY, and motZ. Those values are then applied to locX, locY, and locZ. The bounding box relies upon those fields, so in turn, its fields all turn to NaN.

        Show
        evilmidget38 (Nate Mortensen) added a comment - - edited I found the issue causing this. I'm too lazy to rewrite what I typed in IRC, so I'll just copy paste my messages: <evilmidget38> https://github.com/Bukkit/CraftBukkit/blob/2482f53aa8368cd8a127d09ddf57c3ad32941839/src/main/java/net/minecraft/server/Entity.java#L1414  <evilmidget38> We cause EntityHumans to dismount through that method, rather than their normal method, which means they normally don't do that teleportation there. <evilmidget38> That teleport is dependent upon "this.vehicle.boundingBox.b", which for arrows seems to be NaN <evilmidget38> So when people dismount an arrow, they're teleported to a y value of NaN, and then kicked from the server when they tell the server their new location is NaN I'm currently working on a fix for this. EDIT: So, I found the root of the issue. Spawning an arrow with zero velocity causes it to divide by zero and assign a value of NaN to motX, motY, and motZ. Those values are then applied to locX, locY, and locZ. The bounding box relies upon those fields, so in turn, its fields all turn to NaN.
        Hide
        me4502 added a comment -

        Could it becoming NaN have anything to do with all the sqrts on X and Z? They will cause a NaN if I recall correctly, because they're a square root of 0.

        Show
        me4502 added a comment - Could it becoming NaN have anything to do with all the sqrts on X and Z? They will cause a NaN if I recall correctly, because they're a square root of 0.

          People

          • Votes:
            8 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: