Creating an invisible snowball

Discussion in 'Plugin Development' started by nuno1212sss, Jun 29, 2014.

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

    nuno1212sss

    Hello bukkit comunity, I'm here because I have a problem, I am creating a spell and for that I needed a blockiterator, that requires a velocity, one that is given perfectly, by a snowball, but the problem is that even by doing this:
    Code:java
    1. Snowball b = p.launchProjectile(Snowball.class);
    2. b.remove();
    3. BlockIterator bi = new BlockIterator(b.getWorld(), b.getLocation().toVector(), b.getVelocity().normalize(),0.0D, 20 );

    The player will still see the snowball...
    Anyone know how to fix this?
     
  2. If you shoot the snowball fast enough then the client won't be able to see it all.
     
  3. Offline

    nuno1212sss

  4. I'm sure its possible, but you you are removing the snowball as soon as its shot. That may be your issue.
     
  5. Offline

    nuno1212sss

    RenegadeEagle
    Well i've already tried it in another way, removing it after everything
    Code:
            Snowball b = p.launchProjectile(Snowball.class);
            BlockIterator bi = new BlockIterator(b.getWorld(), b.getLocation().toVector(), b.getVelocity().normalize(),0.0D, 20 );
            bi.next();
            while(bi.hasNext()){
                Block block = bi.next();
                for(Entity e : block.getWorld().getEntities()){
                    if(!(e instanceof Player)) continue;
                    if(e.getLocation().getBlockX() == block.getLocation().getBlockX() && e.getLocation().getBlockZ() == block.getLocation().getBlockZ() &&(((Player)e).getEyeLocation().getBlockY() == block.getLocation().getBlockY()||e.getLocation().getBlockY() == block.getLocation().getBlockY())){
                        this.performEffectLast(block.getLocation(),b);
                        break;
                    }
                }
                if(block.getType() == Material.AIR){
                    block.getWorld().playEffect(block.getLocation(), Effect.MOBSPAWNER_FLAMES, 10);
                    continue;
                }
                else{
                    this.performEffectLast(block.getLocation(),b);
                    break;
            }
            }
    b.remove();
    but that left the snowball there for even longer...
     
Thread Status:
Not open for further replies.

Share This Page