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

spawn items

Comments in 'Plugin Development' started by Creeperface, May 3, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    please how to spawn specified item at specified coordinates in specified level?
    thanks :)
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Level->dropItem()?
    Guillaume351 likes this.
  3. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    It is a question?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    An unsure answer.
    Jon likes this.
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    OK thanks and sorry i didn't look well in pocketmine methods.
  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    but i don´t know how to add coordinates
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Instantiate a new Vector3 objxt.
  8. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    dropItem(Vector3,Item) is working :)
  9. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    and this?
    PHP:
    public function dropItems(Item $itemLevel $level){
    //position x=119 y=8 z=505
        
    $players $level->getPlayers ();
            foreach ( 
    $players as $p ) {
                            
    $pos = new position(1198505);
                
    $item->setCount(1);
                            
    $pk = new AddItemEntityPacket();
                
    $pk->$pos->getX ();
                
    $pk->$pos->getY ();
                
    $pk->$pos->getZ ();
                
    $pk->meta 0;
                            
    $pk->yaw 0;
                            
    $pk->pitch 0;
                            
    $pk->roll 0;
                            
    $pk->item $item;
                            
    $pk->eid $item->getId();
                
    $p->directDataPacket($pk);
    }
    }
  10. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    or my second code:
    PHP:
    public function dropItems(Item $itemLevel $level){
        
    $pos = new position(1198505);
    $level->dropItem($item->getId(),$pos);
    }
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No. It should be directly
    PHP:
    $pos = new Vector3(1198505);
    $level->dropItem($item$pos);
  12. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    OK thanks a lot.

Share This Page

Advertisement