Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6326

EntityEquiptment#setItemInMainHand de sync issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • None
    • None
    • OS = macOS 11.1
      Java = openjdk version "15.0.1" 2020-10-20
      OpenJDK Runtime Environment AdoptOpenJDK (build 15.0.1+9)
      OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.1+9, mixed mode, sharing)

    • CraftBukkit version git-Bukkit-0bad58f (MC: 1.16.5)
    • just my tester plugin
    • Yes

      Something that has come to my attention, is setting an entity's hand to AIR/NULL does not seem to apply, more specifically a Skeleton.
      Spawning a new one, immediately setting their hand to null/air, their hand was still the bow.

      After doing some testing, I came to realize, it is setting the hand to null, it is just not syncing with the client.
      If I relog, the entity is updated correctly.

      Test Code:
      (I want to point out that I do understand one could use a consumer, this was just brought to my attention from a Skript user, regardless the slot should update)

      Location location = player.getTargetBlockExact(30).getLocation();
      World world = location.getWorld();
      Skeleton spawn = world.spawn(location.add(0, 1, 0), Skeleton.class);
      
      player.sendMessage("Before: " + spawn.getEquipment().getItemInMainHand());
      spawn.getEquipment().setItemInMainHand(null);
      player.sendMessage("After: " + spawn.getEquipment().getItemInMainHand());
      

      This code is included in the provided plugin. Simply load this on a server, point to where you would like to spawn a skeleton, and run command "/test" in game.

      As you can see in the picture, it tells me the hand is AIR, but you can still see his bow.
      When I relog (see second pic), you can see it is updated correctly.

      This issue was just recently brought to my attention. I believe this worked completely fine in 1.16.4, but Im not sure when the issue came about.

            Unassigned Unassigned
            ShaneBee Shane Bee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: