1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Check if certain tile exists at cordinates

Discussion in 'Development' started by kriskotooBG, Mar 15, 2020.

  1. kriskotooBG

    kriskotooBG Spider Jockey

    Messages:
    46
    GitHub:
    kriskotoobg
    I'm sure this is an easy one.. but after going trough almost all of pocketmine's tile classes, i couldn't figure out, whats the most efficient way of checking if a tile exists at the coordinates of a BlockBreakEvent. I have a plugin that creates a custom tile at the position of a placed block, to store some data, but now i want to be able to detect if a broken block has that tile, and if so to close() the tile, and retreive the data.

    To create the custom tile im extending pocketmine\tile\Spawnable.


    PS: Be as technical as you want :)
     
    Last edited: Mar 15, 2020
  2. kriskotooBG

    kriskotooBG Spider Jockey

    Messages:
    46
    GitHub:
    kriskotoobg
    Oh also, i want to be able to do this even after a server restart, without saving cordinates to a file. Is there a method somewhere like gettile?
     
  3. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    if(!is_null($tile = $level->getTile(Vector3))) {
    // your code here
    }
     
  4. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    PocketMine saves and loads tiles automatically
     
  5. kriskotooBG

    kriskotooBG Spider Jockey

    Messages:
    46
    GitHub:
    kriskotoobg
    "$level->getTile" is exactly the method i was looking for! i guess i didn't look hard enough! Thank you!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.