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

Ignite TNT when placed

Discussion in 'Development' started by A354-PH, Feb 9, 2019.

  1. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Hello, how to ignite tnt when its placed?
     
  2. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    PHP:
    public function onPlace(BlockPlaceEvent $ev): void{
        
    $item $ev->getItem();
        if(
    $item->getId() === Item::TNT){
            
    $ev->getBlock()->ignite();
        }
    }
     
  3. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Thank you!
     
  4. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    no problem
     
  5. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    You should set the event's priority to lowest and check if the event is cancelled first. Placing tnts to the lobby world will make them explode even if the event is cancelled.
     
  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.