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

Tiles spawn invisible? Other way around?

Comments in 'Plugin Development' started by SuperChipsLP, Apr 11, 2014.

  1. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Hey people!
    Whenever i spawn a tile, like TILE_CHEST it spawns, but it is
    invisible. When i spawn a normal block, like WOODEN_PLANKS they are
    visible. Now, i thought that this is a PocketMine Bug, so I had to come up with
    another idea. How can i open a chest interface with things in it when i tap on a NETHER REACTOR CORE?
    I know how to set the chests stuff. Just tell me how I can achieve the above. Thanks.

    Codes used:

    To remove the chests on the map (works fine)
    PHP:
    $level $this->api->level->get("SG");
                                
    $level->setBlock(new Vector3($tile->x$tile->y$tile->z$level), $air);
                                
    $tilee $tile;
    To spawn the tiles:
    PHP:
        public function newChests($amount$tile){
            for (
    $i 1$i <= $amount$i++) {
            
    $teleport $tile->level->getSafeSpawn(new Vector3(rand(0255),rand(0127),rand(0255)));
            
    $tile->level->setBlock($teleportBlockAPI::get(5401));
            
    $this->log($teleport->getX()." ".$teleport->getY()." ".$teleport->getZ());
            }
        }
    Last edited: Apr 11, 2014
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I am not sure, but look at this:
    PHP:
    $packet = new ContainerOpenPacket;
    $id $player->windowCnt $packet->windowid max(2$player->windowCnt 99);
    $packet->type WINDOW_CHEST;
    $packet->slots is_array($player->windows[$id]) ? CHEST_SLOTS << CHEST_SLOTS;
    $packet->$tile->x;
    $packet->$tile->y;
    $packet->$tile->z// dunno what this is for
    $player->dataPacket($packet);

    $slots = array(BlockAPI::getItem(0), BlcokAPI::getItem(1), BlockAPI::getItem(2)); // blah blah blah

    $packet = new ContainerSetContentPacket;
    $packet->windowid $id;
    $packet->slots $slots// is_array($slots) equals to true
    $player->dataPacket($packet);
  3. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    This has to go in player.block.touch, right?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Whenever you want to make a chest interface I think. I'm not sure, I just extracted and modified this from the PocketMine source at Tile.php
  5. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Just tested this. Doesn't work.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    In what way doesn't work?
  7. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    The ContainerOpenPacket class wasn't found.
  8. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Or can't I just send the Packet, that new chests have spawned, to all players?
    But idk how to do that..
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Oh I thought you meant like a player taps a block or do something and it opens a window.
  11. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    That was what i thought to go around that glitch.
    Just a few minutes ago, i saw some function (idk where) "spawntoallplayers", so something like that would also work. I just need visible chests, or chest inventories that can be updated.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $tile->spawnTo(), yes.
  13. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Which parameters does it need?
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    ServerAPI::request()->api->tile->spawnToAll($tile);
  15. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    No, I mean the
    spawnTo thingy..
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Oops sorry typo
  17. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Did someone find a solution?
    $this->api->tile->spawnToAll(); doesn't work too.
  18. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Then it is a client bug.
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I've just realized... Although furnace is also a tile (definition: a block with information other than id and damage), it doesn't use a model (look at the texture packs for definition). I think we have something to do with this.
  20. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why does Level->getSafeSpawn() have a Vector3 parameter?

Share This Page

Advertisement