Chest

Discussion in 'Plugin Development' started by Wantsome909, Aug 28, 2013.

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

    Wantsome909

    how can you make a chest be refilled with different items? like MCWarz...
     
  2. Offline

    chasechocolate

    If you want it to be filled with random items, just search it up, there are tons of threads similar to this already.
     
  3. Offline

    Wantsome909

  4. Offline

    chasechocolate

  5. Offline

    Wantsome909

    chasechocolate not what i want. i would like a chest that all ready place down and it will get refill.
     
  6. Offline

    chasechocolate

    Wantsome909 once you put the block down, create a Chest variable:
    Code:java
    1. Chest chest = (Chest) block.getState();

    Then you can add the items. I would recommend using a List<ItemStack> for the items that get put in the chest:
    Code:java
    1. for(ItemStack item : items){
    2. chest.getBlockInventory().addItem(item);
    3. }
     
  7. Offline

    Wantsome909

  8. Offline

    chasechocolate

    I'm not exactly sure what you mean. But trap chests have inventories too, so you can still use that code.
     
Thread Status:
Not open for further replies.

Share This Page