Mcpe blocks register

Discussion in 'Development' started by tybikman, Feb 11, 2021.

  1. tybikman

    tybikman Silverfish

    Messages:
    22
    I tried to add new blocks to the core (Like as Shroomlight or basalt and etc).

    But I am getting an exception.
    Is this even possible?

    Using method:
    BlockFactory::registerBlock(new Shroomlight(), true);

    Exception:
    Index invalid or out of range

    Shroomlight class:

    PHP:
    use pocketmine\block\Transparent;
    use 
    pocketmine\block\BlockToolType;

    class 
    Shroomlight extends Transparent{
        
        protected 
    $id=485;
        
        public function 
    __construct(int $meta=0){
            
    $this->meta=$meta;
        }
        public function 
    getName() : string{
            return 
    "Shroomlight";
        }
        public function 
    getHardness() : float{
            return 
    1;
        }
        public function 
    getToolType() : int{
            return 
    BlockToolType::TYPE_HOE;
        }
        public function 
    getLightLevel() : int{
            return 
    15;
        }
    }
     
  2. mmm545

    mmm545 Baby Zombie

    Messages:
    154
    GitHub:
    mmm545
    you can't have blocks with IDs higher than 255 in PM3
     
    tybikman likes this.

Share This Page

  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.