Solved Clear the items from the floor

Discussion in 'Plugin Development' started by ProStriker123, Dec 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ProStriker123

    How can i remove the items from the world by a method??? can u explain me please
    Every help is appreciated!
     
  2. Offline

    teej107

  3. Code:
    for (Item item : world.getEntitiesByClass(Item.class)) {
        item.remove();
    }
    
    This will loop through every entity that has the class as Item (basically every item) in the world's list of items.

    Code:
    world.getEntitiesByClass(Item.class);
    Returns all the entities in that world as a list. The entities are all of that class only.

    Code:
    item.remove();
    Removes the entity (item) from the world.
     
    MooshViolet likes this.
  4. Offline

    ProStriker123

Thread Status:
Not open for further replies.

Share This Page