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

How to cet certain block on player move?

Comments in 'Plugin Development' started by MineBuilderFR, Apr 25, 2015.

  1. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    (Sorry for my English im french) How to get a block when the player moves on a block? I want that when the player moves on a specific block: example sponge it happens an event. Beginning of the code:

    public function playerMove (PlayerMoveEvent $ event) {

    $ Block = $ event-> getBlock ();
    if ($ Block () -> getID () == 19) {
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    public function onMove(PlayerMoveEvent $e){
      
    /** @var Block $b */
      
    $b=$e->getPlayer()->getLevel()->getBlock($e->getPlayer()->floor()->subtract(01));
      if(
    $b->getId() === 19){
        
    // execute logic
      
    }
    }
  3. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    Undefined fonction substract()
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is subtract() not substract.
  5. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR

Share This Page

Advertisement