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

Fake chest tile

Comments in 'Plugin Development' started by PocketKiller, Jan 31, 2016.

  1. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Hello,

    is there a 'way' to create a fake chest tile without getting one from a world?
    but the problem is that MCPE 0.14.0 detects how far is the tile, if it is farther then ? blocks, tile closes..

    Thanks.
  2. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Code by iksaku
    KubixQ and PocketKiller like this.
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    o_O
    Code:
    "Could not pass event 'pocketmine\event\player\PlayerItemHeldEvent' to 'DrawMyThing vDev': Illegal offset type on PocketKiller\DrawMyThing\Loader
    
    
    PHP:
    private function getChest($p){
            
    $info = new Chest($this->getServer()->getDefaultLevel()->getChunk(>> 40>> 4), new Compound("VirtualChest", [
                        new 
    Enum("Items", [Item::get(Item::WOOL01) => 0Item::get(Item::WOOL11) => 1Item::get(Item::WOOL21) => 2Item::get(Item::WOOL31) => 3Item::get(Item::WOOL41) => 4Item::get(Item::WOOL51) => 5Item::get(Item::WOOL61) => 6Item::get(Item::WOOL71) => 7Item::get(Item::WOOL81) => 8Item::get(Item::WOOL91) => 9Item::get(Item::WOOL101) => 10Item::get(Item::WOOL111) => 11Item::get(Item::WOOL121) => 12Item::get(Item::WOOL131) => 13Item::get(Item::WOOL141) => 14Item::get(Item::WOOL151) => 15]),
                        new 
    String("id"Tile::CHEST),
                        new 
    Int("x"$p->x),
                        new 
    Int("y"$p->2),
                        new 
    Int("z"$p->z)
                    ]));
            
    $chest = new ChestInventory($info);
            return 
    $chest;
        }
    [/code]
    Last edited: Jan 31, 2016
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Could not pass event 'pocketmine\event\player\PlayerItemHeldEvent'
  5. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    the line is the new Enum("Items"
    I am calling the function on there.
    AndrewBit likes this.
  6. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    hmm maybe I should use this
    PHP:
        private function getChest($p){
            
    $info = new Chest($this->getServer()->getDefaultLevel()->getChunk(>> 40>> 4), new Compound("VirtualChest", [
                        new 
    Enum("Items", []),
                        new 
    String("id"Tile::CHEST),
                        new 
    Int("x"$p->x),
                        new 
    Int("y"$p->2),
                        new 
    Int("z"$p->z)
                    ]));
            
    $chest = new ChestInventory($info);

            
    $chest->addItem(Item::get(Item::WOOL01));
            
    $chest->addItem(Item::get(Item::WOOL11));
            
    $chest->addItem(Item::get(Item::WOOL21));
            
    $chest->addItem(Item::get(Item::WOOL31));
            
    $chest->addItem(Item::get(Item::WOOL41));
            
    $chest->addItem(Item::get(Item::WOOL51));
            
    $chest->addItem(Item::get(Item::WOOL61));
            
    $chest->addItem(Item::get(Item::WOOL71));
            
    $chest->addItem(Item::get(Item::WOOL81));
            
    $chest->addItem(Item::get(Item::WOOL91));
            
    $chest->addItem(Item::get(Item::WOOL101));
            
    $chest->addItem(Item::get(Item::WOOL111));
            
    $chest->addItem(Item::get(Item::WOOL121));
            
    $chest->addItem(Item::get(Item::WOOL131));
            
    $chest->addItem(Item::get(Item::WOOL141));
            
    $chest->addItem(Item::get(Item::WOOL151));

            return 
    $chest;
        }
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    but Y doesn't have to be + 2
  8. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
  9. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    STOP spam please
    PEMapModder likes this.
  10. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    I am making it next to the player so 0.14.0 players are able to open it, as on my main post.
  11. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    delete the posts I finally deleted them, sorry it was my Internet lagging while accessing through HTTPS
  12. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i think player can open the chest if tile is in chunk sended to player
  13. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    no, MCPE 0.14.0 closes the opened tile when it goes farther then *idk* blocks, tested on singlePlayer with Minecarts with chest/hopper and on server a normal chest that is 14 blocks far
  14. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Ew.
    PHP:
    private function getChest($p){
            
    $info = new Chest($this->getServer()->getDefaultLevel()->getChunk(>> 40>> 4), new Compound("VirtualChest", [
                        new 
    Enum("Items", []),
                        new 
    String("id"Tile::CHEST),
                        new 
    Int("x"$p->x),
                        new 
    Int("y"$p->2),
                        new 
    Int("z"$p->z)
                    ]));
            
    $chest = new ChestInventory($info);
            for(
    $i 0$i 15$i++){
               
    $chest->addItem(Item::get(Item::WOOL$i1));
            }


            return 
    $chest;
        }
    Please.
    Last edited: Feb 2, 2016
    KubixQ and Creeperface like this.
  15. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Kind of off topic, but you should prepare for PHP7.
    PEMapModder likes this.
  16. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Very Off-topic.. I know all the changes on PHP7 and the API.
  17. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    correction:
    PHP:
            for($i 0$i <= 15$i++){//the i is important!
               
    $chest->addItem(Item::get(Item::WOOL$i1));
            }
  18. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Woops, somehow forgot it(that happens when coding on phone xD) -> Edited. Though, if you use <= 15, it will also do 16, won't it?
    PocketKiller likes this.
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you know them, you would know that it is not off-topic at all. PHP 7 disallows the use of string and int as class names, and the PHP 7-compatible API changes all NBT tag class names,

Share This Page

Advertisement