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

spawnEntity - default equipment packets sent to player ignoring null/air values set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • None
    • None
    • git-Spigot-57bbdd8-dea4138 (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
    • Yes

      When spawning an entity and clearing its equipment - the client will see default random equipment until they move out of and back into render range. Using F3+i on such an entity shows empty equipment slots in the NBT data even though it appears to the client.

       

      A workaround for this to delay setting equipment requires a minimum 2-tick delay between creation of the entity and setting of the equipment for clients to see the correct state. I'd really like to not have to live with this 2-tick delay.

      A possibly related issue is that if entities are spawned invisible the client will briefly see the mob before it goes invisible.

       

      Repro steps:

      • set difficulty to HARD
      • Call the function below to generate 10-100 zombies to get enough spawned to find one with weapons or armor.
      • teleport away or move out of render distance
      • return to the zombies and observe that their weapons/armor are gone (as they should be from the start)
      void demoEquipmentBug(Location location, int count) {
          for (int i = 0; i < count; i++) {
              LivingEntity entity = (LivingEntity) location.getWorld().spawnEntity(location, ZOMBIE);
              entity.setRemoveWhenFarAway(false);
              EntityEquipment equipment = entity.getEquipment();
              equipment.setHelmet(null);
              equipment.setChestplate(null);
              equipment.setLeggings(null);
              equipment.setBoots(null);
              equipment.setItemInMainHand(null);
              equipment.setItemInOffHand(null);
          }
      }
      

            Unassigned Unassigned
            _Ross__ Ross
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: