Snowball Velocity

Discussion in 'Plugin Development' started by Yekllurt, Dec 25, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Yekllurt

    Hi guys,
    i tried to make an Entity with the velocity of a snowball that flys like a snowball, but out of some reason i does not work. It just drops like on to the ground. I try to make this since i want to give the snowball a name which u can't make if u just launch it like a projectile. So i tried to do this. The point is i want to get in the EntityDamageByEntityEvent the projectille per name, which works it's just this flying.

    My code to launch/spawn it: (Pastebin)

    Snowball sN = p.launchProjectile(Snowball.class);
    sN.setVelocity(sN.getVelocity().multiply(1.5));
    Vector vector = sN.getVelocity();
    sN.setVelocity(sN.getVelocity().multiply(0));
    sN.remove();
    sN.eject();

    Entity s = p.getWorld().spawnEntity(p.getLocation(), EntityType.SNOWBALL);
    s.setCustomName(name);
    s.setVelocity(vector);
     
  2. Offline

    Konato_K

    Well, mob and other entities have different mechanics than projectiles, so you'll probably have to use a different velocity instead of the same as a snowball.

    Second, I'm not sure if this may or not be a problem, but I tested this with players in movement, and when they are moving on ground the velocity does not apply very well, instead you have to lift them first and then set the velocity. I have only tested this with moving players though.
     
  3. Offline

    mythbusterma

    @Yekllurt

    Well, you kinda set the velocity to zero, then you remove the entity. I'm not sure what you're trying to do here....
     
    Gamesareme and Funergy like this.
Thread Status:
Not open for further replies.

Share This Page