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

Fill a chest

Comments in 'Plugin Development' started by JackboyPlay, Feb 17, 2016.

  1. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Hello how can I fill a chest at specified coordinates with random stuff from an Array?
  2. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    example: at the Position 23 4 99 is a chest the chest will be filled on the command /example with random stuff from an Array
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Please define "filled with random stuff from an Array". How is your array formatted? What extent of help are you looking for?
    PocketKiller and CraftYourBukkit like this.
  4. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Ok how can I fill a chest at specified coordinates with a Stone block?
  5. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    PHP:
    $level $this->getServer()->getLevelByName($world);
    $tile $level->getTile(new Vector3($x$y$z));
    if(
    $tile instanceof Chest){
      
    $inventory $tile->getInventory();
      
    $inventory->addItem(Item::get(1));
    }
    Skullex and JackboyPlay like this.
  6. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
  7. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    @AndrewBit how can I make it with more than 1 chest?
  8. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Same.
    PHP:
    $level $this->getServer()->getLevelByName($world);
    $tile $level->getTile(new Vector3($x$y$z));
    $tile2 $level->getTile(new Vector3($x,$y,$z));

    if(
    $tile instanceof Chest){
    $tile->getInventory()->addItem(Item::get(1));
    }

    if(
    $tile2 instanceof Chest){
    $tile2->getInventory()->addItem(Item::get(1));
    }
  9. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    I know

Share This Page

Advertisement