Chest's Items

Discussion in 'Plugin Development' started by BlaSfaiMe, Aug 14, 2019.

  1. Offline

    BlaSfaiMe

    Hey, I'm trying to make a plugin and I've a problem : how can I put items in a chest ? Not a chest inventory but the block... please help !

    Thanks very much ! See you next time :D
     
  2. Offline

    KarimAKL

    @BlaSfaiMe What do you mean? How would that work?
     
  3. Offline

    Kars

    Accessing a chest block will open the chest inventory. Adding items into there is what you want.
     
  4. Offline

    BlaSfaiMe

    I just want to access to the chest inventory of the chest block
     
  5. Offline

    KarimAKL

    @BlaSfaiMe Get the block, get the block's state using Block#getState(), check if the block's state is an instanceof a Chest, then cast the block's state to Chest, and then finally get the inventory using Chest#getInventory() or Chest#getBlockInventory()
     
    BlaSfaiMe likes this.
  6. Offline

    BlaSfaiMe

    Alright !
     
  7. Offline

    Machine Maker

    If your issue has been resolved, please mark this thread as Solved.
     

Share This Page