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

Solved Create Explosion

Discussion in 'Development' started by ethaniccc, Mar 20, 2020.

  1. ethaniccc

    ethaniccc Baby Zombie

    Messages:
    189
    GitHub:
    ethaniccc
    So, I am making a KitPvP plugin dedicated towards my server. On death, I want to make an explosion that will knock players back, but will not break any blocks or cause any damage.

    I tried looking at these but I still couldn't figure it out:
    ----------------------------------------------------------------------------------------------------------------------
    https://github.com/pmmp/PocketMine-...1fc63b3ab7/src/pocketmine/level/Explosion.php
    -----------------------------------------------------------------------------------------------------------------------
    https://github.com/pmmp/PocketMine-...95/src/pocketmine/entity/object/PrimedTNT.php
    -----------------------------------------------------------------------------------------------------------------------

    Can anyone help me with this?
    Thanks alot in advance!
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Look at the function explodeB and remove the part that creates EntityDamageEvents and attacks using them and the part that ignites nearby blocks.
     
    GamakCZ and ethaniccc like this.
  3. ethaniccc

    ethaniccc Baby Zombie

    Messages:
    189
    GitHub:
    ethaniccc
    I got everything besides the knockback (which is ok since I don't really need it for KitPvP), thank you!
    PHP:
            $level $player->getLevel();
            
    $level->addParticle(new HugeExplodeSeedParticle($player->getPosition()));
            
    $level->broadcastLevelSoundEvent($player->getPosition(), LevelSoundEventPacket::SOUND_EXPLODE);
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    For future reference, the knockback is applied here: https://github.com/pmmp/PocketMine-...78423/src/pocketmine/level/Explosion.php#L201
     
    ethaniccc likes this.
  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.