Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-187448

Projectile with a despawn timer may not damage player

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.50.22 Preview, 1.21.31 Hotfix, 1.21.51 Hotfix
    • None
    • Confirmed
    • Windows

      Note from GoldenHelmet: the attached test world includes a modified version of the addon provided by the reporter. I have set the projectile's power, inertia, and uncertainty to 1, and it's despawn timer to 1.0 seconds. I have also slowed the fire rate of the NPC. These changes make the the cause of the issue easier to see and understand.

      Steps to reproduce

      See demo players hit only by client-side projectile which trails server-side by 6 ticks.mp4

      1. Load the attached test world. Proj despawn player dmg bug.mcworld
      2. Spawn a villager on the block labelled "Z = 23".
      3. Observe that the bullet fired by the NPC despawns before it hits the villager.
      4. Spawn a villager on the block labelled "Z = 22".
      5. Observe that the bullet fire by the NCP hits the villager.
      6. Kill the villgers.
      7. Stand on the block labelled "Z = 23".
      8. Changed to survival mode.
      9. Slowly move forward until you get hit by the bullet.

      Expected result

      The bullet hits you (the player) at the same max range that it hits villagers.

      Observed result

      The bullet hits the player at a max range of 16 blocks, but hits villagers at a max range of 22 blocks.

      Analysis

      The bullet moves 1 block/tick and despawns after 1 second, so it travels from the NPC at Z = 0 to Z = 21. It hits the villager at Z = 22 based on its trajectory when it is ticked for the last time at Z = 21. The bullet also hits the player server-side at the same distance. However, the player does not take damage from the bullet until the bullet hits the player client-side. The client-side position trails the server-side position by about 300 ms due to MCPE-179969. If the bullet despawns during the 300 ms that its client-side position is catching up to where it hit the player server-side, then it does not damage the player. The player takes damage in the test world only at Z <= 16 because that distance allows allows the server-side bullet to survive without despawning for long enough that the client-side position can catch up to the player's position.


      When there has component "minecraft:despawn" in projectile, the mob who shoots projectile cannot deal any damage to the player. However, this mob can still deal damage to other non-player mob in same distance. And if I delete the component "minecraft:despawn",  the projectile gets back to normal.

      In the zip I upload, I make a easy Bedrock_Addon to show this bug. I am sure that it is not the problem of my projectile, the timer that makes projectile's despawn is normal, After testing, the projectile can fly a distance of 60 blocks before it despawn.

      The way to test the test_bullet in zip is spawn a villager in front of the test_npc, and switch the survive gamemode for player.

       

            DrabMarker Maker Lee
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: