Double chest inventory

Discussion in 'Plugin Development' started by matejdro, May 5, 2011.

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

    matejdro

    It seems that Chest.getInventory() will return inventory for single chest, even when connected into double chest.

    Is there any easier way to edit double chest inventory rather than editing each chest separately?
     
    hintss likes this.
  2. Offline

    Acrobot

    Make a recurrent function:
    http://en.wikipedia.org/wiki/Recursion

    Just get the second chest, check if there is any and do the same function on seconds chest.
    I recommend second class for this.
     
  3. Offline

    matejdro

    I don't mean two chests with same items, but double chest (when you place one chest next to another one and get bigger chest).
     
  4. Offline

    Acrobot

    Yes, double chest.

    Check if there is a chest on NORTH, SOUTH, EAST or WEST, and if so, do the same function (for example removeItem(Chest chest)) on the second chest.
     
  5. Offline

    matejdro

    I think you don't get my question. I don't want to have same items in both chest, but i just want to manage chests at once (as one inventory class). So i can add one for loop for adding items into chest for example.
     
  6. Offline

    Acrobot

    I understand you fully, believe me.
    It's not possible to have double-chest's inventory, but you can make a custom function for it.

    Just check if chest1 + chest2 (It's one double chest) have enough free space (we are for example adding items to chest), and then add how many items possible to one chest, and if they don't fit, put them to second chest. That way you can manage double chests.

    I recommend looking at MinecartMania's code, as its double chest implementation is very, very nice
     
    Afforess likes this.
  7. Offline

    matejdro

    That was my intial idea, but i asked if there is easier or faster way.

    Anyway, thanks for your help.
     
  8. Offline

    hintss

    But the thing is, DoubleChestInventory is a thing (at least, it is now, 3.5 years later)
     
  9. Offline

    Monkey_Swag

    hintss why would you bumo a 3.5 YEAR OLD POST WTF WERE YOU THINKING!?!??!?!
     
  10. Offline

    hintss

    fuk yo shit I'll bump what I want :p
     
    skiithaw and ROTN like this.
  11. Offline

    Monkey_Swag

  12. Offline

    hintss

    also, this is the only pseudorelevant thing in the google results that isn't just the jd for DoubleChestInventory
     
    skiithaw likes this.
Thread Status:
Not open for further replies.

Share This Page