Need help solving two issues

Discussion in 'Plugin Development' started by DarkFuzzyCookie, Jun 17, 2015.

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


    Hi there,

    I have two things that I cannot figure out. I have searched the forums and the web but just couldnt find a solution. So maybe you guys could help me out :)

    is checking if the player is looking down.
    I have figured out how to check what direction the player is looking, but now up or down.

    on the BlockBreakEvent, is it possible to break the block with the item in the player's hand, not the block that the player is actually breaking, but for example an adjacent block. All I could find was block.breakNaturally()
  2. Offline


    hmm.. it is possible to break a block with a tool. It would be something like:
    Block#breakNaturally(ItemStack tool); //as seen in the javadoc
    //so for example:
    //In theory, this would break the block above the block the player broke as well, using the tool they where using.
    //Untested, not done in IDE, but JavaDoc checked. Sorry if there are errors.
    void blockBroke(BlockBreakEvent ev){
        Block b = ev.getBlock();
        Player p = ev.getPlayer();
        Block above = b.getRelative(BlockFace.UP);
  3. Offline


    Solution to your first problem, check the players pitch, if it is positive they're looking down, ifs it is negative they're looking up.
Thread Status:
Not open for further replies.

Share This Page