Spawn a lingering potion at death of slime

Discussion in 'Plugin Development' started by Flysandwings, Aug 5, 2020.

  1. Offline

    Flysandwings

    Hello all, thanks for reading.

    All I want to do is spawn a lingering potion of poison whenever a slime dies.

    Heres the code I have:

    // on death event
    Location l = e.getLocation();
    World w = Bukkit.getWorld("world");
    ThrownPotion pot = (ThrownPotion)w.spawnEntity(l,EntityType.LINGERING_POTION);
    int data = new Potion(PotionType.POISON).toDamageValue();
    pot.setVelocity(l.getDirection().setY(0));

    This is not working, i'm getting a "No such field error: lingering potion" on the line containing lingering potion.

    Any help is appreciated!
     
  2. Offline

    Strahan

    Yea, that's not at all how you want to go about it. You want to spawn an AreaEffectCloud at the location the entity died, then just apply effects as desired. Don't forget to set duration.
     

Share This Page