Pocketmine-mp: setMaxValue() on null.

Created on 26 Mar 2017  路  3Comments  路  Source: pmmp/PocketMine-MP

Issue description




I was expecting the zombie's max health value to change.
The server gave me a critical error instead.

Steps to reproduce the issue

  1. Spawn a zombie/living non-player
  2. Log your console.

OS and versions

  • PocketMine-MP: 7a36d80
  • PHP: 7.0.17
  • Server OS: Ubuntu 14.04
  • Game version: Win10

Crashdump, backtrace or other files

API Invalid

Most helpful comment

My bad.
That solves it. I was trying to move my project over from G-fork to here.
All the mob classes had this:

    public function initEntity(){
        $this->setMaxHealth(20);
        parent::initEntity();
    }

Thanks <3

All 3 comments

If I understood correctly, you simply spawned a zombie and this issue occurred? If so, I'm afraid I can't reproduce this.

ah, I think I see your issue. You're using a custom Zombie class by my eyes. When your initEntity() is called, have you called parent::initEntity() before attempting to do this? If you haven't, the attribute map will not yet be initialized.

My bad.
That solves it. I was trying to move my project over from G-fork to here.
All the mob classes had this:

    public function initEntity(){
        $this->setMaxHealth(20);
        parent::initEntity();
    }

Thanks <3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RedstoneAlmeida picture RedstoneAlmeida  路  3Comments

L3ice picture L3ice  路  3Comments

arfianadam picture arfianadam  路  3Comments

dktapps picture dktapps  路  3Comments

TheDiamondYT1 picture TheDiamondYT1  路  3Comments