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

Projectile colliding with entity doing nothing?

Discussion in 'Development' started by mal0ne_23, Jun 22, 2017.

  1. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23


    I thought line 44 would cause the stuff within those brackets to execute when the projectile is either on the ground, or collided with another entity. But when it hits an entity, it just damages them and nothing else happens. What am I doing wrong?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Line 44, make that
    PHP:
    if($this->onGround or $this->isCollided or $this->age 1200){
    Move line 50, 51 off the foreach loop.
    Remove lines 36 - 39.

    Line 42, better to return false.
    AFAIK, when onUpdate($tick) return false, the server will no longer schedule updates for the entity. Basically, onUpdate($tick) will never be called for that entity if onUpdate($tick) returns false any time.
    Whenever you're closing an entity, make sure you return false at the end of it.
     
    mal0ne_23 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.