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

Slot on Chest

Comments in 'Plugin Development' started by JackboyPlay, Mar 6, 2016.

  1. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    If I fill an chest how can I set the slot where the item will be filled?
  2. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
    What do you mean?
    In-game or via plugin?
    PHP:
    $level->getTile(new Vector3($x$y$z))->getInventory()->setSlot()
    // x, y, z are the coords of chest
    JackboyPlay likes this.
  3. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    How does that work for example I set on chestslot 1 the item with the id 3
  4. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
    better use then
    PHP:
    $level->getTile(new Vector3($x$y$z))->getInventory()->setItem($indexItem::get($id$damage$amount));
    $index = slot starting from 0 (first slot)

    Your example
    PHP:
    $level $this->getServer()->getLevelByName("world");
    $x 128;
    $y 65;
    $z 138;
    $index 0;
    $id 3;
    $level->getTile(new Vector3($x$y$z))->getInventory()->setItem($indexItem::get($id));
    minebuilder0110 likes this.

Share This Page

Advertisement