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

Spawning Explosions

Comments in 'Plugin Development' started by Calrizer, Nov 4, 2015.

  1. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    Hello people of PocketMine,

    Today I am looking to experiment with explosions and what the code is to spawn them.

    Any help is appreciated,

    Cheers,

    -Calrizer
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  3. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    How would I implement it and which function should I use?
    __construct()
    explosionA()
    Or
    explosionB()
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    what you want
    but you must create an instance look at primed TNT
  5. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    Basically I would like to spawn a TNT block under the player.
    I know the code to get the players position as a Vector3, I would like to spawn a TNT explosion using those coordinates.
  6. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    How would I use spawnTo() from the PrimedTNT file?
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  8. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    So I this for example would work:

    PHP:
    public function onChat(PlayerChatEvent $event){
         
    $player $event->getPlayer();
         
    $explosion = new Explosion($this$force$this);
         
    $explosion->spawnTo($player);
    }
  9. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    You will explode them because they speak? What a meanful guy.
  10. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    // His ideas xD
  11. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    No...

    Use A or B
  12. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    Free speech is strictly forbidden on my server XD
    Last edited: Nov 4, 2015
    thebigsmileXD likes this.
  13. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    I got it to work by the way heres the code:

    PHP:
    $force 10

    $position 
    $player->getPosition();

    $explosion = new Explosion($position$force$this);

    $explosion->explode();
    Now, how can you cause the explosion to not break any blocks?
  14. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    onExplode() get affected blocks and put them back.
  15. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    How would one go about doing that?
  16. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Use $explosion->explodeB() I'm pretty sure.
  17. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    Yea your right
    CrazedMiner likes this.
  18. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    Yep that works perfectly! Thank you to all of you that helped out!

Share This Page

Advertisement