Cancelling EntityTransformEvent does not keep equipment

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • 4424-Spigot-aa7842e-442838f (MC: 1.21.4) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
    • Yes

      If a plugin cancels the EntityTransformEvent event, the equipment on the original entity will be lost as it goes to the transformed entity.

      How to reproduce:

      1. Run a test plugin with the following code:
        @EventHandler
        public void onEliteTransform(EntityTransformEvent event) {
            Bukkit.getLogger().info("Cancelled EntityTransformEvent for " + event.getEntity().getName());
            event.setCancelled(true);
        }
        
      2. Run this command in the console:
        give @p zombie_spawn_egg[entity_data={id:zombie,DrownedConversionTime:20,HandItems:[{id:diamond_sword,count:1},{id:shield,count:1}],ArmorItems:[{id:diamond_boots,count:1},{id:diamond_leggings,count:1},{id:diamond_chestplate,count:1},{id:diamond_helmet,count:1}],HandDropChances:[0f,0f],ArmorDropChances:[0f,0f,0f,0f]}] 1
        
      3. Spawn the Zombie

      Observed Results:
      The Zombie lost its equipment. You can see that it went to the transformed entity by doing:

      EntityEquipment equipment = ((LivingEntity) event.getTransformedEntity()).getEquipment();
      Bukkit.getLogger().info("ArmorContents: " + equipment.getArmorContents());
      Bukkit.getLogger().info("ItemInMainHand: " + equipment.getItemInMainHand());
      Bukkit.getLogger().info("ItemInOffHand: " + equipment.getItemInOffHand());
      

      Expected Results:
      The Zombie keeps the equipment since the event was cancelled.

            Assignee:
            Unassigned
            Reporter:
            Asteraoth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: