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

Strange mob behaviour after trying to set him riding a player

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • None
    • Windows 10 with Java 1.8.0_92.
      Spigot 1.10-R0.1-SNAPSHOT, 1.9.4-R0.1-SNAPSHOT.

      I was just trying to spawn an Entity near a player on login and set it riding him through:

      Player p = event.getPlayer();
      Chicken chicken = (Chicken) p.getWorld().spawnEntity(p.getLocation(), EntityType.CHICKEN);
      
      p.setPassenger(chicken);
      

      No errors are thrown, however, even if setPassenger() returns true with:

      System.out.println(String.valueof(p.setPassenger(chicken)));
      

      ... nothing seems to ride the player. Nor it seems the Entity (in this case, a chicken, but the bug is replicable with whatever EntityType) spawned at all.
      But the Entity actually exists: try shooting an arrow or another Projectile over your head and you'll get the drops. Note that you can't hit it with a sword.

      Even funnier:

      public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
              if(label.equalsIgnoreCase("t")){
                  Player p = (Player) sender;
                  Chicken chicken = (Chicken) p.getWorld().spawnEntity(p.getLocation(), EntityType.CHICKEN);
                  p.setPassenger(chicken);
              }
      return true;
      }
      

      Nothing weird. However, in this case, the Chicken is visible on your feet. The thing is that you can kill the Entity both by killing what you see (sword or Projectile) or by shooting a Projectile over your head. In this last case, the visible Entity will display the death animation and die. So they are linked, as if there was an Entity with two hitboxes.

      I've tested this with the last build of Spigot 1.9.4 and the last one of 1.10 (git-Spigot-3ccadba-7f1a322 MC: 1.10)

            Unassigned Unassigned
            missaglia.alfio acc01922
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: