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

Solved Getting fire broken

Comments in 'Plugin Development' started by Irish, May 22, 2016.

  1. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    I have tried onBreak and onUpdate with both not working
    PHP:
    public function onBreak(Breaker $event)
        {
            
    $block $event->getBlock();
            
    $item $event->getItem();
            if (
    $block === Block::get(Block::FIRE)) {
                
    $this->getServer()->broadcastMessage("It should put out the fire now...");
                
    $block->getLevel()->setBlock(new Vector3($block->getX(), $block->getY(), $block->getZ()), Block::get(Block::AIR));
            }
        }

        public function 
    onUpdate(Update $event){
            
    $block $event->getBlock();
            if(
    $block === Block::get(Block::FIRE)){
                
    $this->getServer()->broadcastMessage("It should put out the fire now...");
                
    $block->getLevel()->setBlock(new Vector3($block->getX(), $block->getY(), $block->getZ()), Block::get(Block::AIR));
            }
        }
  2. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    Are these custom events? If not: BlockBreakEvent not Breaker
  3. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    use pocketmine\event\block\BlockBreakEvent as Breaker;
    ImagicalGamer likes this.
  4. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    It seems like you are not using PM...
    ImagicalGamer likes this.
  5. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    Use blockPlaceEvent and check the blocks ID and if it is the same as the Fire ID cancel the event.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Fire block can not be broken same with liquids.
    Legoboy0215 and ImagicalGamer like this.
  7. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    How do you break fire? o_O
    ImagicalGamer likes this.
  8. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    lmao I kept hitting it and this was me:
    [​IMG]
    Legoboy0215 and Hotshot_9930 like this.
  9. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    It is Interact event you are looking for.
  10. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    I did try interact but since it is extends Flowable which extends Transparent, I couldn't get it to work. Any other ideas?
  11. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    are you preventing people placing fire
    or you want it to burn out after awhile?
  12. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    Ok, I did fix it, but you have to get the block above on PlayerInteractEvent to get the fire, and to make sure use (if $event->getBlock() instanceof GroundFire){/**/}. This did work for me, thanks for helping :D

Share This Page

Advertisement