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

BlockOps : commands for /setblock, /fill, /clone

Discussion in 'Facepalm' started by PsyOps, Jul 25, 2017.

  1. PsyOps

    PsyOps Silverfish

    Messages:
    16
    K I am moving over to facepalm as I am a nub and my questions are probably better suited here.
    I made a plugin to bring in /setblock /fill and /clone commands into pocketmine. They act the same as PE (mostly). Right now what is missing is cloning of special blocks like tranferring sign text, and chest items.

    So far everything gets cloned just without that extra info. I am working on sign text first. So far I can change text on a sign but it doesnt keep after a server reset.

    PHP:
                                $tile $sender->getLevel()->getTile(new Vector3($printX,$printY,$printZ));
                                
    $tile->setText("[ Test 1 ]","[ Test 2 ]","[ Test 3 ]","[ Test 4 ]");
    That changes the text instantly but gets reset after server restart. I also tried the "killrate" module way of doing it:
    PHP:
        private function updateSign($pl,$tile,$text) {
            
    $pk = new BlockEntityDataPacket();
            
    $data $tile->getSpawnCompound();
            
    $data->Text1 = new StringTag("Text1",$text[0]);
            
    $data->Text2 = new StringTag("Text2",$text[1]);
            
    $data->Text3 = new StringTag("Text3",$text[2]);
            
    $data->Text4 = new StringTag("Text4",$text[3]);
            
    $nbt = new NBT(NBT::LITTLE_ENDIAN);
            
    $nbt->setData($data);
            
    $pk->$tile->getX();
            
    $pk->$tile->getY();
            
    $pk->$tile->getZ();
            
    $pk->namedtag $nbt->write();
            
    $pl->dataPacket($pk);
        }
    But the existing text clears and the sign is empty. (visually)

    So I'm not certain what is happening.
    any help would be appreciated.

    This is the pastebin for my module: https://pastebin.com/Kg24mkJ9
     
  2. PsyOps

    PsyOps Silverfish

    Messages:
    16
    Do I have to update a tile or block after I setBlock()"?
     
  3. PsyOps

    PsyOps Silverfish

    Messages:
    16
    I hacked up some code and it seems to clone signs from one spot to another. Chests should basically be the same thing.
     
  4. PsyOps

    PsyOps Silverfish

    Messages:
    16
    Code:
    ---
    version: 1.3.0
    myStuff:
      - Test 1
      - Test 2
    ...
    using config and the yaml file is named saveditems.yml
    PHP:
    $this->config = new Config($this->getDataFolder() . "saveditems.yml"Config::YAML, array());
            
                
    $blah $this->config->getAll();
    How do I grab test 1 and test 2 vars?
     
  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.