Spawning in a fish hook/line

Discussion in 'Plugin Development' started by Tommy Raids, Dec 14, 2013.

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

    Tommy Raids

    Ok guys, basically I want it so when you left click a lead it spawns a fishhook entity.
    For some reason this code does not work. Can someone help me? In game when I left click the lead it does not fire the fishing hook. Thanks!

    Code:
    @EventHandler
    public void onGrapplerthingy(PlayerInteractEvent e){
        Player p = e.getPlayer();
        Action a = e.getAction();
        Vector vector = p.getEyeLocation().getDirection();
        if(grappler.contains(p.getName()) && p.getItemInHand().getType() == Material.LEASH){
            if(a == Action.LEFT_CLICK_AIR || a == Action.LEFT_CLICK_BLOCK){
        Entity hook = p.getWorld().spawnEntity(p.getEyeLocation(), EntityType.FISHING_HOOK);
        vector.multiply(3);
        vector.setY(1.0F);
        hook.setVelocity(vector);
     
        }
        }
    }
     
Thread Status:
Not open for further replies.

Share This Page