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

if hit particle on block ?

Comments in 'Plugin Development' started by PmServer, Aug 31, 2016.

  1. PmServer
    Offline

    PmServer New Member

    Joined:
    May 7, 2015
    Posts:
    53
    Minecraft User:
    PmServer
    Hi
    PHP:
    public function onHit(EntityDamageEvent $event){
    $player $event->getEntity();
    $snowball $event->getDamager();
    if(
    $player instanceof Player){
      if(
    $event->getCause() == EntityDamageEvent::CAUSE_PROJECTILE){
      if(
    $snowball instanceof FlameParticle){
    $player->kill();
      }
      }
    }
    }
    its not work .
  2. Mat
    Offline

    Mat Active Member Plugin Developer

    Joined:
    Jun 15, 2014
    Posts:
    179
    Plugins:
    1
    Minecraft User:
    matcracker
    Can you explain more what would you do?
  3. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    How should a particle be a damage cause? It's not solid, which means that it will just go through you, and anyways it is not related to projectiles. Change "FlameParticle" to "Snowball"
  4. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    A particle is not an entity. The animation of a particle will only affect what the client sees. It won't even affect any physics on server-side, client-side or even singleplayer. To the server, the particle flashing for a moment and lingering for a whole minute is the same.
  5. JUZEXMOD
    Offline

    JUZEXMOD New Member

    Joined:
    May 28, 2016
    Posts:
    19
    Minecraft User:
    JUZEXMOD
    this on damage player not hit block
    this hit block code
    PHP:
    public function onTouch(PlayerInteractEvent $event){
          
    $player $event->getPlayer();
          
    $block $event->getBlock()->getId();
     
          if(
    $block == 1){ // 1 this stone block id
       
            
    $player->getLevel->addParticle(new FlameParticle($player));
          }
        }
    // use pocketmine\event\player\PlayerInteractEvent;
    Last edited: Sep 10, 2016

Share This Page

Advertisement