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

Solved Remove dropped items

Comments in 'Plugin Development' started by AppPhil, Oct 10, 2015.

  1. AppPhil
    Offline

    AppPhil Active Member

    Joined:
    Oct 3, 2015
    Posts:
    54
    Hey there,

    how can I remove dropped Items on a specific position or near this position?
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    public function removeItems(Position $pos$radius){
            foreach(
    $pos->getLevel()->getEntities() as $ent){
                if(
    $ent instanceof \pocketmine\entity\Item && $pos->distance($ent->getPosition() <= $radius)){
                    
    $ent->close();
                }
            }
        }
    Jelly9912 and AppPhil like this.
  3. AppPhil
    Offline

    AppPhil Active Member

    Joined:
    Oct 3, 2015
    Posts:
    54
    Thanks works!

Share This Page

Advertisement