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

Adding new custom Blocks

Discussion in 'Development' started by max1245, Apr 4, 2021.

  1. max1245

    max1245 Spider

    Messages:
    9
    Hi!
    Is there a way i can add custom blocks?
    Do i need Api 4 for it?
    Thanks!
     
  2. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    Yes, to add new blocks you need pmmp4. But, it's a developpement version, very instable. Don't use it. Just wait or use entities to replace modded blocks
     
  3. MrHoller228

    MrHoller228 Spider

    Messages:
    6
    ExtendedBlocks
     
  4. Axon

    Axon Zombie

    Messages:
    276
    You can check out ExtendedBlocks, on how he added custom blocks.
    Or you could use their API.
    The plugin supports version 3.14.0 and above

    Example:

    PHP:
    use pocketmine\block\Block//You can extend any class but be a Block
    use JavierLeon9966\ExtendedBlocks\block\PlaceholderTrait;
    class 
    Sample extends Block{
      use 
    PlaceholderTrait;
      protected 
    $id 526//The id of the block must be positive
      
    public function __construct(int $meta 0){ //Optional
        
    $this->meta $meta;
      }
      ...
    }
     
    Agent 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.