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

Crossbow client - server desync

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.20.4
    • None
    • Unconfirmed
    • (Unassigned)

      When having a charged crossbow and right clicking, the client will always assume that the shot was successful even though the server has not confirmed the event.

      This is inconsistent with how other parts of Minecraft work such as the chest and ender eye that will simply not open / fire unless if the player is experiencing networking lag or the server cancelled the event.

      The attached video demonstrates how a crossbow in 1.20.4 gets cancelled when shot which causes a quick glitchy movement as it's being reset back to its charged state; this makes it really difficult to retexture the crossbow as if the player was holding an object as any undesired right click will cause the players hands to glitch, on top of being confusing for players experiencing network lag / dropped packets as the client thinks the crossbow shot but didn't.

      Update for clarification and testing:

      • To reproduce, no texture pack is necessary
      • A basic Minecraft server was set with the following events
        • On join: Get a charged crossbow
        • When shooting the crossbow: cancel the event
          globalEventHandler.addListener(PlayerUseItemEvent.class, event -> {         event.getPlayer().sendMessage(Component.text("[SERVER] Shooting event cancelled"));         event.setCancelled(true); }
          );
      • As uploading a jar could potentially be harmful due to the possibility of a RAT being added to it, the code for this server is available here: https://pastebin.com/BwcKimEy
      • The server can be accessed on the following IP located in Germany; as this is a client side issue the server doesn't really need to be modified as no server side modification can fix it: 185.207.164.1:31304

       

      Observation: 

      • When the client does a right click, it temporarily thinks that the crossbow shot was successful even though it was cancelled server side, meaning no arrow was ever shot. This would also be the case in the event of temporary packet loss or network congestion
      • The video `video2 (2).mp4` demonstrates how this would look from the perspective of another player. Since the event never happened as far as the server is concerned, the player that shot the crossbow will glitch while other players see nothing; this could cause issues if for example a player has networking issues, shoots, the crossbow appears to be shot and remains in its "uncharged" state when regaining connectivity without resetting to the previous state

       

      Proposed solution:

      • When shooting a crossbow, wait a few milliseconds to confirm with the server that the action actually happened similar to how chests don't open until the server responds

        1. video2.mp4
          5.59 MB
        2. video2 (2).mp4
          4.42 MB

            Unassigned Unassigned
            kian1774 kian1774
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: