Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

BlockBreakEvent and PlayerInteractEvent with a hoe.

Comments in 'Plugin Development' started by WinniePooh, Nov 22, 2014.

  1. WinniePooh
    Offline

    WinniePooh New Member

    Joined:
    Jun 12, 2014
    Posts:
    16
    Minecraft User:
    WinniePooh
    So, when I'm breaking a block with a hoe (in first moment, when I only touch the block to break it), there bad coords in the message for player, like -34343 43434 31636 - it is working PlayerInteractEvent. Also if I begin breaking this block in second time, there are NEW bad coords. And when the player break this block, there are good coords, like 20 -45 12 (example from my head) - it works BlockBreakEvent.
    And there is a question: how can I disable this bad coords and wherefrom are this coords?
    Sorry for my bad English, It is hard to discrabe right this situation. :c

    PHP:
    private function XYZWfromEvent($evt) {
            return array(
                
    "x" => $evt->getBlock()->getX(),
                
    "y" => $evt->getBlock()->getY(),
                
    "z" => $evt->getBlock()->getZ(),
        }

    public function 
    onBlockTouch(PlayerInteractEvent $evt) {
            
    extract($this->XYZWfromEvent($evt));
            if (
    $player->getInventory()->getItemInHand()->getID() == 290) {
                
    $player->sendMessage("Point with coords (touch) x(" $x ") y(" $y ") z(" $z ")");
            }
        }

    public function 
    onBlockBreak(BlockBreakEvent $evt) {
            
    extract($this->XYZWfromEvent($evt));  
            if (
    $player->getInventory()->getItemInHand()->getID() == 290) {
                
    $player->sendMessage("Point with coords (break) x(" $x ") y(" $y ") z(" $z ")");
            }  
        }
    Here a short video: http://vk.com/video58716282_171020567
    Last edited: Nov 22, 2014
  2. WinniePooh
    Offline

    WinniePooh New Member

    Joined:
    Jun 12, 2014
    Posts:
    16
    Minecraft User:
    WinniePooh
    So, shoghicp said me, that it's McPE coords, not PM... And then he closed my issue in PM git... :(
    Last edited: Nov 24, 2014
    PEMapModder likes this.

Share This Page

Advertisement