Get Entity of Thrown Snowball or Arrow

Discussion in 'Plugin Development' started by bennyty, May 18, 2011.

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

    bennyty

    I need to get the entity snowball or arrow right after it is fired, I am currently trying to use onPlayerInteract but not making much progress.
     
  2. Offline

    chernobyl360

    Here this is part of my plugin :D craftinglogger


    Code:
                try {
                    BufferedWriter out = new BufferedWriter(new FileWriter("plugins/BlockLog/block.logs", true));
                    out.write("["+formattedDate+"] "+ block.getType() + " placed by "+player.getName()+" at (x-"+block.getX()+", y-"+block.getY()+", z-"+block.getZ()+")");
                    out.newLine();
                    out.close();
                } catch (IOException e) {
    This is a basic idea to finding when the arrow/snowball or what ever is thrown

    you could always change this to say *used By* *thrown By* etc

    For a Reference. not to copy :p

    https://github.com/Chernobyl360/CraftingLog
     
  3. Offline

    bennyty

    Thank you for the reply. However I don't think this is what I am looking for. I need the entity of the snowball/arrow while it is in flight (right after it is created and given velocity).
     
  4. Offline

    chernobyl360

    oh wow, now thats complex :D. sorry i wouldnt know how to get into that.
     
  5. Offline

    nisovin

    I'm not sure if you can grab it normally. However, you can just cancel the right click event and then fire the arrow yourself using player.shootArrow(). That function returns an Arrow that you can then do whatever you want to.
     
Thread Status:
Not open for further replies.

Share This Page