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

Solved dont place block

Discussion in 'Development' started by DeNight, Jul 25, 2017.

  1. DeNight

    DeNight Spider

    Messages:
    9
    hi guys, my block is not put, why?
    public function onProjectileHit(ProjectileHitEvent $event) {
    $snowball = $event->getEntity();
    $x = (int)round($snowball->getX());
    $y = (int)round($snowball->getY());
    $z = (int)round($snowball->getZ());
    if($snowball instanceof Snowball){
    $this->getServer()->getDefaultLevel()->setBlock(new Vector3($x, $y+1, $z),new Block(171,14));
    }
    }
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    There are two classes named Snowball in PocketMine. Which one are you importing?
     
  3. DeNight

    DeNight Spider

    Messages:
    9
    What 2 classes ?? I have only 1 snowball in my folder with entity
     
  4. DeNight

    DeNight Spider

    Messages:
    9
    How can I even make the installation of the unit after the snowball landing
     
  5. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    because PMMP also have a class called Snowball
    it's recommended you call it something else
    like CustomSnowball for example
     
    xXSirButterXx likes this.
  6. DeNight

    DeNight Spider

    Messages:
    9
    pls, help me
    public function onProjectileHit(ProjectileHitEvent $event) {
    $snows = $event->getEntity();
    if($snows instanceof CustomSnowball){
    $this->getServer()->getDefaultLevel()->setBlock(new Vector3($snows->getPosition()),new Block(171,14));
    }
    }
     
  7. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Why is this thread marked as solved?
     
  8. DeNight

    DeNight Spider

    Messages:
    9
    I'm very dull and do not understand how to make it so that the unit is delivered, I tried many things, still not at all! :(
     
  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.