Shooting Wither Skulls

Discussion in 'Plugin Development' started by nitrousspark, Mar 17, 2013.

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

    nitrousspark

    if you've ever been on the super craft bros server, you might know the wither class and how it shoots wither skulls, i want to know how to do this, i have it so it spawns a wither skull but when i give it a velocity it just flashes and jitters. but it does eventually reach its target. how do i make it so it doesnt flash. or just a different way to do it.
     
  2. Offline

    TheUpdater

    so you want to shoot a wither skull?
     
  3. Offline

    nitrousspark

  4. Offline

    Rprrr

    Spawn an entity, set the velocity. Done.

    edit: Misread it.. make sure you don't set the velocity too high?
     
  5. Offline

    nitrousspark

    i did that and how do i know if its too fast? it seems preaty slow as is. and im setting it to the players direction, how would i reduce the velocity that i got from the player.
     
  6. Offline

    phips99

    Code:
    Location loc = player.getEyeLocation().toVector().add(player.getLocation().getDirection().multiply(2)).toLocation(player.getWorld(), player.getLocation().getYaw(), player.getLocation().getPitch());
    WitherSkull skull = player.getWorld().spawn(loc, WitherSkull.class);
    where you see the multiply you can set the speed.
     
  7. Offline

    nitrousspark

    allright that preatty much didnt do anything
    just in case, i made a really quick video to show what happens
     
  8. Offline

    chasechocolate

    nitrousspark what code are you using to launch the projectile?
     
  9. Offline

    nitrousspark

    chasechocolate

    Code:
    @EventHandler
    public void shoot(ProjectileLaunchEvent event) {
    if (event.getEntity().getType() == EntityType.ARROW) {
    if (event.getEntity().getShooter() instanceof Player) {
    Player player = ((Player) event.getEntity().getShooter());
    if (Core.getPlayerYaml(player).get("class").equals("astronaut")) {
    event.setCancelled(true);
    Location loc = player
    .getEyeLocation()
    .toVector()
    .add(player.getLocation().getDirection()
    .multiply(2))
    .toLocation(player.getWorld(),
    player.getLocation().getYaw(),
    player.getLocation().getPitch());
    WitherSkull skull = player.getWorld().spawn(loc,
    WitherSkull.class);
    skull.setShooter(player);
    }
    }
    }
    }
    if i reduce the velocity will it not flash?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  10. Offline

    chasechocolate

    nitrousspark why not just use skull.setVelocity(player.getLocation().getDirection())?
     
  11. Offline

    nitrousspark

    chasechocolate ive been trying that, and its doing the exact same thing as in the video. is there a way to shoot it, "naturally" kind of like how theres a world.dropItemNaturally();
     
  12. Offline

    Shinxs

    do skull.setVelocity(arrow.getVelocity);
    and then event.setCanceled(true); so the arrow doesn't show up
     
  13. Offline

    HeyShibby

    I believe this is just a bukkit bug as I have the same problem at the moment.
     
  14. Offline

    nitrousspark

    just went on the super craft bros server and the wither skulls are working just fine.
     
  15. Offline

    xXEmeraldPxX

    I have the same issue, would love a fix for this, and yeah they're working well in SCB. ;)
     
  16. Offline

    skipperguy12

    Uhhh....it works?
    Straight from my plugin:
    Code:
        public void onShoot(EntityShootBowEvent e){
            if (e.getEntity() instanceof Player) {
                Player p = (Player) e.getEntity();
                if(p.hasPermission("witherbow.shoot")){
                    e.setCancelled(true);
                    p.launchProjectile(WitherSkull.class).setVelocity(e.getProjectile().getVelocity());
                }
            }
        }
    http://dev.bukkit.org/server-mods/witherbow/
     
    Cloaking_Ocean and xXEmeraldPxX like this.
  17. Offline

    awesomeXD

    I'm making my first plugin about shooting wither skulls from a command when i added this to it, still flashes and jitters when I use my command.

    never mind fixed it. although when i used it it didn't shoot anything it must have been a different version of my plugin

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
Thread Status:
Not open for further replies.

Share This Page