Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Falling Block to xyz

Comments in 'Plugin Development' started by Ragnok1234, Aug 26, 2016.

  1. Ragnok1234
    Offline

    Ragnok1234 Active Member

    Joined:
    Jul 18, 2016
    Posts:
    53
    Minecraft User:
    Ragnok123
    Hello guys. I want to make falling blocks like inpvp tntrun to gived XYZ positions, but I do not know HOW. I'm not sure, if NBT can help me.
  2. JonsMC
    Offline

    JonsMC Active Member

    Joined:
    Jul 26, 2016
    Posts:
    107
    Minecraft User:
    JonsMC
    Sorry, i don't undertstand?
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
  4. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Are you sure?
  6. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Yes, just spawns a block...
  7. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Tested it on Mushroom, id is 100
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Screenshot? It must work.
    http://forums.pocketmine.net/threads/create-falling-sand-entity-just-like-blockhunt.8875/
    http://forums.pocketmine.net/threads/need-help-spawning-falling-sand.10661/

    It should spawn block which is different from solid world block:
    • Width and Height is 1. - 0.98 = .02 units bigger than world block
    • Isn't affected by light updates and light in whole (It's how things were in 0.9.0)
    • Players can collide and walk through these entities
    • Is affected by gravity
    • if NO_AI is set to true then the block will (or won't, I don't remember exactly) noclip
  9. Ragnok1234
    Offline

    Ragnok1234 Active Member

    Joined:
    Jul 18, 2016
    Posts:
    53
    Minecraft User:
    Ragnok123
    Ok guys, solved. Thanks for some help.
  10. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Can you paste the whole code to spawn a falling sand block please? Just want to make sure
  11. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    /**
       * Will turn player into block!
       * Hiding block should be done with function Block::hide();
       *
       * @param Player $player
       * @param Integer $id
       * @param Integer $damage
       */
       
    public function disguise(Player $player$id$damage){
         
    # If old packet exists remove it!
         
    if(isset($this->blocks[$player->getName()])){
           unset(
    $this->blocks[$player->getName()]);
         }
         
    # Hide
         
    foreach($this->getServer()->getOnlinePlayers() as $for){
           if(
    $player !== $for$for->hidePlayer($player);
         }
         
    # Add Block entity
         
    $entity Entity::createEntity("FallingSand"$player->getLevel()->getChunk($player->>> 4$player->>> 4), new CompoundTag("", [
               
    "Pos" => new ListTag("Pos", [
                 new 
    DoubleTag(""$player->x),
                 new 
    DoubleTag(""$player->y),
                 new 
    DoubleTag(""$player->z)
               ]),
               
    "Motion" => new ListTag("Motion", [
                 new 
    DoubleTag(""0),
                 new 
    DoubleTag(""0),
                 new 
    DoubleTag(""0)
               ]),
               
    "Rotation" => new ListTag("Rotation", [
                 new 
    FloatTag(""0),
                 new 
    FloatTag(""0)
               ]),
               
    "TileID" => new IntTag("TileID"$id),
               
    "Data" => new ByteTag("Data"$damage),
               
    "Owner" => new LongTag("Owner"$player),
         ]));

         foreach(
    $this->getServer()->getOnlinePlayers() as $for){
           
    $entity->spawnTo($for);
         }
         
    # Save
         
    $player->entityBlock $entity;

         return 
    true;
       }
    This code was used by my BlockHunt plugin.
    MyNameIsTriXz likes this.

Share This Page

Advertisement