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

Would like to have plug in change blocks in area

Discussion in 'Facepalm' started by UncOG, Aug 4, 2017.

  1. UncOG

    UncOG Shog Chips

    Messages:
    0
    Hello,

    I am very new to Minecraft and PocketMine-MP. I do enjoy coding and have a decent background in embedded software. I am creating a fun server for my nephew and I to play on but also taking advantage of learning PHP and whatever else I can through this experience.

    I've gone through most of the tutorials I have found on here and enjoyed them. I want to take things to the next step and change the world I am in. I got an example working, called IAmBack which returns you to the deathlocation. I'd like to place a sign block on that spot now that says RIP $name. I am having a hard time figuring out how to place a block. I have the location I want to place it, and I know that it is a Sign Post, but figuring out the line of code to place the block is confusing me.

    I have tried $player->getLevel()->setBlock($deathlocation,Block::get(Block::STONE)); (just to try placing a block until I find the Sign Post block).

    Any help would be great!
     
  2. UncOG

    UncOG Shog Chips

    Messages:
    0
    I got it to work with the "old" way:

    $player->getLevel()->setBlock($this->lastdeath[$player->getName()],new SignPost(),false,false);

    https://forums.pmmp.io/threads/setblock.2214/ mentions not to use "new Stone()" but to use Block::get(Block::STONE) instead and I can not get that to work.

    Just need to figure out how to add text to it next.
     
  3. UncOG

    UncOG Shog Chips

    Messages:
    0
    I figured out how to implement the Block::get(Block::BLOCKTYPE) working, I like it since it uses a lot less "use" statements, only need "use pocketmine\block\Block;" to get access to any block.
     
  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.